Repository navigation
refactor(stage): stage a pinned commit - #135
Merged
Merged
Conversation
stageCommand gains an in-process option `source: { sha }`. It stages
that full commit id under the branch name without reading
refs/heads/<branch>; a short id, an invalid branch name or a commit
missing from the clone is a PreconditionError before any fetch. Every
gate, the deny-list scans, redaction and the confirm stay on the same
path. The approval gate uses it so the approved commit is exactly what
ships. getDefaultBranch('upstream') now gets the clone directory instead
of falling back to process.cwd().
Without `source`, stage now reads the local branch tip once, before the
fetches, and the merge-base check, the merge scan and the rebuild all
use that commit id. Before, they re-read refs/heads/<branch> after the
fetches, so a branch moved during the fetch shipped the new tip while
sourceHead named the old one.
The PR step now records shippedBranches[branch].sourceHead, the mirror
commit that was staged (head is the rebuilt commit). Normalization keeps
it when it is a string. The CLI never sets `source`.
cabljac
force-pushed
the
gate/01-stage-source
branch
from
October 19, 2026 17:26
52fa887 to
413f4e6
Compare
cabljac
marked this pull request as ready for review
October 19, 2026 17:28
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.
The approval gate (0.15.0) needs stage to ship one exact commit: the mirror PR head that was approved, not whatever the local branch points at later. This is #122 rebased onto main, minus its
cwdoption, which only the parkedvenfork watchneeded.stageCommandgains the in-process optionsource: { sha }. It stages that full commit id under the branch name without readingrefs/heads/<branch>; a short id, a bad branch name or a missing commit is apreconditionrefusal before any fetch. Withoutsource, stage now reads the branch tip once, before the fetches, so a branch that moves during a fetch can no longer ship a tip other than the one recorded. The PR step recordsshippedBranches[branch].sourceHead. The CLI never setssource.Tests, red first:
sourceHeadcases intests/unit/commands.test.tsandtests/unit/config.test.ts, and pinned-commit and moved-branch cases intests/integration/stage.test.ts.bun run verifyexits 0. Counts: unit 1258 to 1260, integration 469 to 474.Not verified: e2e tiers and live GitHub. Part of the 0.15.0 approval gate stack; supersedes #122.