Skip to content

fix(release): refuse re-dispatch of published versions + delete dead channel default (#2674, #2675) (dev twin) - #2717

Merged
namastex888 merged 1 commit into
devfrom
fix/release-publish-hardening
Jul 27, 2026
Merged

namastex888 merged 1 commit into
devfrom
fix/release-publish-hardening

Conversation

@automagik-genie

Copy link
Copy Markdown
Contributor

TWIN-PR — this is the dev half. The main half is #2716, which carries the full rationale.
Both PRs are human-merge only, and neither may be merged while a stable release run is in flight. Land them together so main and dev do not diverge on .github/workflows/release-publish.yml.

Refs #2674, #2675 (closed by the main twin, #2716).

Relationship to #2716

.github/workflows/release-publish.yml and scripts/release-docs.test.ts are byte-identical to the main twin (verified with cmp against the twin commit before pushing). This PR adds one file the main half deliberately does not carry.

What changed (same as #2716)

  1. Release ops rule: never re-dispatch a version that already has a published release (pre-fanout releases are non-replayable) #2674 — admit refuses re-dispatch of an already published version. New step queries gh api repos/<repo>/releases/tags/v<version>; a draft == false release fails the job with ::error ::release-replay.published citing "published releases are non-replayable — allocate a fresh version" and Release ops rule: never re-dispatch a version that already has a published release (pre-fanout releases are non-replayable) #2674. Drafts stay admissible (an interrupted run must finish the release it opened), 404 is the normal fresh-version path, and any other API answer fails closed. admit moves from permissions: {} to contents: read — never write, which still starts at publish.

  2. release-publish.yml: delete the dead CHANNEL=stable default in publish; pin multi-attestation and CAS-loop coverage #2675 — dead CHANNEL=stable default deleted from publish. CHANNEL="${INPUT_CHANNEL:-}" → stable was unreachable (admit exits 1 on an empty/unknown channel), its comment was stale, and it was the only reader of steps.meta.outputs.channel. publish now reads inputs.channel raw like finalize/manifests; the step is renamed Resolve version + asset inventory.

Dev-only addition: multi-attestation shape (#2675)

scripts/reconcile-release-assets.test.ts — the fake gh returned exactly one attestation per tarball, so nothing pinned the real API shape. A published tarball actually carries two attestations for the same digest: GitHub's in-toto immutable-release attestation (minted when the release is locked) and ours. Production tolerates it — scripts/release-native-predicate.sh reusable_control_sha() uses first(.[] | select(predicateType == ...)), i.e. selection by predicate type — but no test would have caught a regression to positional selection.

  • The fake now emits [github-immutable-release, ours] for every non---bundle tarball verification, GitHub's first, and records each batch size in state.
  • New test selects our release predicate when GitHub also attests the immutable release asserts a clean run plus attestationBatchSizes of [2 x 8] (4 platforms x 2 passes: unfiltered, then certificate-filtered).
  • The --bundle delivery path still returns exactly one, matching the script's length == 1 assertion on the descriptor equality check.

Mutation-checked: rewriting first(.[] | select(...)) to first(.[0] | select(...)) in release-native-predicate.sh makes the new test fail (exit 4). Reverted before commit.

CAS-loop coverage: not added, recorded here

The manifests job's inline fetch/detach/reconcile/add/commit/push loop with 403-vs-non-fast-forward failure classification is workflow-inline shell with no testable seam — no script under scripts/ owns it (reconcile-channel-manifests.sh, which is tested, is only the reconcile step the loop calls). Covering it would require extracting the classifier into a new script and wiring it through the RUNNER_TEMP copy the loop already performs for the reconciler, identically on both branches — a substantive refactor of the most fragile job in the release path, out of scope here. Deferred deliberately rather than faked, per #2675.

Validation

bun test scripts/reconcile-release-assets.test.ts                        # 14 pass, 0 fail (was 13)
bun test scripts/release-docs.test.ts                                    # 41 pass, 0 fail
bun test scripts/release-guard scripts/release-native-predicate \
         scripts/release-generic-provenance scripts/reconcile-* \
         scripts/release-immutability                                    # 68 pass, 0 fail
bun run check:fast                                                       # OK: all checks passed
bunx actionlint .github/workflows/release-publish.yml                    # only the pre-existing
                                                                         # `queue: max` note, identical
                                                                         # on origin/dev

actionlint ran with shellcheck present, so the new inline shell was shellcheck-clean.

…channel default (#2674, #2675)

admit now asks whether v<version> already carries a published GitHub Release
and refuses the run when it does. A published release is immutable and this
pipeline can no longer replay one: reconcile-release-assets.sh expects the
current 20/28/36-asset delivery fanout while every pre-fanout release carries
12 that can never be extended, and reconcile-channel-manifests.sh derives a
deterministic midnight-UTC released_at that no longer cmp-matches the
wall-clock timestamps already on main. Both failures land AFTER the release is
published and locked, so the rule "always allocate a fresh version" is now
enforced mechanically instead of remembered. Drafts stay admissible so an
interrupted run can finish the release it opened, and an ambiguous API answer
fails closed. admit gains contents:read (never write) for the query.

publish loses its dead CHANNEL="${INPUT_CHANNEL:-}" -> stable default. admit
already exits 1 on an empty/unknown channel and both callers always pass one;
had it ever fired, publish would have uploaded a 36-asset stable inventory
that finalize aborts on, leaving a published-but-unfinalized release. publish
now reads inputs.channel raw, exactly like finalize and manifests, and the
stale "workflow_run defaults to stable" comment is gone.

Tests: the reconcile-release-assets fake now returns TWO attestations per
published tarball (GitHub's in-toto immutable-release attestation first, ours
second), pinning that production selects by predicate type rather than by
position or count. release-docs pins the new admit guard and the channel
wiring.

Refs #2674, #2675
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@coderabbitai

coderabbitai Bot commented Jul 27, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a6178cad-d612-4daf-899c-cace2cc665ef

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/release-publish-hardening

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@namastex888
namastex888 merged commit 73007d1 into dev Jul 27, 2026
13 checks passed
@automagik-genie
automagik-genie deleted the fix/release-publish-hardening branch September 25, 2026 04:50
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.

2 participants