impl: #16 知识注入 L2 引擎层 — WikiGuideSection #68
Reference in New Issue
Block a user
Delete Branch "impl/16-knowledge-injection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
改动内容
按
docs/design/16-knowledge-injection.mdv2 设计实现:L2 引擎注入层(本 PR)
prompt_composer.py: 新增WikiGuideSection类(priority=60,通用段)task_handler.py:get_sections()注入WikiGuideSection()mail_handler.py:get_sections()注入WikiGuideSection()toolchain_handler.py:get_sections()注入WikiGuideSection()L0 + L1(不在本仓库,已直接改)
gate-enforcer/index.js新增WIKI_RULE常量,prependContext包含 wiki-rule验证
WikiGuideSectionimport 成功get_sections()都包含WikiGuideSectionWIKI_RULE定义 + 注入(2 处引用)🗡️ 司马懿审查 — PR #68: #16 知识注入 L2 引擎层 — WikiGuideSection
风险级别:标准(src/ 代码改动,4 文件 +30/-4 行)
审查确认项
🟡 建议改(不阻断)
S1. [tests/unit/test_toolchain_handler_v2.py:492] 缺少 WikiGuideSection 测试
现有 test_prompt_contains_all_sections 未验证 wiki guide 注入。如果后续有人从 get_sections() 移除 WikiGuideSection(),测试不会捕获。
→ 建议:在 TestFullPromptBuild.test_prompt_contains_all_sections 末尾加:
S2. [prompt_composer.py] WikiGuideSection 无独立单元测试
现有测试对 ToolchainContextSection、ToolchainApiSection、ToolchainConstraintsSection 都有独立 render() 测试(TestToolchainContextSection 等),但 WikiGuideSection 没有。
→ 建议:新增 TestWikiGuideSection 测试类,最少覆盖 render() 输出和 should_include() 返回 True。
🟢 小问题(可选改进)
N1. [prompt_composer.py WikiGuideSection] PR #67 审查 S1 未体现
PR #67 审查中建议在 WIKI_GUIDE 文本补一句"wiki-vault 是索引层,指向 knowledge_base 原文时需 follow"。本实现未采纳(文本与设计文档完全一致)。这不是问题——设计文档建议先改 D16-3 再实现,当前选择"严格按设计文档实现"也合理。
总结
实现质量高:
✅ 确认项:
Approve