Skip to content

Make a release recoverable without deleting the tag - #36

Merged
jimhoyd merged 1 commit into
mainfrom
claude/tender-gates-13ovkk
Sep 17, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/tender-gates-13ovkk

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

Three v0.2.0 attempts have each burned a tag. The cause is step order, not any one bug:

Sign provenance  →  Publish the GitHub release  →  Publish to npm  →  GHCR
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^      ^^^^^^^^^^^^^^
                    succeeds first                  the step that actually fails

npm publish is the credential-dependent step. It failed on a tarball path npm read as a GitHub repo, and then on EOTP — a token that demands an interactive one-time password. Each time the GitHub release had already been created, so the run left a published release advertising a package that does not exist, with a urlcode.rb pointing at a registry URL that 404s. Recovery meant deleting the release, deleting the tag, and tagging again — and a re-run could not help, because it would trip over the release its own earlier attempt created.

npm publish now runs first. With nothing created before it, a failure there leaves nothing to undo: delete the tag, or just fix the credential and re-run.

Both publishing steps now tolerate having already run:

  • npm skips a version already on the registry. A published version can never be replaced, so the one irreversible step must not fail the rest of the release.
  • The release step uploads over an existing release instead of refusing to create it.

Together, a re-run finishes a partly completed release instead of failing.

Re-uploading assets is safe, and I checked rather than assumed. npm pack is byte-reproducible at a commit — two packs of this tree produced the identical sha256:

49f925c5030c730b2bd538e9d119efddbb1c721b1893450f7d4a16aa207dbc1f  a/urlcode-0.2.0.tgz
49f925c5030c730b2bd538e9d119efddbb1c721b1893450f7d4a16aa207dbc1f  b/urlcode-0.2.0.tgz

So the tarball a re-run rebuilds cannot contradict what an earlier attempt published, and the formula's measured checksum stays true against the npm tarball it names. Had npm pack been non-deterministic, --clobber would have been a correctness bug — a release asset silently disagreeing with the published package.

Verification

npm run verify   # 270 tests, 0 fail, 29 skipped

Both new tests cover the invariant, not the wording. I confirmed each fails on the regression it names:

# order reverted
not ok 7 - the release publishes to npm before creating the GitHub release
  error: 'the GitHub release is created before npm publish runs'

# registry check removed
not ok 8 - a re-run of a partly finished release completes it instead of failing
  error: 'npm publish does not check whether the version is already on the registry'

The workflow parses as YAML and every run: block passes bash -n, since reordering steps and restructuring shell is exactly where a silent syntax error would hide.

Not verified: the release workflow only runs on a tag push, so this cannot be exercised before merging. The next tagged run is the proof.

Compatibility and security

  • Workflow and tests only. No runtime, API, YAML or CLI change.
  • Provenance, signing and attestation are untouched and still run on the candidate before anything is published.
  • The PUBLISH_NPM / NPM_TOKEN guard is unchanged: publishing stays off unless the variable is set, and an empty token still fails loudly.
  • The skip is scoped to an exact name@version already on the registry. It cannot mask a failed publish of a version that is not there.

Separate from this PR, still outstanding: NPM_TOKEN currently holds a token that requires an OTP. A Granular Access Token or a classic Automation token bypasses 2FA; a classic Publish token does not. And the v0.2.0 tag and release need deleting once more before the next attempt — the last time, if this works.

  • Changes match the documented portable contract; docs/examples are updated where needed.
  • Relevant tests and package checks pass, or limitations are explained above.
  • No credentials, customer data or private project material are included.
  • Runtime/starter changes remain aligned where applicable.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WrwFcAcntyBBSk21irvgAV


Generated by Claude Code

Three v0.2.0 attempts have each burned a tag. The release job creates
the GitHub release before publishing to npm, so when the npm step
fails, as it has on a bad tarball path and then on an npm token that
demands an interactive OTP, the run leaves a published GitHub release
advertising a package that does not exist, with a Homebrew formula
pointing at a registry URL that 404s. Recovery meant deleting the
release, deleting the tag and tagging again, and a re-run could not
help because it would trip over its own release.

Publishing to npm now runs first. It is the credential-dependent step
and the one that fails; with nothing created before it, a failure
leaves nothing to undo.

Both publishing steps now tolerate having already run. npm skips a
version already on the registry, because a published version can never
be replaced and one irreversible step must not fail the rest of the
release. The release step uploads over an existing release instead of
refusing to create it. Together these make a re-run finish a partly
completed release rather than fail.

Re-uploading assets is safe because npm pack is byte-reproducible at a
commit: two packs of this tree produce the same sha256, so the tarball
a re-run rebuilds cannot contradict what an earlier attempt published,
and the rendered formula's checksum stays true.

Two tests cover the invariants rather than the text: reverting the
order fails the first with "the GitHub release is created before npm
publish runs", and removing the registry check fails the second.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WrwFcAcntyBBSk21irvgAV

jimhoyd commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

verify (windows-latest, 26) failed on 07c78c5, and it is not this PR's failure. Re-running that job once when the run finishes.

test at test\aws.test.js:65:1
✖ cookies arrive through the format 2.0 array and leave through it (29421.7621ms)
  + actual: []
  - expected: [ 'a=1', 'b=2' ]

Why it is not this change. The diff is .github/workflows/release.yml and test/release.test.js. Neither is loaded by test/aws.test.js.

  • GitHub queued two runs for this commit. The same job failed in one and passed in the other — identical code, same OS, same Node.
  • main at d3746ff, the base of this branch, passed with every Windows leg green.
  • Windows 22 and 24 passed here, as did every Ubuntu and macOS leg.

What is established about the failure, separately from this PR:

  • The handler returned an error, not the redirect. src/aws.js:79 is the only path that sets cookies: [], and that is the catch.
  • It took 29.4 s. A cookie assertion against an in-process handler does not take 29 seconds unless something upstream is waiting on a deadline.
  • The function pool is not involved: FunctionPool sets size = 0 when a project declares no function routes, and this fixture declares none, so no worker is spawned. (My first guess, checked and discarded.)
  • That leaves loadDocument, which terminates its configuration worker on a fixed 10 s deadline (src/config.js:84). 29 s elapsed is consistent with that deadline firing and activation failing. I could not fetch the raw log to read the error text, so treat this as the leading suspect rather than a proven cause.

If that is the cause it is the third instance of one bug class in this repo: a fixed activation deadline written as a hang-backstop but sized inside the variance of a loaded machine. src/link-store.js had the same shape at 5 s and was raised to 15 s in #28. The proposed patch would be the same treatment for the configuration deadline — a generous backstop, and an error that names the deadline it hit.

I am not making that change here. It is unrelated to release ordering, it would widen this PR, and it deserves its own reproduction and its own review. No test is being skipped or weakened.


Generated by Claude Code

jimhoyd commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Coordination note from the TypeScript conversion in #37, which the maintainer asked to roll into this release work.


Generated by Claude Code

@jimhoyd
jimhoyd merged commit 3a906dc into main Sep 17, 2026
34 of 35 checks passed
@jimhoyd
jimhoyd deleted the claude/tender-gates-13ovkk branch September 17, 2026 16:13

jimhoyd commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Follow-up to the coordination note: #37 (the TypeScript conversion) is now merged on top of this PR as 1637686. main now ships dist/ built at pack time, and the release workflow runs npm run build before verify and pack. For the next tag: v0.2.0 was cut from the JavaScript layout, so a re-tag of 0.2.0 would now produce a different tarball; the next release from main should be 0.3.0.


Generated by Claude Code

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.

2 participants