Repository navigation
feat(review): the one writer for a verification record, and the one condition it writes under - #97
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.
…was chosen The second layer of the review/ship rail: the mutating half. It turns a selection over the repository state from the previous commit into index and worktree changes, and it is written so that four properties are structural rather than remembered. You may only act on a path the state reported. Every entry point takes the state and a selection of names, resolves the names against the paths git listed, and refuses the ones that do not match — so a crafted name never reaches git at all rather than being escaped on the way. Combined with `--` and core.literalPathspecs, there is no route from a name to a git option. Nothing is destroyed that a preview did not name. planRevert returns the exact patch text it would discard; applyRevert re-reads the diff and refuses if it no longer matches, so an edit landing between the preview and the confirmation cancels the revert instead of discarding whatever is there now. A file with staged content is described as restoring to "its staged state", because that is what `git restore` actually does. A commit contains the selection and nothing else. planCommit refuses an index that already holds paths the user did not select (selecting them is how you include them); commitSelected stages, verifies the index equals the selection, verifies the worktree still matches the index, and resets rather than committing if either check fails. Hunk selection is real: a patch is rebuilt from the selected hunks with git's own preamble and applied with `git apply --cached`, so half a file can be staged and the rest left in the worktree. Binary files are refused rather than half-handled. Evidence: 16/16 in test/review_actions.test.ts, eleven of them driving a real repository. Mutation checks — disabling the unrelated-staged refusal fails the "someone else's staged file" test; disabling the preview comparison fails the revert-race test.
…ries it The third layer of the review/ship rail, and the one where work leaves the machine. Everything before it is local and undoable; a push is neither, so publish.ts is written as a list of refusals. Only HEAD is pushed, to a branch of the same name, through a refspec that is fully qualified on both sides — the short form resolves the source through git's ref lookup, where a tag or a remote ref sharing the name is what actually travels. A head named main, master, HEAD, trunk or develop is refused outright, and so is a head that is also the resolved base: work committed to the base was committed in the wrong place, and publishing it is not the fix. There is no --force, --force-with-lease, --delete, --tags or --mirror anywhere in the file, and a test asserts the argv never grows one. A rejected non-fast-forward push returns git's own message plus a hint that says, in as many words, that this rail does not force. The destination is re-read immediately before the push and compared to what the plan rendered. A remote that changed between the confirmation and the push is a different destination, and the consent was for the old one. planShip derives the pull request from the same state, using the remote's PUSH url — so the pull request opens against the repository the commits actually went to, which is the one thing a fetch-url slug cannot guarantee. It refuses a non-GitHub remote plainly instead of inventing a slug. ship_record.ts joins the five identities that were each recorded separately and never together: session, worktree, branch, commit, pull request. Two rules carry it. A record whose commit no longer matches is rebound rather than updated, so an old pull request never describes newer work. And a worktree may only be cleaned up when everything in it exists somewhere else — clean tree, published commit, pull request that carries it. Branch names are hashed into the record path, never used as one. Evidence: 29/29 across test/publish.test.ts and test/ship_record.test.ts, including a real-git canary that pushes into a real bare repository and then asserts the base ref on the server did not move and no tags were pushed. Mutation checks: dropping the protected-head list fails three tests; dropping the destination re-read fails the changed-remote test; carrying a stale record forward fails the new-commit test.
…ondition it writes under verification_record.ts could only be read. A field with no writer is the defect class this repository keeps finding, and a read-only verification store is that defect with a safety label on it: the rail would have shown "unknown" forever and nobody would have noticed it could never show anything else. verifyAndRecord is the only writer. It identifies the working tree, runs the command through the caller's VerifyRunner — the same interface and the same ToolExecutor the host verify gate uses, so no command string is assembled or interpreted here — and identifies the tree again afterwards. If the tree moved while the command ran, nothing is written. A suite takes time, and an agent write or an editor save during it leaves a result that is true of no tree that exists; recording it would mint exactly the misleading claim that classifyVerification exists to catch on read. The reading returned in that case is "unknown" with a reason that says the run cannot be attributed, and the raw output and exit code are still handed back for the caller to display. Otherwise the record is written and classified through classifyVerification — the same function a later read uses, so the status shown now and the status shown in ten minutes come from one implementation. Evidence: 6/6 in test/verify_run.test.ts, five driving a real repository (green, red with a parsed failing count, a tracked file changing mid-run, an untracked file appearing mid-run, and replace-then-go-stale). Mutation check: removing the before/after comparison fails both attribution tests.
Owner
Author
|
CI evidence for this stacked branch ( https://github.com/AetherAI3/aether-agent/actions/runs/32579966537 — success on |
This was referenced Aug 22, 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.
Fourth and last of the AA-SHIP-02 core stack. Stacked on #95 (→ #94 → #93).
One new file plus its tests; nothing existing is modified.
Why
verification_record.ts(#93) could only be read. A field with no writer isthe defect class this repository keeps finding, and a read-only verification
store is that defect wearing a safety label: the rail would have shown
unknownforever, and nothing would have revealed that it could not show anything else.
What
verifyAndRecordis the only writer. It identifies the working tree, runs thecommand through the caller's
VerifyRunner— the same interface and the sameToolExecutorthe host verify gate uses, so no command string is assembled orinterpreted here — and identifies the tree again afterwards.
If the tree moved while the command ran, nothing is written. A suite takes
time; an agent write or an editor save during it leaves a result true of no tree
that exists. Recording it would mint exactly the misleading claim that
classifyVerificationexists to catch on read. That case returnsunknownwitha reason saying the run cannot be attributed, while still handing back the raw
output and exit code for display.
Otherwise the record is written and classified through
classifyVerification—the same function a later read uses, so the status shown now and the status shown
in ten minutes come from one implementation.
Evidence
npm run typecheckclean.test/verify_run.test.ts, five driving a real repository: green, redwith a parsed failing count, a tracked file changing mid-run, an untracked file
appearing mid-run, and replace-then-go-stale.
tests.
The stack, and how CI was run on it
.github/workflows/ci.ymltriggers only on pull requests targetingmain, so astacked PR reports no checks. Each branch in this stack was therefore run through
workflow_dispatchon its own ref; the run links are in each PR. #93 (basemain) has the ordinary PR run, green on ubuntu and windows.