Conversation
FTS5 store under <data>/index/index.db with fixed file-count and byte budgets, quarantine-and-recreate self-healing, and lifecycle RPCs (index.status / index.rebuild / index.clear) that report metadata only. A single indexGrepBoost switch (default off) owns the whole lifecycle: turned on, it indexes newly opened workspaces in the background so the Index page under the Workspace settings group can report status; the build's join handle is registered on the app state so tests await the build instead of polling a wall clock. Opening the store never blocks host startup - a failed open degrades to a disabled store. Grep is untouched: tools execute exactly as before whether or not an index exists. How the index may ever accelerate a search is a separate, independently reviewed change.
|
为方便 review,补一份实测数据和一份diff 导航。数据全部来自本 PR 的交付二进制( 实测(真实工作区,stdio RPC 直驱)
两点如实说明:
diff 导航(44 文件)核心逻辑集中在两个新文件,其余多为薄接线:
测试 ↔ 不变量
对照 #502 裁决清单:FTS5 store ✓ / 三个 lifecycle RPC ✓ / Workspace 组 Index 页 ✓ / 单开关默认关 ✓ / 不接 Grep( 更新 1 — 与最新 更新 2 — 多轮稳定性与查询测试(同一真实工作区,隔离 data dir,合并后二进制
|
# Conflicts: # apps/desktop/src/styles/settings.css # docs/spec/06-delivery/04-e2e-test-plan.md # package.json
# Conflicts: # packages/shared/src/errors.ts
PR 1 of the split agreed in #502 — Index infrastructure only, nothing else. Based on the latest
main, one clean branch.What's in
<data>/index/index.db(trigram tokenizer, fixed budgets: 50k files / 1MB per file / 2GB total), deliberately separate frompi.sqlite; integrity or schema failure quarantines the old file and recreates an empty storeindex.status/index.rebuild/index.clear, workspace-root-scoped (INDEX_ROOT_OUTSIDE_WORKSPACEotherwise), metadata only — never file contents; rebuild/clear write an audit entryindexGrepBoost, default off. Turned on, it indexes newly opened workspaces in the background (workspace.setstays fast; the health card polls while building). Turning it on arms the current workspace immediatelyWhat's deliberately out (per the split in #502)
tools/mod.rshas zero changes; tools execute exactly as before whether or not an index exists. The fast path + freshness changes are PR 2, to be reviewed on "does it ever change Grep's answer".workspace-watchwatcher, nomark_stalewiring, no stats surface. The three stats leftovers named in feat(settings): fold the workspace index into the Workspace group #502 (stats.rs,stats-real-rpc-reconcile.mjs,idx_turns_started) are not present — this branch never carried them.The two blockers named in #502
main(SettingsPage.tsx,06-settings-ia.md): resolved by starting from the currentmaininstead of stacking.workspace_set_auto_indexes…wall-clock polling: the background build's join handle is now registered on the app state (index_builds), and the test awaits that handle directly, then asserts the settled status. No wall-clock polling. (For what it's worth: the polling version was also hiding a real platform race — watcher events landing mid-build flip the root tostale, which the test then never sees becomefresh. That race belongs to PR 2's surface; PR 1 has no watcher at all.)Verification
cargo test -p host-core --locked: 549 passed / 0 failed (incl. new RPC tests: switch defaults + type validation, auto-index gated on the switch via the awaited handle, rebuild/clear audit, store self-healing, budget, multi-root scoping)cargo fmt --checkclean;cargo clippy -p host-core -- -D warningsclean for every file this PR touchespnpm docs:check: 487 pages en/zh paired; architecture budget passedpnpm test:e2e:index→PASS E2E-INDEX-status-rebuild-clearE2E-INDEX-settings-health-carddocumented as pending UI automationReal-workspace measurement (details in the comments)
Driven the shipped binary (
cc726590) over stdio RPC against a real checkout of this repository (64k files incl.node_modules; isolatedPI_DESKTOP_DATA_DIR):workspace.setwith the switch off: 0.6 ms, zero index rows — no cost while offfreshin 3.0 s — 1,644 source text files / 19.2 MB, 0 errors (node_modules,target/, build outputs correctly excluded)index.rebuild: 5.7 s; steady-stateindex.statuslatency 0.5–0.7 msindex.db: 115.5 MB (~6× content: FTS5 trigram postings + stored bodies; within the 2 GB budget — a contentless-FTS follow-up can shrink this substantially)Note on pre-existing main breakage (not from this PR)
Typecheck and clippy each currently fail on untouched files from today's
main, reproducible on pristineupstream/main(7a59a25) with the same commands:pnpm --filter @pi-desktop/desktop typecheck→electron/main/user-login-path.ts(28,74): TS2345(from 574c78a; the JS job on the fix(desktop): classify crash dumps and keep them in the data directory #689 merge commit already shows failure)cargo clippy -p host-core -- -D warnings→user_skills.rs(921): useless_formatI left both alone to keep this PR single-purpose — happy to send a one-line fix separately if useful.
Closes nothing; part of the #502 split (PR 2: Grep fast path + freshness, PR 3: stats RPCs).