Search index: a moved HEAD reloads from the saved index without waiting for build slots

Merged
AF
12h ago
+1700-159

After a restart or rebind, a checkout whose HEAD moved since its saved search index now updates that index from the git diff in the warm load lane, instead of queueing for a heavy build slot behind semantic builds. Diffs over 512 paths (renames count twice) still take a build slot and do a full refresh, so large branch switches stay under the shared build limit. Scoring and routing are unchanged; descriptor engine_unwired.


Summary by cubic

A restarted or rebound checkout whose HEAD moved now reloads from its saved search index in the warm load lane over a git diff, instead of queueing behind semantic builds.

  • Warm refreshes admit at most 512 unique paths from the union of git-diff changes and disk-stale, new, or removed files (renames count twice); larger changes fall back to the existing cold-build permit and full refresh, including same-HEAD disk edits.
  • Git diffs are read NUL-delimited and scoped with --relative, so quoted names (non-ASCII, tab, quotes, backslashes) count once, same-stat committed edits are still reread, and a search root inside a monorepo ignores changes outside it.
  • Admission is decided from metadata before any source reads; the stat snapshot is reused for verification and indexing, so admitted files are statted, read, hashed, and verified once, with reads on the bounded warm-worker pool and updates applied on the caller thread.
  • Cache loading canonicalizes the project root before deriving file keys, and cached keys keep the loading root's spelling, so symlink and Windows verbatim-path, casing, or 8.3 short-name aliases neither hide cached edits or removals nor falsely exhaust the budget.
  • Boundary, overflow, concurrent-read, and four-held-build tests use hang guards instead of CI throughput deadlines.
  • Same-size warm-reload fixtures now empty the git index and backdate mtimes so their edits commit deterministically on Windows CI.

Scoring and routing are unchanged; the benchmark descriptor stays engine_unwired.

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues remain.

Summary

Small search-index refreshes now use the warm-load lane when HEAD moves. Changes above the combined 512-path budget fall back to a full rebuild under a shared build permit.

  • Saved search indexes refresh changed files without waiting for a build slot.
  • Cached search files stay visible when a checkout uses a root alias.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Load saved search index] --> B{Compatible cache?}
  B -->|No| E[Wait for shared build permit]
  B -->|Yes| C[Collect Git changes and disk metadata]
  C --> D{At most 512 changed paths?}
  D -->|Yes| F[Verify and refresh in warm lane]
  D -->|No| E
  E --> G[Build full index]
  F --> H[Save and publish ready index]
  G --> H

Reviews (10) · Last reviewed commit: "mason: make same-size warm-reload fixtur..." · Reviewed by Greptile