Skip to content

fix(release): stop the release policy from deleting pipeline-cut releases - #23669

Merged
AmethystLiang merged 2 commits into
mainfrom
fix/release-policy-ci-cut-tags
Sep 28, 2026
Merged

AmethystLiang merged 2 commits into
mainfrom
fix/release-policy-ci-cut-tags

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 1 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150 0 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150
Prod 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​149 $\color{#cf222e}{\Huge{\mathbf{−}}}$​73 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​76

ELI5

A GitHub workflow is supposed to delete stray releases that people publish by hand. It decided "stray" by asking who created the release entry, not whether our release pipeline actually built it. So a real, CI-built release got deleted just because someone edited its notes, and "Latest" went backwards to an older version.

What Changed

Before: v1.4.216 was built by Cut Release, but its draft had been created by a person first, so the release entry's author was that person. When its notes were edited, the policy deleted the release and its tag. It then picked a new "Latest" from releases authored only by github-actions[bot], skipping v1.4.215 (published by a person), so Latest dropped to v1.4.214 and the stable auto-updater pointed back at it.

After:

  • A desktop release (vX.Y.Z or an RC) is allowed when its tag was created by the release pipeline: an annotated tag whose tagger is github-actions[bot], pointing at the pipeline's release: vX.Y.Z commit (scheduled RCs' [rc-slot:…] suffix included). Bot-authored releases are still allowed as before; mobile tags are unchanged.
  • The policy only deletes on published. An edited event never deletes a release or tag; it logs a warning instead.
  • Choosing Latest uses the same check, so it lands on the highest real stable release (v1.4.215 today) instead of the highest bot-authored one.
  • The inline github-script moved to config/scripts/release-policy.mjs so it can be unit tested. The workflow sparse-checks-out only that file from the same commit it runs from.

Scope limit: GitHub runs a release event's workflow from the tagged commit, not from main (the run that deleted v1.4.216 ran on the tag commit e4657e84). So this fix protects releases whose tag is cut after it lands; existing releases such as v1.4.215, and patch releases cut from branches that predate this change, still run the old policy when edited.

Why

The tag and version commit are created only by Cut Release; the release entry's author is just whoever made the draft first (Cut Release reuses an existing draft rather than recreating it). Checking the tag keeps the original goal—stray hand-published releases still get removed when published—without deleting real releases.

Alternatives considered: dropping the edited trigger alone still leaves human-drafted CI releases deletable on published and still regresses Latest; making Cut Release delete and recreate any pre-existing draft fixes new cuts but not v1.4.215 or future edits. A repository tag ruleset (noted as the proper fix in #13591) is still worth adding separately.

Linked Issue

N/A. Follow-up to the v1.4.216 deletion on 2026-09-28 (Release Policy run 36466544163).

Visual Proof

N/A. CI workflow change, no UI.

Testing

  • config/scripts/release-policy.test.mjs: a human-drafted pipeline release survives an edit and becomes Latest; unauthorized releases are never deleted on edit; a hand-made tag, or a bot tag on a non-release commit, is still deleted on publish; scheduled RC commits pass; Latest ignores prereleases and compares versions numerically.

  • Read-only dry run against the live repo using gh api: v1.4.215, v1.4.214 and v1.4.21-rc.2 are recognized as pipeline-cut, and Latest would be set to v1.4.215 (release 397463952).

  • Ran the workflow's exact script: body inside an AsyncFunction, the way github-script runs it, against live data with every write stubbed: v1.4.215 (edited and published) and v1.4.214 (edited) make no deletes, and Latest stays v1.4.215.

  • pr-workflow-parallelism.test.mjs still passes (runner stays ubuntu-slim). check:code-quality:changed passes.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Security: the workflow keeps contents: write only. It already runs from the tagged commit (GitHub's behavior for release events), so loading the module from that same commit adds no new trust. A tag's tagger name can be set by anyone with push access, so this is a guard against accidents, not a security boundary, which is the same as the author check it replaces.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

…ases

The policy judged a release by who created the release object. Cut Release
reuses an existing draft, so a CI-built v1.4.216 whose draft a person had
created was deleted (tag included) when its notes were edited, and Latest
fell back to v1.4.214 because v1.4.215 was also published by a person.

- Authorize a desktop release when its annotated tag was created by the
  release pipeline and points at its `release: vX` commit, not only by author.
- Only delete on `published`; an edit never deletes a release or tag.
- Pick Latest from the highest authorized stable using the same check.
- Move the policy into config/scripts/release-policy.mjs with tests.
Release events run the workflow file from the tag's commit, so checking out
the default branch could pair an old workflow with a newer module.
@AmethystLiang
AmethystLiang merged commit 95a16e3 into main Sep 28, 2026
20 checks passed
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