feat(incremental): incremental re-scan + scan --update/--watch (6.1, D1/G2)#59
Merged
officialCodeWork merged 1 commit intoJul 16, 2026
Conversation
…ch (6.1, D1/G2) Re-scan only what changed, with a graph provably identical to a full re-scan. - Split scanReact into createScanProject (build/load the ts-morph project) and scanProject (the full analysis). - New IncrementalScanner keeps one project alive; update() refreshes only files whose bytes changed (refreshFromFileSystemSync), adds new / drops deleted files, then re-runs scanProject. Correctness by construction: every node and cross-file edge is re-derived from current ASTs, so an update's graph is byte-identical to a fresh scan — the changed file's dependents are recomputed for free. The win is parsing: unchanged files keep cached ASTs. - Property test: an interconnected app stays byte-identical to a full re-scan across 20 randomized single-file edits, plus add/delete with exact `changed`. - GraphMeta.fileHashes (path -> sha256; schema regenerated) records provenance; projectFileHashes computes it. - CLI: `scan --update` short-circuits when nothing changed (else reports the changed set and full-rescans); `scan --watch` re-emits on debounced changes. Also strips a stray NUL byte that shipped in the 6.3 edgeSortKey join separator (now the intended space) — functionally inert but flagged the file as binary. eval 317/0/0/0, determinism 1.000; parser-react 151 tests, typecheck + lint clean. Gate 6 passes; M6 reached. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Phase 6.1 — Incremental re-scan (failure modes D1, G2) · completes Phase 6 / Gate 6
Re-scan only what changed, with a graph provably byte-identical to a full re-scan.
Design
scanReactsplit intocreateScanProject(build + load the ts-morph project) andscanProject(the full analysis).IncrementalScannerkeeps one project alive.update()callsrefreshFromFileSystemSyncon each source file — ts-morph re-parses only files whose bytes changed — picks up added files, drops deleted ones, then re-runsscanProject.Provenance & CLI
GraphMeta.fileHashes(relative path → sha256; schema regenerated, drift gate green);projectFileHashescomputes it.scan --update: short-circuits when every file hashes identically to the prior graph (else reports the changed set and full-rescans — correct, ~2 s at scale).scan --watch: re-emits the graph on each debounced file change (ignores the output file,node_modules,.coderadar).Tests
changedreporting.--updateno-change/changed,--watchlive edit).Also
Strips a stray NUL byte that shipped in the 6.3
edgeSortKeyjoin separator (now the intended space) — functionally inert (both are valid separators) but it flagged the file as binary in git.Verification
pnpm eval→ 317 pass · determinism 1.000Gate 6 passes (6.1 incremental · 6.2 scale · 6.3 determinism · 6.4 version-skew · 6.5 generated/PII). M6 reached — production-grade: incremental, fast, deterministic, versioned. Tracker + milestone table updated.
🤖 Generated with Claude Code