Skip to content

fix(release): resume package releases from the release tag - #654

Merged
zoeyrose merged 5 commits into
mainfrom
fix/release-resume-tag-provenance
Nov 23, 2026
Merged

zoeyrose merged 5 commits into
mainfrom
fix/release-resume-tag-provenance

Conversation

@zoeyrose

@zoeyrose zoeyrose commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Summary

When the tag-ref Package Release run fails before uploading a draft asset, Semantic Release's "Resume the incomplete package release" step dispatched the retry with --ref "${ATRINIK_RELEASE_BRANCH}", that is from main. The retry built the tagged tree. But GitHub signs artifact attestations with the workflow run's own ref and commit (the OIDC ref/sha claims), not with the commit the run checks out. So the recovered releases were attested for main's head:

Release Tag commit Failed tag-ref run Resume run (from main) Attested SourceRepositoryDigest / ref
v5.115.0 8ff534ba 43611106351 43634478051 cf05ff3a, refs/heads/main
v5.116.0 5935b900 44401053824 44432273655 9d066c82, refs/heads/main
v5.117.0 8779fdfe none (succeeded on the tag) 8779fdfe, refs/tags/v5.117.0

Every verifier that pins the tag commit rejects v5.115.0 and v5.116.0. That includes service-updater's stable channel (gh attestation verify --signer-workflow …/package-release.yml --source-digest <tag commit>).

After this PR, every recovery path that builds or attests release artifacts runs on the tag ref. Package Release also refuses to publish any byte that lacks tag-bound provenance.

Why the resume used main

This was a deliberate escape hatch from #30 (the v5.6.0 incident): if the tag's own workflow definition was broken, rerunning from the tag would fail the same way, so recovery ran main's validated definition instead. Nothing on GitHub requires it. Tag-ref workflow_dispatch already works: the first dispatch (queue_package_release.sh) and Recover Missing Release both use it from the same token, and the discord-release environment admits v* tags. The flaw was that the resolver can't tell a broken definition from a transient failure, so every resume took the main path.

Both incidents were transient AppImage image-preparation failures, and their tooling was identical between tag and main:

The only way for a tag-ref run to execute main's definition is to call a reusable workflow at @main. That keeps the tag's source digest, but BuildSignerURI then names the reusable workflow, and the updater also pins it to package-release.yml. So no design lets main's definition sign for the tag in a form existing consumers accept.

Implementation / behavior

  • Tag-ref resume: release.yml dispatches the resume with --ref "${RELEASE_TAG}", after checking the tag format, and keeps source_branch=${ATRINIK_RELEASE_BRANCH}.
  • No branch-ref builds: package-release.yml preflight refuses a branch-ref run without candidate_run_id, with candidate builds must run from refs/tags/<tag>. Branch mode remains only for retained-candidate publication, which never builds. The metadata step requires a tag ref.
  • Tag-bound retained candidates: the resolver and the workflow's retained step accept only a failed candidate run on the exact tag ref and tag commit.
  • Provenance gate before publication: the new tools/release/verify_tag_provenance.sh runs gh attestation verify with the package-release.yml signer, the tag commit as source digest, refs/tags/<tag> as source ref, and --deny-self-hosted-runners. Each subject gets three attempts.
    • Every downloadable asset is checked right after this run attests it and before any draft upload, so a failure leaves the draft assetless.
    • The server image is checked after its attestation and before publication.
    • In retained-candidate recovery, the tag-ref candidate run's attestations satisfy the check. gh accepts any verified attestation: LiveSigstoreVerifier.Verify and VerifyCertExtensions keep the attestations that verify and fail only if none do.
  • Attempt cap: automatic recovery stops after three consecutive failed attempts of any class on the tag's lineage, returning blocked. That is the first dispatch plus two retries, or the candidate run plus two current-main continuations. A tag-ref retry can't pick up fixes from main, and each attempt adds about 15 check runs to the tag commit. Off-lineage runs don't use up attempts.
  • Check lookup by name: validate_release.py, recover_release.py and the branch-mode check query check-runs?check_name=Classic%20validation, keeping the default filter=latest. Before, they read one unfiltered page of up to 100 check runs.
  • Retained-candidate fix (pre-existing): RETAINED_PROOF_STEPS still named "Recheck candidate hashes before publication", renamed in feat(client): add automated Linux Debian release packages #580, so retained-candidate recovery could never match. The name is fixed, and a test now checks every job and step name the resolver inspects against the workflows.
  • Cleanup: removed the unreferenced server/tools/queue-release.sh (a --ref main dispatcher) and the unused validate_release.py --recovery-main.
  • docs/RELEASING.md: documents
    • the tag-bound recovery contract and the cap;
    • the resulting stall and its exits: a manual tag-ref dispatch, or Re-run failed jobs with its 30-day and Discord-artifact limits;
    • which failures the disposition helper can retire;
    • duplicate resumes;
    • the pre-publication provenance check;
    • backporting before cutting an X.Y.x branch from an older tag.

Validation

  • Release suites: test_resolve_pending_release, test_workflow_contracts, test_release_mutation_fences, the new test_package_release_preflight, test_recover_release, test_select_release_batch, test_sync_release_assets, test_release_artifacts and test_github_release give 179 tests, OK (3 CMake skips).
  • Full suite: CI='' python3 -m unittest discover -s tools/tests runs 894 tests. The only errors (104) are FileNotFoundError: 'cmake', because this host has no CMake.
  • Executed run blocks: test_package_release_preflight runs the checked-in guard, metadata, retained and both provenance steps with inert PATH mocks. Mutation checks confirm it catches each of these regressions: removing the guard, the retained tag/commit checks, --source-ref, --deny-self-hosted-runners, the retry, the image subject, or the tag-commit binding.
  • Real lineage: the retained-cap test uses a real temporary Git lineage: candidate, two main continuations, then blocked.
  • New tests fail on the base revision, including the name-identity test against the old step name.
  • Real gh 2.103.2 against live releases, running both checked-in provenance steps read-only:
    • v5.117.0 assets and classic-server@sha256:00132a3c… pass;
    • v5.116.0 fails with expected SourceRepositoryDigest to be 5935b900…, got 9d066c82…. This gate would have stopped both incidents.
  • Lint: actionlint 1.7.12 with ShellCheck 0.11.0 shows no new findings. The two pre-existing concurrency.queue reports are identical on the base revision. ShellCheck is clean on the new helper.
  • Other checks: python3 tools/verify_import_history.py, node tools/tests/test_release_policy.cjs and git diff --check pass.
  • Provenance evidence (read-only):
    • Attestations decoded from the GitHub attestations API give the table above.
    • The resume runs checked out candidate source at the tag commit.
    • The published v5.116.0 source archives match the tag, not main.
    • The classic-server:5.115.0 and 5.116.0 images carry their tag commits in org.opencontainers.image.revision.

No release, Package Release run or other dispatch was triggered. The recovery paths and the provenance gate run for real only in a release run. In particular, the attestation API's read-after-write latency right after actions/attest is unverified; the helper retries for 20 seconds.

Limitations / follow-up

  • v5.115.0 and v5.116.0 stay as published. Their bytes come from the tag sources, but their attestations name main, so tag-pinned verifiers keep rejecting them. What to do about them is an owner decision outside this PR.
  • A broken tagged workflow definition now stalls its draft once the cap blocks it, until a reviewed disposition lands. The disposition helper can't yet express every failure boundary.
  • Old definitions: tags cut before this merges keep their frozen definitions, without the provenance gate and with the old page-1 check query.
  • discord-release environment: it still admits main, which this workflow no longer uses. Narrowing it is a separate settings change and is not made here.
  • Pre-existing and unchanged: "Resume the retained complete candidate" dispatches with --ref main and no source_branch. It doesn't support maintenance-line drafts, and on an X.Y.x line those continuations wouldn't count toward the cap. No X.Y.x branch exists.

🤖 Generated with Claude Code

Automatic recovery of an assetless draft dispatched Package Release from
the release branch. That run built the tagged tree, but GitHub signs
artifact attestations with the run's own ref and commit, so v5.115.0 and
v5.116.0 were attested for main's head instead of their tag commits and
fail every verifier that pins the tag.

- dispatch the resume from the immutable tag ref, as the first dispatch does
- refuse branch-ref Package Release runs that would build a candidate
- accept a retained candidate only from a run on the exact tag ref and commit
- document the tag-bound recovery contract

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

None

@codecov

codecov Bot commented Nov 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

zoeyrose and others added 4 commits November 23, 2026 01:36
…lishing

Review follow-ups for the tag-bound resume:

- select the Classic validation check by name; each tag-ref attempt adds
  check runs to the tag commit and could push it off the first page
- block automatic recovery after three consecutive failed attempts of any
  class, since a tag-ref retry cannot pick up fixes from main
- restore the retained-candidate proof step name renamed in #580, and
  test every job and step name the resolver inspects against the workflows
- require tag-signer, tag-commit and tag-ref provenance for every asset and
  the image before a draft is published
- execute the tag-binding run blocks in tests with inert commands
- remove the unreferenced main-ref queue helper and the unused
  --recovery-main flag; document the cap, its stall and way out, duplicate
  resumes, and the maintenance-branch backport requirement

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Delta-review follow-ups:

- count failed retained-candidate continuations against the attempt cap,
  now that the restored step name makes that path reachable
- count only failed attempts on the draft tag's lineage toward the cap
- verify asset provenance before the draft upload, so a failure leaves the
  draft assetless, and the image after its attestation; share one helper
- exercise the tag-commit binding with real assets and assert that a
  blocked disposition runs no release mutation
- document the manual tag-ref retry, rerun limits, the disposition helper's
  scope, and which tag definitions contain the new checks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Second delta-review follow-ups:

- report the inspected attempt count on retained-candidate resumes
- test the retained cap end to end against a real Git lineage
- correct the proof-step rename guidance and the disposition helper's scope
- document the exits from a blocked draft that has assets, the server-image
  check after upload, and the source branch for manual tag-ref retries

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Third delta-review follow-ups: clear inherited GIT_* overrides in the
real-lineage retained-cap test, assert its first attempt count, clarify the
proof-step name comment, and document that both exits from a blocked draft
with assets close after about 30 days.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@zoeyrose

Copy link
Copy Markdown
Member Author

Self-review of #654 at head 08eb7adf8. Base 8779fdfe4 (origin/main). Commits: d59c29310, e6493b75e, 80853c4f4, 0a46ccd8a, 08eb7adf8.

What was reviewed

  • d59c29310 (whole diff): a fresh-context deep review of the diff and the code it touches, against an intent brief. It covered release.yml, package-release.yml, build-release-candidate.yml, resolve_pending_release.py, validate_release.py, recover_release.py, queue_package_release.sh, recover-release.yml and the release tests.
  • Fix deltas d59c29310..e6493b75e, e6493b75e..80853c4f4 and 80853c4f4..0a46ccd8a: each was reviewed by a new fresh-context reviewer.
  • 0a46ccd8a..08eb7adf8: reviewed by the author only. It changes test isolation, one assertion, a comment and doc wording, with no behaviour change.

First review (d59c29310)

The reviewer confirmed the core design:

  • tag-ref dispatch works;
  • attestation provenance comes from the run's OIDC sha/ref/job_workflow_ref;
  • refusing branch-ref builds breaks no live path;
  • gh attestation verify accepts any verified attestation;
  • the retirement guard is unaffected.

Findings:

  • P1: the tag becomes unpublishable after repeated resumes. The Classic validation lookup read only page 1 of check-runs. Fixed in e6493b75e: the lookup selects by check_name, and recovery is capped at three consecutive failed attempts of any class, then blocked.
  • P2: unlimited resumes. Fixed in e6493b75e by the cap, with the stall and the way out documented.
  • P2, pre-existing: the retained-candidate path was dead. The proof step was renamed in feat(client): add automated Linux Debian release packages #580. Fixed in e6493b75e: the name is restored, and an identity test now checks every job and step name the resolver inspects.
  • P2: no proof of tag-bound provenance before publication. Fixed in e6493b75e with a gate on the signer, the tag commit, the tag ref and hosted runners. 80853c4f4 split it into a check before the asset upload and a check after the image attestation.
  • P3 docs: fixed in e6493b75e:
    • the maintenance backport note;
    • wording aligned with assetless-draft recovery;
    • duplicate resumes documented.
  • P3 dead code and tests: fixed in e6493b75e:
    • removed server/tools/queue-release.sh and --recovery-main;
    • renamed the stale test;
    • the guard test now asserts exit 1;
    • added an executed preflight test.
  • Narrowing the discord-release environment so it no longer admits main: not done here. It is a settings change and is left to the owner.

Delta review of e6493b75e

  • P2: retained continuations were uncapped. Fixed in 80853c4f4.
  • P3: an asset provenance failure after upload strands the draft. Fixed in 80853c4f4: assets are verified before the upload.
  • P3: the tag-commit check was untested. Fixed in 80853c4f4.
  • P3: off-lineage runs counted toward the cap. Fixed in 80853c4f4.
  • P3: suggested a lower time bound for counting runs. Declined. GitHub's release created_at is the commit date, not the draft time, and the failure case is conservative: it blocks one attempt early.
  • P3: incomplete way-out docs. Fixed in 80853c4f4 and 0a46ccd8a.
  • P3: doc scope brittle for frozen definitions. Fixed in 80853c4f4.
  • P3: no test that blocked runs no mutation. Fixed in 80853c4f4.
  • P3: suggested accepting historical step names. Declined. No draft is pending; a comment explains the constraint, and the identity test fails on any rename.

Delta review of 80853c4f4

  • P3: the comment's remedy was wrong. Fixed in 0a46ccd8a, refined in 08eb7adf8.
  • P3: the client-package scope was misstated. Fixed in 0a46ccd8a.
  • P3: blocked drafts with assets had no documented exit. Fixed in 0a46ccd8a.
  • P3: the retained retry_count was missing. Fixed in 0a46ccd8a.
  • P3: no end-to-end real-lineage test. Fixed in 0a46ccd8a.
  • P3: a "main moved" preflight race uses up the budget. Declined. The guard is pre-existing and fails closed, and the documented manual exits cover it; not counting these failures would reopen unbounded redispatch.
  • P3: on maintenance lines the cap never trips for retained continuations. Declined. The pre-existing retained dispatch has no maintenance support and no X.Y.x branch exists; this is listed in the PR limitations.
  • Doc nits: fixed in 0a46ccd8a.

Delta review of 0a46ccd8a

  • P3: the lineage test was sensitive to an exported GIT_DIR. Fixed in 08eb7adf8.
  • P3: both blocked exits close after about 30 days. Documented in 08eb7adf8.
  • P3: the provenance-failure sentence was too narrow. Fixed in 08eb7adf8.
  • P3: the retained summary mixes the candidate's class with the attempt count. Declined. The summary is diagnostic, and the docs promise the newest class only for blocked.
  • P3 comment precision, line wrap, and the first retry_count assertion: fixed in 08eb7adf8.

Validation at 08eb7adf8

  • Release suites: 179 tests OK (3 CMake skips). The full tools/tests discover shows only the 104 host-only cmake errors.
  • New tests fail on base, and mutation checks are caught.
  • gh 2.103.2, read-only, running both provenance steps: they pass on v5.117.0 and fail on v5.116.0 (expected SourceRepositoryDigest to be 5935b900…, got 9d066c82…).
  • Lint and checks: actionlint with ShellCheck shows no new findings. verify_import_history.py, test_release_policy.cjs and git diff --check pass.
  • Not run: nothing was dispatched. Attestation read-after-write latency in a real run is unverified.

@zoeyrose
zoeyrose marked this pull request as ready for review November 23, 2026 08:40
@zoeyrose zoeyrose self-assigned this Nov 23, 2026
@zoeyrose
zoeyrose requested a review from a team November 23, 2026 08:40
@zoeyrose
zoeyrose merged commit 55c7933 into main Nov 23, 2026
32 checks passed
@zoeyrose
zoeyrose deleted the fix/release-resume-tag-provenance branch November 23, 2026 11:55
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