Skip to content

fix: heal interrupted indexes on sync and harden daemon lifecycle + WAL - #135

Merged
sunerpy merged 1 commit into
mainfrom
feat/upstream-1.4.1-release-a-robustness
Jul 14, 2026
Merged

sunerpy merged 1 commit into
mainfrom
feat/upstream-1.4.1-release-a-robustness

Conversation

@sunerpy

@sunerpy sunerpy commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Upstream-sync Release A — ports four golden-neutral robustness fixes from colby v1.2.0..v1.4.1 (all query/sync/daemon/pragma-side, no extraction-output change).

  • #1187 — an index interrupted mid-resolution (crash / Ctrl-C / watchdog kill) heals on the next codegraph sync instead of staying silently wrong. A resolution_incomplete marker in project_metadata is set when batched resolution begins, cleared on success; a bare sync (even no-change) sweeps parked unresolved refs and clears the marker; codegraph status reports partial while set. The sweep re-resolves already-persisted refs without re-extracting frameworks (byte-equal to index --force, no duplicate rows across heal cycles) and never deletes rows at rest — the #1240 incremental retry state is preserved.
  • #1200 — daemon inactivity backstop reaps only when no connected client pid is alive; a quiet-but-live editor session is no longer dropped.
  • #1185 — host pid plumbed through + startup-handshake timer (CODEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS, 0 disables) shuts a detached daemon down if it never gets a request; cold-start direct serve untouched.
  • #1231 (WAL half) — bulk index disables SQLite autocheckpoint + coalesced wal_checkpoint(TRUNCATE) valve gated on WAL size (CODEGRAPH_NO_WAL_DEFER, CODEGRAPH_WAL_VALVE_MB). Index output byte-identical. Parse-timeout worker-clock half is N/A for in-process rayon.

Verification

  • make ci green (fmt + clippy + test + guardrail + equivalence).
  • Golden .schema + all fixtures byte-identical, NO regen (query/sync/daemon/pragma-only).
  • New tests incl. a framework-project regression guard proving the heal-sweep does not grow unresolved_refs across repeated cycles, and a #1240 retry-preservation guard.
  • Independent oracle review: APPROVE after fixing the framework-re-extraction duplication blocker.

Upstream parity tracked separately in the local ledger; this is Release A of the chosen 1.2.0→1.4.1 PORT subset.

Ports four golden-neutral robustness fixes from upstream colby v1.2.0..v1.4.1;
all query/sync/daemon/pragma-side, no extraction-output change.

- #1187: an index interrupted mid-resolution (crash, Ctrl-C, watchdog kill)
  no longer stays silently wrong until a full re-index. A resolution_incomplete
  marker in project_metadata is set when batched resolution begins and cleared
  on success; a bare `codegraph sync` (even with no file change) sweeps the
  parked unresolved refs through the batched resolver and clears the marker,
  and `codegraph status` reports the index as partial while the marker is set.
  The sweep re-resolves the already-persisted refs without re-extracting
  frameworks, so it stays byte-equal to `index --force` with no duplicate rows
  across repeated heal cycles, and it never deletes rows at rest — the
  incremental retry state (an unchanged file's ref resolving after a later edit
  adds the symbol) is preserved.

- #1200: the daemon inactivity backstop now reaps only when no connected client
  pid is still alive, so a quiet-but-live editor session is no longer dropped to
  in-process mode.

- #1185: the launch site plumbs the host pid through, and a startup-handshake
  timer (CODEGRAPH_STARTUP_HANDSHAKE_TIMEOUT_MS, 0 disables) shuts a detached
  daemon down if it never receives a request — reaping a server whose launcher
  was killed during startup, without touching cold-start direct serve.

- #1231 (WAL half): bulk index disables SQLite autocheckpoint and folds the WAL
  back in a few large coalesced wal_checkpoint(TRUNCATE) passes gated on WAL size
  (CODEGRAPH_NO_WAL_DEFER opts out, CODEGRAPH_WAL_VALVE_MB tunes), cutting the
  checkpoint write-back thrash on slow storage. Index output is byte-identical;
  the parse-timeout worker-clock half is N/A for the in-process rayon build.

Golden .schema and all fixtures unchanged (no regen).
@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.03797% with 22 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/codegraph-daemon/src/lib.rs 90.00% 7 Missing ⚠️
crates/codegraph-mcp/src/engine.rs 22.22% 7 Missing ⚠️
crates/codegraph-store/src/queries.rs 88.63% 5 Missing ⚠️
crates/codegraph-cli/src/main.rs 89.65% 3 Missing ⚠️

❌ Your patch check has failed because the patch coverage (93.03%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #135      +/-   ##
==========================================
- Coverage   95.65%   95.63%   -0.02%     
==========================================
  Files         115      115              
  Lines       55790    56095     +305     
==========================================
+ Hits        53364    53649     +285     
- Misses       2426     2446      +20     
Files with missing lines Coverage Δ
crates/codegraph-daemon/src/session.rs 98.05% <100.00%> (+0.11%) ⬆️
crates/codegraph-resolve/src/resolver.rs 96.20% <100.00%> (+0.05%) ⬆️
crates/codegraph-watch/src/sync.rs 98.98% <100.00%> (+0.23%) ⬆️
crates/codegraph-cli/src/main.rs 89.20% <89.65%> (-0.02%) ⬇️
crates/codegraph-store/src/queries.rs 98.21% <88.63%> (-0.22%) ⬇️
crates/codegraph-daemon/src/lib.rs 91.72% <90.00%> (+0.12%) ⬆️
crates/codegraph-mcp/src/engine.rs 97.35% <22.22%> (-0.19%) ⬇️
🚀 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 fe3d899 into main Jul 14, 2026
7 checks passed
@sunerpy
sunerpy deleted the feat/upstream-1.4.1-release-a-robustness branch July 14, 2026 05:17
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