Skip to content

ci: stop contacting live registries in publish dry-runs - #211

Merged
scarmuega merged 2 commits into
mainfrom
ci/local-only-publish-dry-runs
Aug 18, 2026
Merged

ci: stop contacting live registries in publish dry-runs#211
scarmuega merged 2 commits into
mainfrom
ci/local-only-publish-dry-runs

Conversation

@scarmuega

Copy link
Copy Markdown
Member

publish-node and publish-haskell fail on every pull request. They are the only two publish jobs whose dry-run mode contacts a live package registry; rust, python, go and dotnet validate locally and pass.

This is independent of #209 and #210 — it reproduces on #210, which contains nothing but a one-line workflow permissions change.

node

npm publish --dry-run still asks the registry whether the version exists:

npm error You cannot publish over the previously published versions: 0.19.2.

The version in gen/node/package.json only changes at release time, so it matches what is already on npm for all but a brief window after each bump.

npm 10 never made that request. Verified directly:

$ npx npm@10 publish --dry-run   # @utxorpc/spec 0.19.2
npm notice Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)   → exit 0

$ npx npm@11 publish --dry-run   # identical package.json
npm error You cannot publish over the previously published versions: 0.19.2.  → exit 1

#204 moved this job from node-version: 20.11.0 to 24.5.0 for trusted publishing — npm 10.2.4 to npm 11.5.1. The command was never touched; its behaviour changed underneath it. Because that same PR also broke pr-check.yml at startup (#210), the job never ran on a pull request again and the regression stayed invisible.

npm pack --dry-run does the same packing and manifest validation without the registry round-trip.

haskell

stack upload --candidate is not a simulation — it pushes a real candidate release to Hackage from unreviewed pull request code. Beyond being wrong on its own terms, it fails:

Error: [S-2804] forbidden upload
       Usually means: you've already uploaded this package/version combination.
       Ignoring error and continuing.
       Package name and version already exist in the database
Error: [S-6108] unhandled status code: 404
       Upload failed on utxorpc-0.0.19.2-docs.tar.gz

Note stack ignores the rejected tarball upload. The fatal error is the second command, stack upload --candidate -d ., which posts haddocks to the candidate URL. Hackage currently has candidates only up to 0.0.18.1; there is none for any 0.0.19.x:

/package/utxorpc-0.0.18.1/candidate → 200
/package/utxorpc-0.0.19.0/candidate → 404
/package/utxorpc-0.0.19.2/candidate → 404

So the docs upload has no candidate to attach to and 404s. This job last passed on 2026-05-01 at 12:35 UTC; the cabal version moved to 0.0.19.0 at 16:17 UTC that day and Hackage published it at 16:30 UTC. The next pull request, 2026-05-05, failed on publish-haskell alone — and every one since.

The preceding steps already run stack test, stack sdist and stack haddock --haddock-for-hackage, which is every check a pull request needs, so the candidate upload is dropped rather than replaced.

Scope

Releases are untouched. Both real uploads live in the release branches of these actions:

  • node: npm publish --access public under inputs.mode == 'release'
  • haskell: stack upload --test-tarball . under inputs.mode == 'release' && startsWith(github.ref, 'refs/tags/v')

The only behaviour lost is the candidate upload that ran during release.yml's pre-flight dry-run stage, which the real upload immediately superseded.

Verifying

This PR is its own test — publish-node and publish-haskell should both go green, which no pull request has managed since 2026-05-01. Requires #210 to be on the branch or merged first, otherwise pr-check.yml never starts.

🤖 Generated with Claude Code

scarmuega and others added 2 commits August 18, 2026 14:39
The node and haskell dry-runs are the only two that reach a real registry,
and both fail on every pull request as a result.

`npm publish --dry-run` still asks npm whether the version already exists, so
it passes only in the window between a version bump landing on main and the
release that publishes it. Outside that window it reports "You cannot publish
over the previously published versions". npm 10 never made that request, which
is why this was invisible until #204 moved the job from node 20.11.0 to 24.5.0
and with it from npm 10 to npm 11. `npm pack` does the same packing and
manifest validation locally.

`stack upload --candidate` is not a simulation at all: it pushes a real
candidate release to Hackage from unreviewed pull request code. It fails once
the cabal version has been published, because stack ignores the rejected
tarball upload and then 404s uploading haddocks to a candidate that does not
exist. The preceding steps already run `stack test`, `stack sdist` and
`stack haddock --haddock-for-hackage`, so nothing is lost by dropping it.

Releases are unaffected: both real uploads live in the `release` branches of
these actions and are untouched.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
`pr-check.yml` has failed at startup on every pull request since #204 merged
on 2026-05-19. The last run that actually executed was 2026-05-13.

#204 added `permissions: id-token: write` to publish-all's `publish-node` job
for npm trusted publishing. A reusable workflow cannot request more permission
than its caller grants, and `pr-check.yml` caps the whole workflow at
`contents: read`, so the call is rejected before any job starts.

`release.yml` and `dry-run.yml` declare no top-level `permissions` block, so
they inherit the repository default and were unaffected — which is why releases
kept publishing while PR validation was silently dead.

Granted on the calling job rather than workflow-wide, so the `codegen` job
keeps the narrower `contents: read`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
(cherry picked from commit 8fbbfa5)
@scarmuega
scarmuega merged commit b122b7c into main Aug 18, 2026
7 checks passed
@scarmuega
scarmuega deleted the ci/local-only-publish-dry-runs branch August 18, 2026 18:05
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