Skip to content

fix(cli): reject sync for stale extraction indexes - #1842

Open
bompus wants to merge 2 commits into
colbymchenry:mainfrom
bompus:fix/upstream-cli-stale-sync
Open

bompus wants to merge 2 commits into
colbymchenry:mainfrom
bompus:fix/upstream-cli-stale-sync

Conversation

@bompus

@bompus bompus commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

An index built with an older extraction version can make codegraph sync print “Already up to date” and exit 0 even though status recommends a rebuild. With source edits, sync updates only those files and still leaves the index stale.

The CLI now checks the existing extraction-staleness signal before incremental work, closes the graph, and exits 1 with a codegraph index recovery instruction. --quiet also exits 1 and prints the reason as a single stderr line, so a git hook that fails on a non-zero exit still shows the user why. Current indexes continue syncing normally; a full index restores successful sync. The guard is confined to the explicit CLI command, preserving library and watcher incremental behavior.

Related to #1798: this addresses the misleading CLI success signal, not the proposed automatic background rebuild. It complements #1256's status/upgrade guidance changes.

Validation on Node 24.21.0, Linux/WSL2, based on upstream 3ed73bc:

  • TypeScript compilation and asset copying passed.
  • Nine focused CLI tests passed: seven new cases plus two existing explicit-index-path tests.
  • New coverage includes old and missing extraction stamps, unchanged and added files, normal and quiet modes, current indexes, and recovery after a full rebuild.

The equivalent fork integration also passed full native (4,742) and WASM (4,740) suites and five deployment probes. Those full-suite results are from the consolidated fork; the focused tests above were rerun on this upstream-only branch. Windows and the viewer build were not rerun for this change.

A quiet sync is the git-hook path. The stale-index refusal still exits 1,
but now writes one line to stderr so a hook that fails the commit on a
non-zero exit does not block it for an invisible reason. (colbymchenry#1798)
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