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:
浅念
2026-10-12 20:16:40 +08:00
parent e34378257f
commit 1824bb1590
6 changed files with 20 additions and 7 deletions
+4
View File
@@ -35,6 +35,10 @@ def test_facts_concatenated_between_system_and_context():
asyncio.run(svc.chat([{"role": "user", "content": "hi"}], context="⚠️ 提醒"))
p = svc.provider.prompts[0]
assert "HESUPIPE" in p and "HDPE" in p # 建材事实在场
# 审查 I-1: AIService 组装缝守护——默认服务的 $DEFLECTION_POOL 话术池
# 必须真实注入(锚分组行格式而非具体话术,话术内容随墙演进而变);
# 防 Task 9 重接提示词线时静默丢池
assert "- EN:" in p and "- ZH:" in p
# Task 6: system 组装含 $DEFLECTION_POOL 话术池注入,SYSTEM_PROMPT 原文
# 不再是组装结果的连续子串——改以首行/事实卡标题锚定顺序(语义等价)
assert (p.index(SYSTEM_PROMPT.splitlines()[0])