Skip to content

core: 结构重排下的增量 Search 保持文档序 (#27/#164) - #175

Merged
JavaZeroo merged 2 commits into
mainfrom
feat/search-reorder-r169
Oct 29, 2026
Merged

JavaZeroo merged 2 commits into
mainfrom
feat/search-reorder-r169

Conversation

@JavaZeroo

Copy link
Copy Markdown
Owner

背景

#169 封存了行存储并给出精确 rank,但它明确把运行中跨结构重排的增量 Search 留作后续("开放新无序行为前需另行完整验收")。本片补上这一层:Search 不再用行 ID 做失效与游标判断。

变更

  • TextSearch 记录 document_order_revision_;notify_change 检到 order revision 变化即置位 order_changed_;
  • step 在原有 row 校验前先做一次 repair_order()(计一个 work 单位):找到第一个不再位于自身 rank 的已扫行,只从该处重扫,之前的命中保留;已加载行移动/消失时单独重载;
  • rewind / consume / prune / match 的判定从行 ID 改为当前文档 rank与"端点是否仍存活";有序文档路径与结果顺序不变。

测试

新增 search_reorder_core(4 个场景):

  1. 扫描中重排 → 6 个命中、按 rank 递增、无重复、match() 全存活;
  2. 重排后 next/previous 按新文档序移动;
  3. 连续换行淘汰最旧行 → 命中只随死行消失;
  4. 有序文档的完成状态与命中行不变。

本机隔离 worktree:默认 Release 构建 exit 0;search_core + search_reorder_core + 7 个核心 CTest + Python core 回归 10/10 通过(core 首跑失败仅因隔离构建缺 replay/receive 辅助二进制,补齐后通过)。

证据:README · validation.json

明确未做

Refs #27 #164 #169

 #164

TextSearch now tracks the document order revision and repairs its scanned prefix by rank: rewind, match and prune compare document positions instead of row ids, so a reorder neither duplicates nor drops hits. Adds search_reorder_core covering mid-scan reorder, navigation, eviction and the ordered regression.
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-29T09:53:40.869791Z 3ad2c95 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

The first revision repaired every document by rank, so continuous output re-scanned the prefix on each newline and the shell Find stream timed out at stage 4. Rank repair now applies only to unordered documents; ordered documents keep the original identity threshold. Local shell suite passes.
@JavaZeroo

Copy link
Copy Markdown
Owner Author

补充说明:本次 push 运行的 regression (windows-2025) 红项是 shell 用例 test_local_shell_launch_working_directory_and_cleanup(workspace shells scenario timeout at stage 5,91s)。同一 commit 的 PR 运行全绿,本机同一 shell 套件(含该用例)也通过;改动只涉及 TextSearch 的失效阈值(Find),不触及 shell 启动/工作目录/清理路径。已按仓库惯例把该红项记录到 #38,不重跑取绿、不用 PR 绿覆盖,也不据此推断因果。

@JavaZeroo
JavaZeroo merged commit 02c42e9 into main Oct 29, 2026
9 of 10 checks passed
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