Skip to content

【Bug】matcher 的 includeAll / excludeAny / excludeAll 字段已在 schema 定义,但 routing.match() 未消费 #54

Description

@chyuan-cuihongyuan

现象

matcher 分片 schema(flow2spec.matcher.v1)定义了四个字段,kb check 也会校验其结构,但路由匹配实际只消费 includeAny,另外三个字段静默失效:

  • 写了 excludeAny: ["预演"],请求里带「预演」照样命中该任务域(误路由);
  • 写了 includeAll: ["数据","迁移"],缺少 AND 语义,纯组合词词表无法表达;
  • 维护者面对误路由只有两个坏选项:删触发词(伤召回)或忍受。

根因

packages/core/lib/routing.jsmatch() 只读取 matcher 的 includeAny 字段;includeAll/excludeAny/excludeAll 仅存在于 schema 归一化与校验,检索侧无消费点。

修复方案(已在 fork 实现并通过全量测试)

  • 否决门excludeAny 任一命中或 excludeAll 全部命中 → 整条规则否决,且优先于 task 精确命中(排除词表达「此请求不属于该任务域」);
  • 资格门includeAny 任一命中 includeAll 全部命中 → 具备候选资格;纯 includeAll(无 includeAny)的 matcher 首次可表达;
  • 打分与置信级零变化includeAll 短语并入既有命中池,存量 matcher 行为逐字不变(黄金样本回归断言覆盖);
  • 新增公共 API 契约测试 scripts/test-routing-semantics.js(临时 .Knowledge 夹具 + createFlow2Spec().routing.match(),10 组用例)挂入 npm test 链;docs 中英文六处同步四字段语义;npm testversion:check 全绿。

PR 稍后开出(链接将补充在评论里)。另外还有一个「路由命中明细(explain)」的后续提案,方向确认后会在 Discussions 单独开帖对齐。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions