Skip to content

fix(store): correct hybrid FTS time/scope bindings - #87

Merged
wefio merged 1 commit into
mainfrom
fix/hybrid-fts-bindings
Oct 10, 2026
Merged

wefio merged 1 commit into
mainfrom
fix/hybrid-fts-bindings

Conversation

@wefio

@wefio wefio commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

变更描述

What:修复 hybrid 检索在 FTS 命中时的 SQL 位置参数错位,补齐真实命中与时间/多键 scope 的组合回归。

Why:ORDER BY 的重复 FTS ID 原先在 WHERE 的日期与 scope 参数之前绑定,导致合法结果丢失,受控日期窗口还可能错误放行记录。没有用空结果相等代替正确性验证,也没有估计生产缺陷发生率。

Changes:

  • retrieval.ts 只移动 ORDER BY ID 参数列表,不改 SQL 条件、候选上限、权重、精度或 API。
  • 新增九个绑定契约;scoring parity 改为正向 FTS 命中。既有 retrieval/scoring + 新回归 57/57。
  • 更新 owning design,关闭 TODO item 8,新增中英文决策和原始测量证据。
  • 在同一修复后的 SQL 上比较完整 searchContext 路径的 decoded/borrowed scoring:300 条 synthetic memory、1024D、三个交替进程对、每种实现 192 次计时。总体中位数 10.3724 → 7.1587 ms(降低 31.0%),正向 FTS 10.8198 → 7.9370 ms(降低 26.6%);所有配对结果、完整分数、QPP/selection 与非计时 AG usage 精确一致,storage fingerprint 不变。详见 experiment。

未验证项

Not verified:
真实 LoCoMo/Qwen 缓存嵌入、用户报告的约 40% 增益、production incidence、hierarchical semantic node/leaf routing、真实 chain 数据、trace 写入开销、RPC/harness/network、cloud/Sites/WASM/VFS、部署与恢复行为。没有调用 live provider 或 official benchmark。三个工作站进程对不是普遍或最坏情况速度保证。local advisory research/chaos 未运行,CI 的实际状态另由 forge 观察。

完成检查项

本地质量检查

  • verify:static 的全部原子检查通过(经相同 blocking membership 的 scoped agent:verify)。
  • 全量 test:product 1687/1687 通过,0 failures/cancelled/skipped/todo(scoped agent:verify 的完整 product suite,不是 impact subset)。
  • 未改依赖或 lockfile;check:lock 通过,npm audit --omit=dev --audit-level=high 为零漏洞。
  • 未改子包;verify:packages frozen-install/build 通过。
  • 文档检查通过,附 bilingual decision。
  • 未验证项已如实填写。
  • Complexity gate 通过,3 个代码文件 LSP 0 diagnostics。
  • 未提交可再生产物,仅 9 个 owned paths。
  • Full mutation:22/22 targets,110/110 caught,22/22 byte-identical restoration,无遗留 lock。

RCP(Repository Control Plane)

  • 首个写入前已登记 repo-development in-flight entry 1791618473528_000495,现已 resolve。
  • scoped npm run agent:verify -- <九个路径> 的 16 个 blocking checks 全通过:precommit receipt d523f2f5-88ba-4c2d-90d4-5a57801ea2dd;exact-head --require-clean receipt 0b8bc332-7156-4ac3-bfa6-d85520b327b2,head 1c56d47509197c663e1d31adca88cf1ef4c7ccae,dirty paths 0,timeout 150000ms,outer exit 0 / 72.788s。
  • node bin/nmg-rcp.mjs forge-status --pr 87 --json 已观察 required checks SUCCESS(run 38040192830)。Windows chaos 在该 run 为 SKIPPED,不计作执行通过。
  • 只提交本 PR 拥有文件,原 checkout 的 unrelated lockfile 改动未触碰。

CI 完成确认

  • forge 的 All checks passed SUCCESS。
  • CodeFactor SUCCESS。
  • Static job SUCCESS(含 dependency audit)。

PR remains OPEN/draft for review; merge/deployment not claimed. Push 提示默认分支已有一项 moderate Dependabot advisory;这与 local production audit 零漏洞是不同范围的观察。

Verification exit attribution

首次提交后同步调用的内层 receipt 96bd1922-dec1-4bdb-b30b-a33dc813c386 为 clean head 1c56d475、150000ms、16/16 passed、70.084s;但外层 tool 报 TIMED OUT(320.621s),不计作成功的 whole-shell exit。日志/receipt 保留。相同命令通过 windowsHide、file-backed stdio 的独立运行器重跑,outer exit 0 / 72.788s,receipt 0b8bc332-7156-4ac3-bfa6-d85520b327b2,16/16 blocking checks、1687/1687 product tests 通过;没有改变 gates 或 deadline。临时运行器已删除。这不能诊断首次外层超时的根因。

Move repeated ORDER BY IDs after all WHERE parameters without changing SQL
predicates, candidate bounds, ranking weights or vector precision. Add positive
FTS/time/multi-key-scope regressions and strengthen scoring parity to cover hits.

Close the tracked TODO, document the binding contract and record a bounded
context-level decoded/borrowed comparison only after correctness is restored.
@wefio
wefio marked this pull request as ready for review October 10, 2026 09:18
@wefio
wefio merged commit ffda5fd into main Oct 10, 2026
7 checks passed
@wefio
wefio deleted the fix/hybrid-fts-bindings branch October 10, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant