Skip to content

fix(ci): revert only the run's own finalize commits in release rollback - #1467

Merged
c-vigo merged 4 commits into
release/1.8.0from
bugfix/1462-release-rollback-guard
Aug 12, 2026
Merged

c-vigo merged 4 commits into
release/1.8.0from
bugfix/1462-release-rollback-guard

Conversation

@c-vigo

@c-vigo c-vigo commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

release.yml's Rollback on Failure built a commit whose tree was reset to pre_finalize_sha — a run-start snapshot — whenever the run failed and the branch tip had moved at all. Any commit merged to the release branch while a run was in flight was silently destroyed on that run's failure (#1459: the merged content of #1447 and #1448 wiped off release/1.8.0 twice, both times with finalize skipped).

Fix

The rollback branch step now proves the branch holds only this run's own writes before touching anything, and refuses loudly otherwise:

  1. No-op when finalize never ran (needs.finalize.result == 'skipped'/empty) — this alone prevents both incidents.
  2. No-op for candidates — finalize is branch-neutral unless release_kind == final (second independent shield; both incidents were candidates).
  3. Retained CURRENT_SHA == PRE_SHA no-op.
  4. Chain proof before any write: finalize now exports the exact commit SHA it pushed (commit-action's commit-sha output) plus the post-sync tip. The tip must be exactly the finalize commit parented on PRE_SHA, or the sync commit directly on top of it — and since this org squash-merges PRs (single-parent, indistinguishable by parentage alone), the sync-tip path additionally gates on the sync commit's fixed message chore: sync issues and PRs (devkit also pins the author commit-action-bot[bot]; live-verified against the real 1.7.0 finalize/sync pair on main). Anything else ⇒ ::error + step failure, branch untouched; the failure issue and job summary report the outcome.

Only when the proof passes does the existing tree-at-PRE_SHA revert commit run — at that point it is exactly a revert of the run's own commits.

The PR-body restore step (and its Release-App token mint) now also skip when finalize was skipped — finalize is the only PR-body writer.

All three copies fixed consistently: devkit's release.yml, scaffolded release-core.yml (new finalize_commit_sha / finalize_result workflow_call outputs), and the scaffolded orchestrator release.yml — whose old rollback was a git reset --hard $PRE_SHA + force-push with zero guards, now replaced by the identical guarded API revert. Scaffold copies gate on the sync message only (the commit-bot name is per-consumer, the shipped sync-issues.yml message is a constant); script bodies are byte-identical between copies.

No concurrency group (issue proposal 4) — deliberately out of scope.

Tests

TDD: test(ci) commit landed RED first (18 failed / 5 passed — the 5 were retained behaviors). New tests/test_release_rollback_guard.py executes the actual workflow scripts against stubbed gh/retry simulating the Git Data API, parametrized over both copies: both incident shapes no-op, foreign-tip and foreign-parent refuse, foreign squash commit atop finalize refuses (the row that fails against the unhardened script), genuine sync commit reverts. Existing #1378 rollback-identity test rewritten to pin the App-token API rollback.

Verification (direct exit codes): pytest tests/test_release_rollback_guard.py tests/test_workflow_release_publish.py → 43 passed; broad pytest tests/ (excl. image/integration/flake) → 524 passed; actionlint .github/workflows/release.yml clean; rendered-tree actionlint bats 6/6 (covers the scaffold copies in all modes); full prek run --all-files → exit 0.

Also included: chore merge of release/1.8.0 (brings in the #1463 fix from #1464; changelog union resolved manually, mirror byte-identical), and stale "branch reset to pre-finalization state" wording updated in docs/RELEASE_CYCLE.md / DOWNSTREAM_RELEASE.md and the failure-issue texts.

Notes

  • Failed-job output propagation for finalize_commit_sha follows the pattern the job already relied on for pre_finalize_sha.
  • The dead git_user_name/git_user_email plumbing in release-core.yml (now unused after dropping the git-CLI rollback) is left in place — removal ripples across three workflows; separate-issue material.
  • The interim operating rule from the issue (don't merge into a release branch mid-run) becomes a courtesy rather than a data-integrity requirement, but remains good practice.

Closes #1462

c-vigo added 4 commits August 12, 2026 13:24
Executed decision matrix + workflow-shape assertions for the rollback job in
both release.yml copies: no-op when finalize never ran or for candidates,
refuse loudly when the branch tip is not exactly the commit(s) this run
wrote, and revert only after the chain proof. Red against the current
tree-reset logic that destroyed foreign commits in #1459/#1460.

Refs: #1462
The rollback job reset the branch tree to the run-start PRE_SHA whenever a
failed run's tip had moved, destroying commits merged mid-run (#1459/#1460).
It now no-ops when finalize never ran (and on branch-neutral candidates),
verifies the tip is exactly the finalize commit — optionally with the
sync-issues commit on top — parented on the snapshot, using SHAs finalize
exports as job outputs, and refuses loudly otherwise. The scaffolded consumer
rollback swaps its git reset --hard + force push for the identical guarded
Git Data API revert; release-core exposes finalize_result/finalize_commit_sha
to the caller, and the devkit PR-body restore skips when finalize was skipped.

Refs: #1462
Squash merges are single-parent, so a foreign PR squash-merged between the
finalize commit and the post-sync tip record would pass the parentage check
and get reverted. The FINAL_TIP path now also requires the tip's message to
be exactly 'chore: sync issues and PRs' in both release.yml copies, and its
author to match the org commit App (SYNC_COMMIT_AUTHOR knob, devkit only —
consumer App bot names are not a devkit-known constant, so the scaffold
relies on the message gate alone).

Refs: #1462
@c-vigo
c-vigo enabled auto-merge August 12, 2026 11:53
@c-vigo
c-vigo merged commit 633591f into release/1.8.0 Aug 12, 2026
12 checks passed
@c-vigo
c-vigo deleted the bugfix/1462-release-rollback-guard branch August 12, 2026 11:59
c-vigo added a commit that referenced this pull request Aug 12, 2026
… release workflows (#1472)

## Summary

#1467 replaced the scaffolded orchestrator's rollback (`git reset
--hard` + force-push under a configured git identity) with the guarded
Git Data API revert — the last consumer of the `git_user_name` /
`git_user_email` values threaded through the release workflows. This
removes the dead plumbing everywhere, caller and callee in lockstep.

The set turned out larger than #1467's "three workflows" note: **four
workflows × two copies**:

- scaffold `release.yml`: `workflow_dispatch` inputs + the forward into
the `release-core` call
- scaffold `release-core.yml`: `workflow_call` declarations (zero use
sites in the file)
- `prepare-release.yml` (devkit's own + scaffold): dispatch inputs + the
forward into the extension call
- `prepare-release-extension.yml` (devkit's own + scaffold): seam
template declarations (the default no-op never reads them)

Plus the contract docs (`docs/DOWNSTREAM_RELEASE.md` + scaffold copy).
Devkit's own `release.yml` was already clean (bespoke, zero hits) and is
untouched. Historical archives and released changelog entries
deliberately kept.

## Consumer safety

This is a `workflow_call`/seam interface change, hence the
`semver:minor` label and the `### Removed` changelog entry under 1.8.0.
Orchestrator and core ship together via the scaffold, so caller and
callee change in lockstep — no consumer action beyond the normal
upgrade. All six reachable consumers' **preserved**
`prepare-release-extension.yml` copies (commit-action,
sync-issues-action, org-config, devkit-smoke-test, vault, exo-fleet)
were checked: they declare the pair but have zero use sites, and since
the inputs are optional with declared defaults, a stale preserved copy
stays valid against the upgraded caller. The one genuine surface change:
the (never-exercised) dispatch knob for a custom release-commit identity
is gone — all release writes are App-identity API commits.

## Tests

TDD: `test(ci)` commit landed RED first (5 failed / 32 passed — exactly
the new absence assertions).
`test_scaffold_orchestrator_keeps_the_dispatch_identity_inputs`
rewritten to `..._drops_...` (also pins the release-core declarations
and the core-call `with:`, keeps the App-token rollback assertions); the
pair dropped from `REQUIRED_INPUTS` in
`test_workflow_prepare_extension.py` plus two absence tests parametrized
over both extension copies.

Verification (direct exit codes): workflow suites 66 passed; broad
`pytest tests/` (excl. image/integration/flake) 534 passed; `actionlint`
on the two touched devkit workflows clean; rendered-tree actionlint bats
6/6; after merging in the updated `release/1.8.0` (#1468 landed
mid-flight; clean auto-merge, changelog union verified, mirror
byte-identical): full `init-workspace.bats` 252/252 ok and full `prek
run --all-files` exit 0.

Closes #1470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant