Skip to content

fix(release): skip versions whose release tag exists while npm stages them - #373

Merged
anandpant merged 1 commit into
mainfrom
fix/release-staged-publish-race
Oct 10, 2026
Merged

anandpant merged 1 commit into
mainfrom
fix/release-staged-publish-race

Conversation

@anandpant

@anandpant anandpant commented Oct 10, 2026 •

Copy link
Copy Markdown
Collaborator

What changed

  • Release guard (.github/workflows/release.yml): before asking npm, the guard checks whether the cli-v<version> tag already exists, and skips the release if it does. The tag job runs only after a successful publish, so the tag is the authoritative "already released" signal. If git ls-remote fails, the job fails rather than guessing.
  • Publish step: if npm publish fails with exactly E409 … Cannot publish over previously staged version "<this version>", it treats the version as published and continues to the tag and GitHub Release jobs. That covers a rerun after npm staged the publish but a later job failed. Any other error, including an E409 for a different version, still fails. The publish log goes to $RUNNER_TEMP, outside the package directory being published.
  • Tests (scripts/lib/release-workflow.test.mjs): runs the guard and publish steps exactly as written in the workflow, with git and npm stubbed. The cases cover a tag that exists while npm still reports 404, an untagged version missing from npm, a version npm already serves, both lookups failing closed, the staged E409 for this version, and other failures that must still fail. Run against the old workflow, the tag and staged-E409 tests fail; the other four pass.

Why

npm now stages trusted publishes: they wait for 2FA approval, then process. During that window, npm view sketchi@<version> returns 404. Run 38086249637 published 0.9.0 and pushed cli-v0.9.0. The next push to main (run 38086346671, for #368) saw the 404, tried to republish, and failed with E409 Cannot publish over previously staged version "0.9.0". npm view sketchi@0.9.0 still returns 404 while the tag exists. Releases are serialized by the release concurrency group, so a later run's guard always sees the earlier run's tag.

How it was verified

  • pnpm run test:deploy-scripts (the new release tests included)
  • actionlint on release.yml
  • pnpm run format:check
  • Oxlint on the new test

No changeset: this changes the release workflow, not the CLI.

Copy link
Copy Markdown
Collaborator Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • merge - adds this PR to the back of the merge queue
  • fast - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@anandpant
anandpant force-pushed the fix/release-staged-publish-race branch from c2ff654 to 194300c Compare October 10, 2026 21:38
@anandpant
anandpant marked this pull request as ready for review October 10, 2026 21:39
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Web Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Icons Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Playground / Studio Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Excalidraw Workspace Preview

Status: deleted

@github-actions

github-actions Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Sketchi Eval Harness Preview

Status: deleted

@anandpant
anandpant merged commit 1fe7e35 into main Oct 10, 2026
12 checks passed
@anandpant
anandpant deleted the fix/release-staged-publish-race branch October 10, 2026 21:47

This branch was successfully deployed

1 active deployment
staging — 194300c0 Deployed Oct 10, 2026 by anandpant via cleanup-preview (playground) #436
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