Repository navigation
feat(review): structured repository state, and a verification that knows what it verified - #93
Merged
Merged
Conversation
…ows what it verified The review/ship rail needs one honest answer to "what is the state of this repository right now?" before it can offer to stage, commit or publish anything. This is that answer, plus the piece that keeps "verified" from becoming a label with no tree behind it. review_state.ts reads the whole state in one pass through an injected Runner: repository root, remote identity, head branch and revision, base branch and the revision it resolved to, commits ahead of and behind that base, and every changed path with both halves of its status code. Three things it refuses to round off: - The push URL is read with `git remote get-url --push`, separately from the fetch URL. A configured `remote.<name>.pushurl` makes them differ, and a rail that confirmed the fetch URL would then publish somewhere the user was never shown. The pull-request target follows the push URL for the same reason. - Unknown stays unknown. An unresolvable base leaves ahead/behind null rather than zero; a base read from a local tracking ref is never reported as fetched; a failed fetch carries git's own reason. - A rename entry in porcelain v2 spans two NUL fields. Reading each field as an entry turns the origin path of every rename into a phantom changed file, so the parser consumes it deliberately. verification_record.ts stores a verify-gate result together with the identity of what it verified: the head commit and a digest of the working tree, where untracked content is hashed rather than listed (a green run that depended on an untracked fixture must not survive an edit to that fixture). classify() compares identity BEFORE it consults the exit code, so neither a stale green record nor a stale red one can be rendered as current. There is no path that upgrades unknown or stale to verified. Tests cover the parser vectors, the pushurl-divergence case, unknown-not-zero, disk round-trip, corruption and a future schema version, plus two real-git canaries. Mutation check: disabling the head-identity comparison fails three tests, including the stale-red one.
This was referenced Aug 22, 2026
Merged
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.
First of the AA-SHIP-02 stack (the review-and-ship rail). This PR adds no
command and changes no existing behaviour — it is the state layer the rest of
the rail is built on.
What is here
src/core/review_state.ts— one structured read of the repository:repository root, remote identity, head branch/revision, base branch and the
revision it resolved to, ahead/behind against that base, and every changed path
with both halves of its porcelain-v2 status code. Every git call is an argv
array through an injected
Runner; nothing builds a command string.Three properties it exists to keep:
git remote get-url --pushcan differfrom the fetch URL via
remote.<name>.pushurl. A rail that confirmed thefetch URL and published to the push URL would show one destination and use
another, so both are read and the pull-request target follows the push URL.
null,not
0. A base read from a local tracking ref is never reported as fetched.A failed fetch carries git's own reason.
fields; consuming the origin field is what keeps it from being parsed as a
phantom changed path.
src/core/verification_record.ts— a verify-gate result stored with theidentity of the tree it verified (head commit + working-tree digest, with
untracked file content hashed, not merely listed).
classifyVerificationcompares identity before it looks at the exit code, so a stale green record
reads as
staleand a stale red one does too. No path upgradesunknownorstaletoverified.Evidence
npm run typecheckclean.node --test dist/test/review_state.test.js dist/test/verification_record.test.js— 25/25 pass, including two real-git canaries.comparison in
classifyVerificationfails three tests, includingidentity is checked before the exit code, so a stale RED record is stale too.Not here
No CLI surface, no staging, no push, no
ghcall. Those are the next PRs inthe stack.