feat(infra): ./infra approve merges the promotion PR after the gate's own checks #154
Loading…
Reference in a new issue
No description provided.
Delete branch "jfraeys/feat/infra-approve"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Stacked on #152 (one front door): until #152 merges, this PR's diff also shows its commit. Merge #152 first.
./infra approve [PR](scripts/approve-promotion.sh) replaces merging the promotion PR in the Forgejo UI, where merges silently did not take (#129, #133, #134; #116), and makes approval refuse anything the deploy gate would refuse later.Checks, in order (each refusal says why; nothing is merged):
main -> prod(the open one, or the number you give);passed on commit <sha>in the PR body);PROMOTION_STAGED_RE, reused, not copied);scripts/plan-prod.sh bothdoes not error (exit 2, changes or drift, is allowed but needs the stronger answer).Then you type the PR number (
<N> with changeswhen the plan found changes); it merges withteaand confirms on the API that the merge took, retrying briefly. Needs a terminal (refuses without one). Reads no secret. Prints the next step (git pull,./infra deploy).Tests:
test-approve-promotion.sh, 15 cases with a faketeaserving fixture JSON, a fake plan with chosen exit codes and a throwaway git repo for the ancestry rule (approve, wrong answer, no PR, wrong number, unvalidated, docs-only drift accepted, roles drift refused, CI pending, plan error, plan changes needing the stronger answer, merge not visible, tea merge failure, usage, no terminal). Added to the lint workflow.test-infra-cli.sh+2 cases. Not run against the real Forgejo.Docs: README,
deployment.mdanddaily-commands.mdpoint the approval step at./infra approve.🤖 Generated with Claude Code
https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ
scripts/approve-promotion.sh (./infra approve [PR]) checks, before anything is merged, what the deploy gate will check later: the PR is main -> prod, staging validated a commit, the PR's head is that commit or differs from it only in files staging does not exercise (the gate's PROMOTION_STAGED_RE, reused), CI on the head is green, and scripts/plan-prod.sh does not error. You then type the PR number ("<N> with changes" when the plan found changes); it merges with tea and confirms on the API that the merge took. Replaces merging in the Forgejo UI, where merges silently did not take (#129, #133, #134). Needs a terminal; reads no secret. test-approve-promotion.sh: 15 cases with a fake tea, a fake plan and a throwaway git repo for the ancestry rule; added to the lint workflow. Runbooks and README point step 4 at ./infra approve. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ge5tovcwdEUBtPwUktsZZZ61ae3878a96c2dd8a7226c2dd8a722c9c79284a8c9c79284a8276efcbf46Rebased onto main (now includes #152 and #157). Added commit:
promotion_driftinlib/setup/promotion.shis now the one drift rule shared by the deploy gate (promotion_verify),plan-prod.shandapprove-promotion.sh. This fixes plan-prod's false[WARN] ... wait for the newer staging runwhen main moved past the validated commit only in files staging does not exercise (vault, docs, scripts outside lib/): no staging run ever comes for those, so the warning could never clear (seen 2026-10-14,022a70a->54e508c). plan-prod now says OK in that case and names the files when it does warn. test-promotion +5 cases; checked on real history:022a70a->54e508c= 0,54e508c-> main = 1 listing the #152/#157 files.