Skip to content

perf(files): avoid interval file-index rebuilds#495

Closed
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-file-index-incremental
Closed

perf(files): avoid interval file-index rebuilds#495
JustYannicc wants to merge 1 commit into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-file-index-incremental

Conversation

@JustYannicc

Copy link
Copy Markdown
Collaborator

Summary

  • Make interval refresh use the existing watcher/incremental path when the index is already built and the watcher is healthy.
  • Keep full rebuilds for startup, watcher-error recovery, watcher-unavailable interval fallback, and a 6-hour safety rebuild window.
  • Add a focused temp-directory regression/measurement test covering create, update, delete, nested directory indexing, healthy interval ticks, and fallback rebuilds.

Metrics

Baseline before production edit:

  • Command: SUPERCMD_FILE_INDEX_BASELINE=1 node --test scripts/test-file-search-index.mjs
  • Fixture: 1,043 indexed entries under a temp home directory
  • Healthy interval ticks: 3 full rebuilds, 88.38 ms total
  • Watcher-style batches: 0 full rebuilds
  • Fallback interval with watcher unavailable: 1 full rebuild, 28.15 ms

After this change:

  • Command: node --test scripts/test-file-search-index.mjs
  • Fixture: 1,043 indexed entries under a temp home directory
  • Healthy interval ticks: 0 full rebuilds, 0.06 ms total
  • Watcher-style batches: 0 full rebuilds
  • Watcher-error recovery: 1 full rebuild, 32.57 ms
  • Fallback interval with watcher unavailable: 1 full rebuild, 36.14 ms

Validation

  • node --test scripts/test-file-search-index.mjs
  • node --test 'scripts/test-*.mjs' (25 pass, 1 skipped live Electron test)
  • pnpm run build:main
  • pnpm run build:renderer
  • pnpm run check:i18n (completed; existing Italian locale warnings remain: settings.ai.whisper.vocabulary, settings.extensions.appSearchScope)
  • Codex LSP diagnostics for src/main/file-search-index.ts and scripts/test-file-search-index.mjs: no errors

Risk

If the platform watcher misses an event while still reporting healthy, the index can remain stale until a later watcher event or the 6-hour safety rebuild. Watcher errors and unavailable watcher state still force full rebuild recovery.

@JustYannicc JustYannicc changed the title [codex] Avoid interval file-index rebuilds perf(files): avoid interval file-index rebuilds Jul 3, 2026
@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated upstream PR #535: #535

@JustYannicc JustYannicc closed this Jul 3, 2026
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