generated from kgod/ai-review-template
feat: builder 简历生成 + 轻度优化 + 简历导入交付副本
自内部仓库剥离深度优化与 RAG 知识库后的交付版本: - Builder 对话式简历生成(FSM + 意图路由 LLM 兜底增强) - 条目级轻度优化:事实覆盖门禁 + STAR/bullet 修复链,功能/简介/成果与技术栈同级保护 - 简历导入:DOCX/PDF 解析、结构归一、手机号脱敏 - PostgreSQL 运行时 + Alembic 迁移链 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
"""队列护栏测试:/create 幂等不重置队列、旧格式 profile 惰性初始化。"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi.testclient import TestClient
|
||||
|
||||
from test_api import BASE, active_component, event
|
||||
from test_enrichment_flow import (
|
||||
continue_enriching,
|
||||
created_session,
|
||||
skip_current,
|
||||
submit_to,
|
||||
)
|
||||
from test_enrichment_records import (
|
||||
INTERNSHIP_ENTRY,
|
||||
choose,
|
||||
confirm_active,
|
||||
latest_patch_revision,
|
||||
)
|
||||
|
||||
|
||||
def test_create_idempotent_with_queue_initialized(client: TestClient):
|
||||
session_id, body = created_session(client)
|
||||
body = continue_enriching(client, session_id, body)
|
||||
body = submit_to(client, session_id, body, "record_fields", dict(INTERNSHIP_ENTRY)).json()
|
||||
body = confirm_active(client, session_id, body)
|
||||
assert latest_patch_revision(body) == 2
|
||||
|
||||
# 重复创建:幂等返回,不重置队列与 revision
|
||||
duplicate = client.post(f"{BASE}/sessions/{session_id}/create", json={})
|
||||
assert duplicate.status_code == 200, duplicate.text
|
||||
assert duplicate.json()["created"] is False
|
||||
|
||||
# 队列仍停留在 AddAnother,可正常推进到 project
|
||||
body = choose(client, session_id, body, "next")
|
||||
assert active_component(body)["data"]["module"] == "project"
|
||||
|
||||
|
||||
def test_legacy_session_without_enrichment_keys_lazy_initializes(client: TestClient):
|
||||
# 创建后的 profile 不含 records/tags/enrichment 键(等同旧会话格式),
|
||||
# 首个 continue_enriching 应惰性建队列并正常走完整链路。
|
||||
session_id, body = created_session(client)
|
||||
body = continue_enriching(client, session_id, body)
|
||||
assert active_component(body)["data"]["component"] == "record_fields"
|
||||
assert active_component(body)["data"]["module"] == "internship"
|
||||
|
||||
for _ in range(5):
|
||||
body = skip_current(client, session_id, body)
|
||||
assert body["stage"] == "RESUME_ENRICHING"
|
||||
assert active_component(body)["data"]["component"] == "custom_card_picker"
|
||||
|
||||
body = choose(client, session_id, body, "finish")
|
||||
assert body["stage"] == "CONTENT_READY"
|
||||
assert active_component(body)["data"]["component"] == "content_ready_card"
|
||||
Reference in New Issue
Block a user