Bump the version before testing and building, not after - #150
Merged
Merged
Conversation
v0.4.0 published a bundle that reports 0.3.0. cut-release.yml ran the
tests and the build, and only then npm version, so the artifact it
published was built from the pre-bump tree: package.json said 0.4.0
while SDK_VERSION, baked into the bundle, still said 0.3.0. That string
is what a webBLEDemos page logs at startup to say which build it is
running - the one way to tell a stale vendored copy from a firmware
fault - so the release made the bundle lie about itself. It also left
main red, src/version.ts never having moved.
tests/core/version.test.ts exists to catch precisely this drift ("bump
both together"), and could not: it ran against the tree as it was before
the bump.
So the bump comes first and carries src/version.ts with it, stamped from
package.json and verified, before the tests and the build run against
the version actually being released. The commit and tag are made
afterwards, from the tested tree, rather than by npm version before it.
The parity test now guards the release instead of watching it go by.
src/version.ts moves to 0.4.0 here, which is what main should have said
since the release, and makes the suite green again: 1889 pass.
The published v0.4.0 artifact cannot be corrected in place. The changelog
says so and points at 0.4.1.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review for a one-time review, or @claude review always to subscribe this PR to a review on every future push.
Tip: disable this comment in your organization's Code Review settings.
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.
mainis red and the publishedv0.4.0bundle reports0.3.0. Both comefrom the same ordering bug in
cut-release.yml, which the v0.4.0 release(dispatched an hour ago) was the first to exercise since v0.1.7.
What happened
The workflow ran the tests, then the build, and only then
npm version. So theartifact it published was built from the pre-bump tree:
package.json→0.4.0SDK_VERSION, baked into the bundle → still0.3.0SDK_VERSIONis what a webBLEDemos page logs at startup to say which build itis running — by the comment in
src/version.ts, "a stale vendored copy isotherwise indistinguishable from a firmware fault". The release made the bundle
lie about itself. It also left
mainfailing, becausesrc/version.tsnevermoved:
That test exists to catch exactly this drift, and could not: it ran against the
tree as it was before the bump.
The fix
The bump comes first and carries
src/version.tswith it — stamped frompackage.jsonwithsed, then verified withgrepso a rename of the constantfails the release loudly rather than silently shipping a stale string. Tests and
build then run against the version actually being released, and the commit and
tag are made afterwards from that tested tree (
npm version --no-git-tag-versionplus an explicit commit and annotated tag, instead of letting
npm versioncommitbefore anything has been checked).
src/version.tsmoves to0.4.0here — whatmainshould have said since therelease — which makes the suite green again: 1889 pass.
What this does not fix
The published
v0.4.0artifact still self-reports0.3.0and cannot becorrected in place.
CHANGELOG.mdsays so under[0.4.1]and points at thenext release. Nothing should vendor
v0.4.0; I have held the re-vendor of bothconsoles until
v0.4.1exists, so no consumer ever carries the mislabelledbuild.
After merging
Cut Release → patch →
v0.4.1. That release then also proves the fixedordering: if the stamp fails, the run fails before publishing anything.
🤖 Generated with Claude Code