Repository navigation
fix(sync): keep the files a full sync's own scan indexes - #286
Merged
Merged
Conversation
A full sync reconciled the scanned candidates through the watcher's scope policy, which deliberately prunes directories the scan indexes: the watch-only defaults such as `.cache` and `vcpkg_installed`, and every top-level `.codegraph-*` directory. So `sync` deleted files `index` had just indexed, `status` then reported them as pending additions, and `sync` no longer equalled `index --force`. The scan now decides a full sync's scope; incremental syncs keep judging the paths they are handed with the policy.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #286 +/- ##
==========================================
- Coverage 95.29% 95.29% -0.01%
==========================================
Files 158 158
Lines 97623 97628 +5
==========================================
+ Hits 93031 93033 +2
- Misses 4592 4595 +3
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
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 syncdeleted files thatcodegraph indexhad just indexed, sosyncno longer equalledindex --force.A full sync ran the scan and then judged each scanned candidate with the watcher's
WatchPolicy. That policy is deliberately stricter than the scan: it adds the watch-only structural ignores (.cache,.cxx,vcpkg_installed,.bloop,.metals,lua_modules,.luarocks,__history,__recovery), and it rejects every top-level.codegraph-*directory. The scan indexes all of those, so the full sync force-removed them, andstatusthen reported them as pending additions.Reproduced with the official v0.51.0 binary:
initindexed.cache/a.tsandsrc/b.ts,syncprinted1 removed, andstatusreported.cache/a.tsas pending added.Fix. A full sync reconciles against its own scan, so the scan now decides its scope:
sync_paths_with_storetakes the scanned set. Incremental watcher syncs keep judging the paths they are handed with the policy. The watcher never reports a path below a directory it does not watch.Verification
crates/codegraph-cli/tests/full_sync_scope.rsdrives the real binary throughinit,files --json,sync,status --jsonandindex --force. It fails on the pre-fixsync.rs(left:["src/app.ts"]; exit 101) and passes with the fix.make pre-ci) passed on682f8c0: 3,904 tests, 0 failed; clippy, fmt, guardrail and archive smoke clean.🤖 Generated with Claude Code