Repository navigation
fix(status): recommend a re-index when package.json alone adds or drops a framework - #3072
Merged
Merged
Conversation
…ps a framework Since PR #2941, a sync records the frameworks that came or went since the last full index, and `codegraph status` recommends a re-index. But a sync detects frameworks again only when it extracts a file, so adding `express` or `@sveltejs/kit` to package.json with no source file edited recorded nothing: status said the index was up to date while an unchanged Express app's routes, or the `goto('/login')` in an unchanged +layout.svelte, stayed unlinked until a full index. A full index now also stamps the resolver's framework set, and getFrameworkChangesSinceIndex() adds the difference between that stamp and the set the resolver detects now (it detects on every open) to what syncs recorded. So a fresh `codegraph status` sees a manifest-only change whether or not a sync ran. An index built before this has no stamp, so that half starts at its next full index. A long-running server's resolver keeps its old set until it extracts a file, as before. Validation on main 6177692 (Windows 11): - Red/green: 3 of the 4 new tests fail with main's src/index.ts; the 4th, an unchanged project staying silent, passes on both. All 4 pass with the fix, as do the 8 sync-framework-detection tests. - The CLI before and after, on a SvelteKit fixture indexed without @sveltejs/kit, then given it in package.json, then synced: main's status says "Index is up to date", and --json has reindexRecommended false and frameworksChangedSinceIndex null. With the fix, status adds "Frameworks changed since the last full index (added sveltekit-router)", and --json has true and {added: [sveltekit-router]}. Dropping the dependency gives {removed: [sveltekit-router]}, adding express to an Express app gives {added: [express]}, an unchanged project gives null on both arms, and a full `codegraph index` clears the advice. - No false advice: a fresh index and then `status --json` on 18 real repos reports no change on any. They include express, flask, gin, vuejs/core, excalidraw, vuejs/docs, starlight, codegraph's own source and vscode's base and editor; Express, Flask, Next.js, React, Vue, Vue Router, Astro, Svelte, Spring, Go and UIKit are detected among them. Original PR #3005 by @inth3shadows. Fixes #3007 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
codegraph statusnow recommends a re-index when a framework comes or goes throughpackage.jsonalone, with no source file changed. Before, addingexpressor@sveltejs/kittopackage.jsonand runningcodegraph syncleft status saying the index was up to date. Meanwhile an unchanged Express app's routes, or thegoto('/login')in an unchanged+layout.svelte, stayed unlinked until a fullcodegraph index.Lands #3005 by @inth3shadows.
Root cause
Since #2941 (#2516, unreleased), a sync records the frameworks that came or went since the last full index. But a sync detects again only when it extracts a file, so a manifest-only change recorded nothing.
The fix (from @inth3shadows, verbatim)
A full index also stamps the resolver's framework set (
resolver_frameworks_at_index).getFrameworkChangesSinceIndex()now adds the difference between that stamp and the set the resolver detects now to what syncs recorded. The resolver already detects on every open, so this costs status nothing. A freshcodegraph statustherefore sees a manifest-only change whether or not a sync ran.Known limits, from the PR:
codegraph_statustool doesn't show this hint at all. The hint is the CLI's.What triggers the new advice
The frameworks the resolver detects when the project is opened, measured against the set it had at the end of the last full index: a framework dependency added to or dropped from a
package.json(or another manifest detection reads), or files that change detection. A fullcodegraph indexre-stamps and clears it.Status output, before and after
SvelteKit fixture: indexed without
@sveltejs/kit, then@sveltejs/kitadded topackage.json, thencodegraph sync, thencodegraph status.main 6177692:
--json:"reindexRecommended": false, "frameworksChangedSinceIndex": nullThis PR:
--json:"reindexRecommended": true, "frameworksChangedSinceIndex": {"added":["sveltekit-router"],"removed":[]}sync)@sveltejs/kitadded{added: [sveltekit-router]}@sveltejs/kitremoved{removed: [sveltekit-router]}expressadded, Express app unchanged{added: [express]}codegraph indexNo false advice
A fresh index followed by
status --jsonin a new process, on 18 real repos, reports no change on any. The repos: express, flask, gin, vuejs/core, excalidraw, vuejs/docs, NekoBox, starlight, the genkit docsite, wm-project-astro-components, codegraph's own source, justgage, element-plus-playground, diploi.com, devfest-website, a portfolio, nodejsdesignpatterns.com, and vscode's base+editor. Express, Flask, Next.js, React, Vue, Vue Router, Astro, Svelte, Spring, Go and UIKit were detected among them.What we changed
The CHANGELOG only. The PR folds its note into the unreleased #2516 bullet, which is right for an unreleased feature; we added the credit and the issue number.
Validation (Windows 11, main 6177692)
src/index.ts. The 4th, an unchanged project staying silent, passes on both. All 4 pass with the fix, as do the 8sync-framework-detectiontests.CODEGRAPH_KERNEL_EXPECT=1 npx vitest run --maxWorkers=4 --minWorkers=1, with CODEGRAPH_NO_DAEMON unset: Test Files 810 passed | 6 skipped (816); Tests 9611 passed | 86 skipped (9697); 0 failed.Fixes #3007
Lands #3005 by @inth3shadows
🤖 Generated with Claude Code