🐛 fix(core): matcher includeAll/excludeAny/excludeAll 字段在路由匹配中生效 - #55
Merged
Lands-1203 merged 1 commit intoSep 3, 2026
Conversation
schema(flow2spec.matcher.v1)早已定义并校验这三个字段,但 routing.match() 只消费 includeAny——写了排除词/组合词的词表形同虚设。 - 否决门:excludeAny 任一命中或 excludeAll 全部命中即整条规则否决, 恒胜于 task 精确命中(排除词表达"此请求不属于该域") - 资格门:includeAny 任一命中或 includeAll 全部命中即具备候选资格; 纯 includeAll(无 includeAny)的 matcher 也可表达 - 打分与置信级零变化:includeAll 短语并入命中池,得分仍取最高短语分, 存量 matcher 行为逐字不变(黄金样本回归覆盖) - 新增 scripts/test-routing-semantics.js(公共 API seam:临时 .Knowledge 夹具 + createFlow2Spec().routing.match()),挂入 npm test 链 - docs 中英文六处同步四字段语义 Fixes double-coding-lab#54 知识库核查:.Knowledge 各 topic 无"仅 includeAny 生效"类失真表述,无需 delta。
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #54
问题
matcher 分片 schema(
flow2spec.matcher.v1)定义并校验了includeAll/excludeAny/excludeAll,但routing.match()只消费includeAny——写了排除词/组合词的词表形同虚设(详见 #54 现象与根因)。修复内容
excludeAny任一命中(OR)或excludeAll全部命中(AND)→ 整条规则否决,且优先于 task 精确命中(排除词表达「此请求不属于该任务域」);includeAny任一命中 或includeAll全部命中 → 具备候选资格;纯includeAll(无includeAny)的词表首次可表达;includeAll短语并入既有命中池,得分仍取最高短语分,存量 matcher 行为逐字不变(黄金样本回归断言覆盖)。测试
scripts/test-routing-semantics.js:公共 API 契约 seam(createFlow2Spec().routing.match()+ 临时.Knowledge夹具),10 组用例——黄金样本回归 / 否决 / 否决恒胜 exact /excludeAllAND 与半命中 / 纯 AND 资格与不资格 / 打分池合并 / 被否决规则不进 candidates / 归一化大小写 / exact 保持 10000·high;npm test链,全量测试全绿(含本仓自举kb check),version:check绿。文档
docs 中英文六处同步四字段语义(体系与原理 / architecture、目录与路径约定 / directory-conventions、命令说明 / commands-reference)。
兼容性
公共 API 返回结构零变化、零新增运行时依赖、protocolVersion 不变;「路由命中明细(explain)」为后续独立提案,将在 Discussions 单独对齐。
(背景基准:对标 mem0 / OpenViking / TencentDB-Agent-Memory 的路由可观测与治理机制后选定的最小切口,详见 #54。)