Repository navigation
feat(ship): publish HEAD and only HEAD, and bind the work to what carries it - #95
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.
Owner
Author
|
CI evidence for this stacked branch ( https://github.com/AetherAI3/aether-agent/actions/runs/32579889180 — 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.
Third of the AA-SHIP-02 stack. Stacked on #94 (which is stacked on #93).
Strictly additive: two new core files and two new test files, nothing existing
is modified —
src/core/ship.tsis imported, never touched.src/core/publish.ts— the one place work leaves the machineWritten as refusals, because a push is the first irreversible step:
refs/heads/<b>:refs/heads/<b>, fully qualified on both sides. The short formresolves the source through git's ref lookup, where a tag or remote ref sharing
the name is what actually travels.
main,master,HEAD,trunk,developare refused as heads, and so is any head that equals the resolvedbase branch.
--force,--force-with-lease,--delete,--tags,--mirror,--allanywhere in the file; a test asserts the argv never growsone. A rejected non-fast-forward returns git's own message plus a hint that
says this rail does not force.
what the plan rendered. A remote that changed between confirmation and push is
a different destination, and consent was for the old one.
planShipderives the pull request from the same state, using the remote'spush URL — so the PR opens against the repository the commits actually went
to. A non-GitHub remote is refused plainly rather than having a slug invented
for it.
src/core/ship_record.ts— session ↔ worktree ↔ branch ↔ commit ↔ PRAll five were recorded somewhere already and never joined up. Two rules:
pull request never describes newer work.
clean tree, published commit, a PR that carries it. Each failing condition
names itself.
Branch names are hashed into the record path, never used as one (a branch called
../../../etc/passwdis a filename question otherwise).Evidence
npm run typecheckclean.test/publish.test.tsandtest/ship_record.test.ts, including areal-git canary that clones a real bare repo, publishes a branch, and then
asserts the branch landed at the published commit, the base ref on the server
did not move, and no tags were pushed. A second canary drives
openPullRequestthrough a fakegh, asserting a hostile title stays one argvelement and no
merge/--auto/--adminappears.the destination re-read fails the changed-remote test; carrying a stale record
forward fails the new-commit test.
Registry
This PR registers nothing. No
src/main.ts, nosrc/commands/cli_registry.ts,no
COMMANDS.md. Theaether review/aether ship//review//shipsurfaces are the command layer, owned by a peer lane, and per AA-INT-05 they
should register through
DISPATCH_COMMANDSrather than a newswitchcase.