Repository navigation
Let the release parse a multi-stage Dockerfile - #39
Merged
Merged
Conversation
The v0.3.0 release failed in ten seconds with no output. The step that proves the build image is pinned by digest reads the first line: read -r instruction image < Dockerfile [[ "$instruction" == FROM && "$image" =~ ^node:...@sha256:[a-f0-9]{64}$ ]] With two variables the second takes the rest of the line, so since the TypeScript conversion made the Dockerfile multi-stage the value tested was node:26-bookworm-slim@sha256:cd9f68... AS build which the anchored pattern can never match. set -e then exits 1 without printing anything, which is why the failure named nothing. The read now takes the stage alias as its own words and validates it: either there is no alias, or it is exactly AS followed by one name. Absorbing the remainder silently would have fixed the symptom by weakening the check that a release build is pinned. This was invisible until a tag push because the guard lives only in the release workflow, which nothing else runs. A test now applies the same parse to the Dockerfile in npm run verify, and asserts the workflow still splits the line the same way, so the two cannot drift. Both failure modes are covered: a malformed alias fails the first assertion, and reverting the workflow's read fails the second. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WrwFcAcntyBBSk21irvgAV
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.
Problem and change
The v0.3.0 release failed in ten seconds with no output at all — not even docker's.
The step that proves the build image is pinned by digest reads the first line of the Dockerfile:
readwith two variables gives the second one the rest of the line. Since the TypeScript conversion made the Dockerfile multi-stage, the value actually tested was:which a
$-anchored pattern can never match.set -ethen exits 1 silently — which is exactly why the failure named nothing and looked like an infrastructure problem.The read now takes the stage alias as its own words and validates it: either there is no alias, or it is exactly
ASfollowed by one name.Absorbing the remainder into a throwaway variable would have fixed the symptom by weakening the check that a release build is digest-pinned. The point of the guard is supply-chain integrity, so it validates what it now skips over.
Why this reached a tag at all. The guard exists only in the release workflow, which nothing but a tag push runs.
npm run verifyhad no opinion about it, so a Dockerfile change and its guard could drift apart invisibly. A test now applies the same parse in CI, and asserts the workflow still splits the line the same way — so the two can't diverge again.Verification
I confirmed the fixed guard accepts the real Dockerfile by running the exact shell:
And that the new test catches both ways this can break:
Every
run:block still passesbash -n.Not verified: as always, the release workflow only runs on a tag push. This is the fourth distinct failure on the path to a first publish, and each one was only observable from a tag — which is the underlying problem, not any individual bug.
Compatibility and security
Workflow and one test. No runtime, API, YAML or CLI change.
The digest pin is not relaxed: the image must still be
node:<tag>@sha256:<64 hex>, and the stage alias is now checked rather than ignored.No change to provenance, signing, publishing order or the
PUBLISH_NPM/NPM_TOKENguard.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