test: PromptProvider 审查修复(组装缝断言/占位符约定文档与glob守护/边界注记)
- I-1: test_company_facts 捕获完整 prompt 的用例补话术池注入断言
("- EN:"/"- ZH:" 分组行在场)——守 AIService 组装缝,防 Task 9
重接提示词线时静默丢池
- I-2: seed_profiles/README.md 落档 $DEFLECTION_POOL 占位符约定
(缺失 = 话术池静默不注入);test_prompt_provider 占位符防漂移改
glob 遍历 seed_profiles/*/prompts/system.md,第三租户自动纳管
(空 glob 显性兜底,防假守护)
- Minor-1 注记: _format_deflection_pool docstring 记已知边界——条目
含引号/换行暂不转义,Phase 2 编辑器批次处理
- Minor-5: test_provider_loads_from_tenant_dir 删恒真 or 侧,改单一
明确断言;registry 加载期显性失败清单补 prompts 读取失败
(FileNotFoundError 说明);conftest build_jiancai_runtime 注明
data_dir 仅占位、从不 ensure_ready
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -30,7 +30,7 @@ def _wall(slug: str) -> dict:
|
||||
|
||||
def test_provider_loads_from_tenant_dir():
|
||||
p = PromptProvider.from_dir(JC_PROMPTS)
|
||||
assert "HESUPIPE" in p.company_facts or "管道" in p.system
|
||||
assert "HESUPIPE" in p.company_facts # jiancai 事实卡身份标记(审查 Minor-5: 删恒真 or 侧)
|
||||
|
||||
|
||||
def test_provider_reads_all_four_prompts():
|
||||
@@ -57,9 +57,13 @@ def test_system_prompt_injects_deflection_pool():
|
||||
|
||||
|
||||
def test_system_md_carries_placeholder():
|
||||
# 防漂移锚: 两租户 system.md 必须保留占位符,丢了它话术池就静默失联
|
||||
for prompts_dir in (JC_PROMPTS, AUTO_PROMPTS):
|
||||
assert "$DEFLECTION_POOL" in PromptProvider.from_dir(prompts_dir).system
|
||||
# 防漂移锚(审查 I-2): glob 遍历全部租户 system.md——第三租户落地即自动
|
||||
# 纳管(约定同步落档 seed_profiles/README.md: 缺占位符 = 话术池静默不注入);
|
||||
# 空 glob 恒绿 = 假守护,先断言至少一份
|
||||
system_mds = sorted((REPO / "seed_profiles").glob("*/prompts/system.md"))
|
||||
assert system_mds
|
||||
for md in system_mds:
|
||||
assert "$DEFLECTION_POOL" in md.read_text(encoding="utf-8"), md
|
||||
|
||||
|
||||
def test_build_system_appends_facts_after_system():
|
||||
|
||||
Reference in New Issue
Block a user