Repository navigation
Read only new commits on a re-map, keep clone fingerprints out of the graph, and gate the #88 ratios - #140
Merged
Conversation
… graph, and gate the #88 ratios The history step lists the window's commits and reads from git only those it has not seen before: a commit never changes, so its parsed changes are kept by sha (without the author hash). The quality adapter's fingerprints serve its link and stay in the per-file cache; the graph keeps the clones they find. Adapter file globs are compiled once per map. scripts/bench.mjs and scripts/bench-map.mjs report the three ratios of #88 with their bounds and fail with --gate when one is over; bench-map also times a re-map after one file is edited. Refs #88 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Refs #88 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A boundary commit lists every file as added; after a deepen the same sha has a parent and a different diff. Boundary commits are no longer stored, and COMMITS_VERSION 2 discards caches that hold them. Tests cover a clone mapped shallow, deepened and mapped again against a full read, with history on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 24, 2026
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.
Design
Profile. One-file edit on nopCommerce (pinned, 6,741 files, 24,609 adapter-file pairs), committed, then re-mapped with
--cpu-prof, onmainafter #139: 4.2 s wall against 1.7 s for a no-change re-map (2.5 times). Phases: census 1.2 s (the floor every map pays: oneopenper file for its first bytes, 0.63 s), extraction 0.66 s (reading every cached fact, 0.15 s of itJSON.parse; 0.2 s matching each adapter's globs against every path), link 0.79 s (generic 0.33, quality 0.16, scip 0.05, the rest small), history 0.41 s (git log --numstatover the whole window again because the commit changed), projection 0.56 s (hashing every fact, 0.21 s infactId), derived 0.39 s (Graph.fromStore0.31 s). No step dominates; each is proportional to the repository.Cause. After a change every step past the census runs over the whole repository. Two of them do work that cannot have changed: history re-reads the numstat of every commit in the window although only the new commit is new, and the graph carries the
qualityadapter's clone fingerprints (11 MB of fact attrs and 12.6 MB of node attrs on nopCommerce) that only its link reads, so projection hashes them, the store writes them andGraph.fromStoreparses them on every map.Chosen change.
git log --no-merges --format=%Hand the same--since/-narguments as before, so the commit set and order are exactly those of a full read, then reads--numstatfor unseen shas with--no-walk=unsorted --stdin. Commits are immutable, so their parsed changes are kept by sha in one CAS blob (history:commits, without the author hash, pruned to the window, replaced and the old blob dropped).history.commits_readin the summary says how many were read.qualitydeletes the fingerprints from the facts after its link has used them. The per-file cache keeps them, so the next link still has them; the graph keepsattrs.clones. Nothing else reads them (searched).FAST_VERSIONis bumped so a stored skip-key does not return the old graph; the first map after upgrade rewrites those module facts once.matcherincore/glob.mjs), not looked up per path.scripts/bench.mjsrecordstree_bytesand the three Make a re-map cost proportional to the change, with a compact store #88 ratios with explicit bounds (GATES: no change / cold <= 0.1, changed / no change <= 2, store / tree <= 3);--gateexits 1 naming each ratio over its bound.scripts/bench-map.mjsadds a re-map after one edited, committed file and takes--gatetoo.Rejected.
generic, is not per-file: member reach (memberReach) is a whole-family analysis whose result changes edges of files that did not change, the build graph, partial types and structural interfaces are global, and links run in sequence over one shared, mutated fact map (dropMemberAttrs, retractions). Re-linking "changed files and their dependents" needs a persisted reverse index per adapter and a proof per adapter that it is exact (FR-002); that is a redesign, not a slice. A per-adapter link cache keyed on its inputs does not help either: an edited C# file changes the inputs ofgenericandquality, which are 60% of link.WITHOUT ROWIDtable keyed on (src, type, dst) without the text id would save about 29 MB, but it rebuilds the table: abreaks: truemigration that older hooks in a running session cannot write (see the header ofruntime/state/migrations.mjs). nopCommerce is within SC-002 (2.6 times the tree); the synthetic tiers are 50 times over because their files are a few hundred bytes, which no edge encoding fixes.Summary
A re-map after a commit no longer re-reads the whole git history window, and the graph no longer stores clone fingerprints, so a small change hashes, writes and reloads less. The benchmark now gates the ratios #88 asks for. Scenario 2 is still not met on nopCommerce; see the map.
Refs #88
Measurements
Shared machine (load average 9 to 25, an endpoint scanner on every file open), so times are upper bounds; work counts and sizes are exact.
nopCommerce,
mainand this branch side by side on two clones, four committed one-file edits each, alternating; round 1 ran while the 50k benchmark saturated the disk and is left out:mainSynthetic tiers (
scripts/bench.mjs):mainmainRead the 50k rows with care: the census (one file open per file, every map) was 180 s of the
mainno-change re-map, and 14.7 s against 7.5 s between the branch's own no-change and changed re-maps, run minutes apart. That swing, not this change, decides the 50k ratios here (themain1.97 and the branch 1.30 both look met because the census dominates the denominator). The branch's changed re-map after the census is 8.6 s (extraction 2.2, link 2.5, projection 3.1, history 0.2). Roslyn was not re-run (the 50k tiers took the time available).Scenario map
main0.06 and 0.25)remap-cost.test.mjs(edit, rename, deletion, moved reference; history read in part equals read in full),delta.test.mjsbench.mjsstore_vs_treeGATESand--gateinbench.mjsandbench-map.mjs,bench.test.mjs; CI runs--quickwithout--gate, since the bounds are not met yetTesting steps
New tests (each fails on
main, checked by running them against the oldbuilder.mjsandquality/index.mjs):tests/unit/graph/remap-cost.test.mjs"clone fingerprints serve the link and are not stored; a re-map after edits, a rename, a deletion and a moved reference equals a cold map": nofingerprintsin facts or nodes, still in the per-file cache, clones found before and after a rename, and nodes, edges, facts and derived facts equal a cold map of the final tree after an edit, agit mv, agit rmand an import moved from one file to another.tests/unit/scripts/bench.test.mjs"the bench gate checks the ratios of Make a re-map cost proportional to the change, with a compact store #88 against their bounds": inclusive bounds, each ratio over on its own.tests/unit/policy/core-primitives.test.mjs"matcher answers as matchAny does".The existing
delta.test.mjs(delta re-map equals cold, five languages, add/delete/rename/test reclassification) andshallow-history.test.mjspass unchanged.Checks: the full
npm testunder the lock: 3,662 tests, 3,652 passed, 9 skipped, 1 failed (the knownrequireHumanTTY). The changed and nearby files alone: graph, quality, bench and glob tests pass.node scripts/bench.mjs --quick --gateruns end to end and exits 1 with all three ratios named.Follow-up issues
What #88 still needs, and why it is not here:
genericand its member reach; each its own change with an equality test.--gateon an idle machine (50k and Roslyn) for the published table; wire it into CI once the bounds are met.Performance & Security & Data Privacy
Performance: as measured. Security and privacy: the per-commit cache holds paths, line counts and commit times that are already in the repository's git history, encrypted in the project's CAS like every cache blob, without the author hash. The fingerprints dropped from the graph stay in the encrypted per-file cache. Only public repositories were measured.
Feature flag
None. The graph equals a cold map of the same tree; module nodes lose
attrs.fingerprints, which no command read;history.commits_read,tree_bytes,store_bytesandgateare added fields.Review fixes
--unshallow, map equals a full read; and with history on, map through--deepenand a new commit equals a full read. Both failed before the fix.bench.mjs --quick --gatefails on the 300-file fixture by design (no-change/cold about 0.2 vs 0.1, store/tree about 53 vs 3), so the gate stays a manual run on the 10k and 50k tiers.🤖 Generated with Claude Code