ci(npm-publish): make v1.x own the latest dist-tag - #1468
Merged
John-David Dalton (jdalton) merged 2 commits intoAug 3, 2026
Conversation
v1.x is the line customers consume, so it owns `latest` — the tag an untagged install resolves to. The guard ran inverted, refusing `latest` from this branch and reserving it for the default branch, which carries the 2.x prerelease line. The cost was visible on the package page: socket@latest sat on 1.1.147 for a week while 1.1.148 through 1.1.152, including a CVE bump, published under a staged side tag no untagged install resolves.
Comments state the present.
John-David Dalton (jdalton)
deleted the
jdalton/v1x-owns-latest-dist-tag
branch
August 3, 2026 17:58
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
v1.xis the line customers consume, so it should own thelatestdist-tag — the tag an untaggednpm install socketresolves to. The guard ran the other way, refusinglatestfrom this branch and reserving it for the default branch, which carries the 2.x prerelease line.The cost was visible on the package page.
socket@latestsat on 1.1.147 for a week while 1.1.148 through 1.1.152, including a commons-io CVE bump, published under astagedside tag that no untagged install ever resolves.What changed
The guard now compares the dispatched ref against
v1.xinstead of the repo's default branch, and logs the allow case so a passing run says why. The file header's step 4 said to pick a NON-latest dist-tag; it now saysdist-tag=latest. Thedist-taginput already defaulted tolatest, so that default becomes usable rather than something the guard immediately rejects.Dry runs are unaffected — they pass regardless of dist-tag because they upload nothing.
The matching half on the default branch
Our shared publish-workflow template now guards
latestto a consumable release line rather than to the default branch, and reads which branch that is from arelease.latestDistTagBranchsetting in this repo's own config. It defaults to the repo's default branch, so other repos sharing that template are unaffected. socket-cli declaresv1.x.That half is already on
main. This PR is the other half.Already done manually:
latestwas repointed to 1.1.152 and thestagedtag removed, sosocketnow carries a single dist-tag. Without this PR the next v1.x release would recreatestagedand still refuse to movelatest.Ran:
actionlintclean on the edited workflow.Did not run: no dispatch — the publish path is unchanged apart from which ref may request
latest.Note
Medium Risk
Changes which branch can publish npm's
latestdist-tag—a customer-facing install resolution path—but only tightens alignment with the intended release line and does not alter build/publish mechanics beyond the ref check.Overview
Fixes the npm publish guard so
dist-tag=latestis only allowed when the workflow runs fromv1.x, not from the repo default branch. Untaggednpm install socketresolves tolatest, so the consumable 1.x line should own that tag; the previous rule blockedv1.xfrom publishinglatestand left newer 1.x releases on side tags likestaged.The workflow header and step comments now describe this policy (2.x prerelease on default uses next/beta/canary/rc). The guard compares
github.reftorefs/heads/v1.x, logs whenlatestis allowed, and dry runs still skip the check because nothing is uploaded.Reviewed by Cursor Bugbot for commit 3eb8128. Configure here.