Repository navigation
fix(amr): check the staged bytes after git add; read each folder once - #336
Merged
Merged
Conversation
…once Close the gap between the secret scan and `git add`. After `git add`, the writer compares the blob id of each staged entry with the hash of the bytes it scanned. A matching id passes without a read. Any other id is read with `git cat-file`, size first, and scanned again with the same check as the first scan. A symlink, a gitlink or an unmerged entry refuses the commit with `stage-mismatch`. GitRunner allows exactly `ls-files -s -z -- <paths>`, `cat-file -s <oid>` and `cat-file blob <oid>`. `commitFiles` takes an optional verify hook. The hook runs after `add` and before `commit`. A write batch or a commit reads each folder once, not once per file. A refused new file that became a symlink is removed as a link. Not covered: a process that writes the index between that check and `git commit`. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
… map f3c012c wrote the docs/architecture reports with repo-tools map. CI regenerates them with tools:deps and fails the census on that output. This restores the generator output; the diff against master is now 38/28 lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… pattern load) - isAllowed reads only own keys of ALLOWED_OPTIONS, so constructor, __proto__ and toString are refused. - Every git call adds --no-replace-objects, so a replace ref cannot change the bytes that cat-file reads in the rescan. - commitAmrEdits loads the secret patterns once per call; a bad file gives bad-patterns with no path and stages nothing. - Tests: sha256 repositories, core.symlinks=false swaps, an autocrlf secret, the case-variant split by file-system probe, and the size-limit path makes no cat-file blob call. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
writeAmrFiles without opts.patterns loaded the patterns once per file and again in the staged rescan. Load them once, refuse bad-patterns with no path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…load row Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
importAmr saved the storage file once per new entity. On a Windows CI runner the F11 import test (1002 files) took 11 s and once ran past its 60 s limit. Batches of up to 1000, with a one-by-one retry of a failed batch: 5.6 s -> 0.9 s here. Co-Authored-By: Claude Opus 5.5 <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.
Summary
git add: mode must be 100644/100755 (symlinks and gitlinks refused, also withcore.symlinks=false); a staged oid that differs from the hash of the scanned bytes is size-checked withcat-file -s, then rescanned fromcat-file blobwith the same patterns. Every git call adds--no-replace-objects; the allow-list ignores inherited keys.writeAmrFiles/commitAmrEditscall.planTargetreads each folder once per batch (5000 files in one folder: check loop 14.4 s -> 7.2 s;commitAmrEdits54.6 s -> 48.5 s;git add38 s unchanged).git commit.Tests
AMR suite 457 passed, 4 skipped. Mutation checks: removing the staged verify fails 7 tests, removing the mode check fails 4, removing the size check fails the grows-past-limit test. The full local suite timed out once in
AmrSyncF11 (1000+ relations), which takes 8.3 s on master and 9.0 s here when run alone; filed as a todo row.Gates
typecheck, lint, tools:check-census, tools:check-duplicates, repo-tools check (30 claims), repo-tools docs check (2169/2169).
junior chain run: yes. Worker Haiku (claude-haiku-5-5): 1 of 1 candidate accepted after fixes (report generation redone with tools:deps). Challenger Haiku: 10 findings, 8 accepted by the reviewer. Reviewer Sonnet: 10 verdicts plus 3 own findings, fixes applied by Opus.
🤖 Generated with Claude Code