完善 RAG、Skill 与 Memory 契约测试并修复边界问题 - #25
KeyCOrigin wants to merge 3 commits into
Conversation
haolpku
left a comment
There was a problem hiding this comment.
Requesting changes for two correctness blockers.
-
RuntimeFactorycaches independent runtimes by(profile, surface-set). A graph-only runtime can be cached bydatamind_graph_query, whiledatamind_use_folderwrites through a separate kb+graph runtime. The graph-only NetworkX store then remains stale indefinitely. Please share services per profile or invalidate/reload sibling cache entries after writes, with a cross-route regression. -
The lock-file stale recovery has no ownership token. If operation A exceeds one hour, B may unlink A's lock and acquire a new one; when A finishes, A unlinks B's lock, allowing C to enter concurrently. Use an OS advisory lock or an owner token verified on release, and test stale-lock takeover ownership.
This PR also changes MCP runtime caching, tool registration, cross-process locking, resource lifecycle, rollback, and Chroma errors beyond the RAG/Skill/Memory test scope described in the body. Please document or split those changes before merging.
变更概述
本次变更只关注 RAG、Skill 和 Memory 的工程契约,不评测 LLM 的回答质量、事实性或语义召回效果。
测试使用确定性的 Fake Embedding、内存向量库和 Mock Model,验证系统是否按照预定流程完成解析、索引、检索、上下文组装、Skill 加载和 Memory 存取。
RAG 变更
新增确定性契约测试
文档解析:
Chunk:
索引:
Retriever:
向量库:
Prompt 与证据:
RAG 代码修复
KBService.search(top_k=0)不再错误回退到默认 top_k。top_k<=0。_split_text()对非法 chunk_size 和 chunk_overlap 明确报错。Skill 变更
边界测试
Skill 代码修复
Memory 变更
边界测试
聚焦测试:
RAG 相关测试:35 passed
Skill/Memory 相关测试:47 passed
风险与范围