Skip to content

fix(cli): require full rebuild for stale extraction indexes - #1256

Closed
Adam0120 wants to merge 1 commit into
colbymchenry:mainfrom
Adam0120:fix/stale-extraction-reindex-guidance
Closed

Adam0120 wants to merge 1 commit into
colbymchenry:mainfrom
Adam0120:fix/stale-extraction-reindex-guidance

Conversation

@Adam0120

Copy link
Copy Markdown

Summary

  • require a full codegraph index rebuild when an index predates the current extraction version
  • stop suggesting incremental codegraph sync for extraction-version staleness
  • avoid the unnecessary -f safety override in the post-upgrade advisory
  • cover both the upgrade advisory and the built CLI status output

Reproduction and root cause

A full index stamps indexed_with_extraction_version, while sync deliberately does not advance that stamp because it only revisits changed files. When extraction behavior improves, unchanged files built by an older engine can therefore remain incomplete after sync.

Both codegraph status and the post-upgrade advisory previously offered codegraph sync as a recovery command, which could leave the index stale while implying the extraction improvements had been applied.

Behavior boundary

This only changes public guidance. It does not automatically rebuild indexes during upgrade and does not change sync or indexing behavior.

codegraph index already recreates the database and performs the required full rebuild. Its -f flag only bypasses unsafe-root protection, so the general advisory should not recommend it.

Verification

  • npm run build
  • npx vitest run __tests__/upgrade.test.ts --reporter=dot --pool=threads --fileParallelism=false (50 passed)
  • focused red/green test for status requires a full rebuild when the extraction version is stale
  • focused red/green test for reindexAdvisory requires a full rebuild for extraction improvements
  • git diff --check
  • GoLand inspections on all four changed files: no errors

On this Windows environment, the complete status-json.test.ts file has a pre-existing process-exit hang that reproduced before the change; the new CLI regression test passes independently after build.

colbymchenry added a commit that referenced this pull request Oct 31, 2026
…ph index (#3123)

`codegraph status` and the post-upgrade reminder both offered `codegraph
sync` for an index an older engine built. Sync re-reads changed files only
and never advances the extraction stamp, so it can't deliver what they
promised. The reminder also offered `codegraph index -f`, but `index` is
always a full rebuild and `-f` only allows a home or root folder.

Both now name `codegraph index` alone.

Validation: a new status case and the reworked reminder case fail on main
and pass here (upgrade + status-during-rebuild: 99 of 99).

Reimplements PR #1256 by @Adam0120.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@colbymchenry

Copy link
Copy Markdown
Owner

Thanks @Adam0120! Your diagnosis was right: codegraph sync can't pick up a new engine's extraction, and -f only allows a home or root folder, so the advice was wrong on both counts. We reimplemented the text fix in #3123, with credit in the changelog, as part of settling what happens after an upgrade, so I'm closing this one. Thank you for finding it.

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.

2 participants