feat: per-file changed_files delta on codekb-scope-diff STALE verdict - #1125
SaRedfiche wants to merge 1 commit into
Conversation
197bc20 to
2930bab
Compare
2897add to
efe73c0
Compare
efe73c0 to
d8b2af2
Compare
|
Review-ready — rebased onto current This PR is now MERGEABLE (was CONFLICTING). Rebased onto the latest What the change does: adds the warm CodeKB delta-rescan path — on a re-scan it compares the stored scope fingerprint against the current working tree and only re-ingests changed files, rather than a full cold rescan, using the existing Rebase resolution (5 conflicts, all lockstep/generated — no behavioral change):
Verification (deterministic subset, all green):
Note: the full suite has pre-existing failures on pristine CI lanes and the fork review workflows still need the maintainer's "approve and run workflows" click to dispatch ( |
3d596a2 to
38a96ef
Compare
STALE status now carries changed_files - the analyzed-scope files that changed between the store's recorded fingerprint and the current tree, computed as a git diff between the two tree objects. A warm re-scan can re-derive only what moved instead of re-scanning the whole tree; changed_files: null means the delta was not computable and the full scope should rescan. Read-only; existing verdicts unchanged. Foundational piece of warm re-scan (awslabs#1122).
38a96ef to
25aa2aa
Compare
Why
Foundational piece of warm re-scan (#1122). Today
codekb-scope-diff's freshness verdict is whole-scopeCURRENT/STALE— a single changed file flips the entire analyzed scope toSTALEwith no way to see what moved, so an iteration has to re-scan the whole tree. This adds the per-file delta an iteration needs to re-derive only what changed.What changed
codekbScopeChangedFiles(repoDir, storedFingerprint, currentFingerprint)incore/tools/aidlc-lib.ts. Both fingerprints are git tree objects (the existing temp-indexwrite-tree), so the delta is agit diff --name-only -zbetween them. Returns[]when the two trees match, the changed-file list otherwise, andnullwhen either token is absent/not a well-formed tree hash or git cannot diff them (caller falls back to a full rescan — never a silent empty delta).handleCodekbScopeDiffstatus mode surfaceschanged_fileson theSTALEverdict only (JSON + human). The caller threads thecurrentFingerprintit already computed for the CURRENT/STALE decision into the helper — no secondwrite-tree, and no window where a file reverts between two snapshots and yieldsSTALEwith an empty delta.JSON.stringify, so a repository filename containing ANSI/OSC control bytes cannot inject a terminal control sequence.2.7.0→2.7.1(aidlc-version.ts+ CHANGELOG + README badge);dist/regenerated across all 7 harnesses.Read-only and additive: the CURRENT/STALE/UNVERIFIED/UNKNOWN_SCOPE verdicts are unchanged; only the STALE payload gains the
changed_filesfield.How verified
bun scripts/package.ts --check(dist drift),bun run typecheck,bun run lint— all green.tests/unit/t248-codekb-scope-diff.test.tsextended and green: the delta contents, the empty-vs-null distinction, verbatim filenames, terminal-control-byte escaping, and the git-failurenullfail-safe (a well-formed-but-absent stored tree hash — the cross-clone / rebased / gc'd-store case) at both helper and verb level.tests/unit/t68-version-changelog-sync.test.tsgreen (version/CHANGELOG/README lockstep);scripts/ci-changelog-guard.tsgreen (2.7.0 entry preserved).null-fail-safe coverage gap fixed. Recorded indocs/scan-log.md.Upgrade notes
None for consumers of existing verdicts. A consumer that parses the STALE object gains an optional
changed_filesfield (array, ornullwhen the delta was not computable).By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.