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,72 @@
|
||||
"""Entry-level gap report persistence and staleness detection."""
|
||||
|
||||
from app.resume_document_core import (
|
||||
attach_gap_report_staleness,
|
||||
entry_fingerprint,
|
||||
find_entry,
|
||||
gap_report_is_stale,
|
||||
)
|
||||
from app.resume_document_mutations import set_entry_gap_report
|
||||
|
||||
|
||||
def _content() -> dict:
|
||||
return {
|
||||
"sections": [
|
||||
{
|
||||
"id": "sec1",
|
||||
"kind": "project_experience",
|
||||
"items": [{"id": "e1", "project_name": "项目 A", "description": "完成了开发。"}],
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
GAPS = [
|
||||
{
|
||||
"dimension": "quantified_outcome",
|
||||
"severity": 4,
|
||||
"askability": 0.5,
|
||||
"job_weight": 3,
|
||||
"evidence": "缺少量化成果。",
|
||||
"value": 6.0,
|
||||
}
|
||||
]
|
||||
|
||||
|
||||
def test_set_entry_gap_report_does_not_change_fingerprint() -> None:
|
||||
content = _content()
|
||||
before = entry_fingerprint(find_entry(content, "e1")[1])
|
||||
|
||||
content = set_entry_gap_report(content, "e1", GAPS)
|
||||
|
||||
entry = find_entry(content, "e1")[1]
|
||||
assert entry["gap_report"]["gaps"] == GAPS
|
||||
assert entry["gap_report"]["based_on"] == before
|
||||
assert entry_fingerprint(entry) == before
|
||||
assert gap_report_is_stale(entry) is False
|
||||
|
||||
|
||||
def test_gap_report_stale_after_entry_edit() -> None:
|
||||
content = set_entry_gap_report(_content(), "e1", GAPS)
|
||||
entry = find_entry(content, "e1")[1]
|
||||
|
||||
entry["description"] = "手动编辑后的描述。"
|
||||
|
||||
assert gap_report_is_stale(entry) is True
|
||||
|
||||
|
||||
def test_gap_report_missing_is_not_stale() -> None:
|
||||
entry = find_entry(_content(), "e1")[1]
|
||||
|
||||
assert gap_report_is_stale(entry) is False
|
||||
|
||||
|
||||
def test_attach_gap_report_staleness_returns_a_presentation_copy() -> None:
|
||||
content = set_entry_gap_report(_content(), "e1", GAPS)
|
||||
entry = find_entry(content, "e1")[1]
|
||||
entry["description"] = "已编辑。"
|
||||
|
||||
presentation = attach_gap_report_staleness(content)
|
||||
|
||||
assert find_entry(presentation, "e1")[1]["gap_report"]["stale"] is True
|
||||
assert "stale" not in find_entry(content, "e1")[1]["gap_report"]
|
||||
Reference in New Issue
Block a user