Skip to content

fix(sync): keep the files a full sync's own scan indexes - #286

Merged
sunerpy merged 1 commit into
mainfrom
fix/full-sync-scan-scope
Oct 1, 2026
Merged

sunerpy merged 1 commit into
mainfrom
fix/full-sync-scan-scope

Conversation

@sunerpy

@sunerpy sunerpy commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

codegraph sync deleted files that codegraph index had just indexed, so sync no longer equalled index --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, and status then reported them as pending additions.

Reproduced with the official v0.51.0 binary: init indexed .cache/a.ts and src/b.ts, sync printed 1 removed, and status reported .cache/a.ts as pending added.

Fix. A full sync reconciles against its own scan, so the scan now decides its scope: sync_paths_with_store takes 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

  • New CLI e2e test crates/codegraph-cli/tests/full_sync_scope.rs drives the real binary through init, files --json, sync, status --json and index --force. It fails on the pre-fix sync.rs (left: ["src/app.ts"]; exit 101) and passes with the fix.
  • The pre-push gate (make pre-ci) passed on 682f8c0: 3,904 tests, 0 failed; clippy, fmt, guardrail and archive smoke clean.

🤖 Generated with Claude Code

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

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@            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     
Files with missing lines Coverage Δ
crates/codegraph-watch/src/sync.rs 97.88% <100.00%> (+<0.01%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@sunerpy
sunerpy merged commit f23b0bd into main Oct 1, 2026
9 checks passed
@sunerpy
sunerpy deleted the fix/full-sync-scan-scope branch October 1, 2026 09:02
@github-actions github-actions Bot mentioned this pull request Oct 1, 2026
sunerpy added a commit that referenced this pull request Oct 1, 2026
Current alignment now says #286, #288 and #289 shipped in codegraph-rs v0.52.0, closing the v0.51.0 exceptions #770 and #1829/#1878; a new dated entry records the release run, digest and black-box acceptance.
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