Skip to content

fix(cli): update no longer rolls back on a busy port; guard against stale npm publish - #16

Merged
hoaxnerd merged 1 commit into
mainfrom
fix/cli-update-port-gate-and-publish-guard
Jun 27, 2026
Merged

fix(cli): update no longer rolls back on a busy port; guard against stale npm publish#16
hoaxnerd merged 1 commit into
mainfrom
fix/cli-update-port-gate-and-publish-guard

Conversation

@hoaxnerd

Copy link
Copy Markdown
Owner

Two defects surfaced while smoke-testing the v0.3.0 release (install paths 1–3). Both are fixed here and shipped as v0.3.1.

Defect B — burnless update rolls back for anyone with a running instance

update execs the new version's doctor --json as its post-swap health gate. doctor exited non-zero whenever the port was in use — but during an in-place update the old instance still holds the port, so every update-while-running failed its gate and rolled back to the prior version.

Fix: the port and secrets_key checks are now non-fatal (fatal:false) — surfaced but never fatal for the health probe — so doctor exits 0 on a busy port (shown as , not ). start keeps its own hard port enforcement (it must bind), so a busy port still blocks start. Because the gate execs the new fat-artifact's doctor, this unblocks existing 0.2.x / 0.3.0 users updating to 0.3.1.

Proof: the built 0.3.1 fat artifact's doctor --json against a busy port now exits 0 (node/db/secrets/port all reported; port fatal:false).

Defect A — npm shipped a stale dist/

burnless@0.3.0 published with package.json = 0.3.0 but compiled dist/ built from 0.2.1 source. The manual npm publish bypassed CI's verify-npm-package.sh, and there was no prepublishOnly to force a rebuild.

Fix: add prepublishOnly that rebuilds then asserts the built CLI's reported version equals package.json (scripts/assert-dist-version.mjs). A manual publish can no longer ship stale/mislabeled dist/.

Guards (so it doesn't happen again)

  • Regression test: a busy port stays non-fatal, and the hasFatalFailure post-swap contract.
  • Unit test tying CLI_VERSIONpackage.json (catches a forgotten bump in CI).
  • prepublishOnly rebuild + version-drift assertion (catches a stale built dist at publish time).

Verification

  • CLI suite: 258 passing; type-check clean.
  • assert-dist-version.mjs passes against the fresh build (reports 0.3.1).
  • Fat-artifact doctor exits 0 on a busy port (the exact post-swap command).

Release steps after merge

Same ritual as v0.3.0: tag v0.3.1 → workflow drafts the release → publish the draft → npm publish (now guarded by prepublishOnly).

🤖 Generated with Claude Code

…tale npm publish

Two defects found while smoke-testing the v0.3.0 release:

B) `burnless update` ran the new version's `doctor --json` as its post-swap
   health gate, and `doctor` exited non-zero whenever the port was in use.
   During an in-place update the OLD instance still holds the port, so every
   update-while-running spuriously failed and rolled back. Fix: the port and
   secrets_key checks are now non-fatal (`fatal:false`) — reported but never
   fatal for the health probe — so `doctor` exits 0 on a busy port. `start`
   keeps its own hard port enforcement, so a busy port still blocks `start`.
   The fix lives in the fat-artifact doctor, which is what the gate execs, so
   it unblocks existing 0.2.x/0.3.0 users updating to a fixed version.

A) burnless@0.3.0 shipped to npm with a stale dist/ (0.2.1 code under a 0.3.0
   package.json): the manual `npm publish` path bypassed CI's
   verify-npm-package.sh and there was no prepublishOnly to force a rebuild.
   Fix: add prepublishOnly that rebuilds then asserts the built CLI's reported
   version equals package.json (scripts/assert-dist-version.mjs), so a manual
   publish can no longer ship stale/mislabeled dist.

Guards: regression test that a busy port stays non-fatal + hasFatalFailure
contract; a unit test tying CLI_VERSION to package.json (forgotten-bump catch).

Bumps the CLI to 0.3.1 (0.3.0 is consumed on npm and cannot be republished).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@hoaxnerd
hoaxnerd merged commit 5a79c8f into main Jun 27, 2026
14 checks passed
@sonarqubecloud

Copy link
Copy Markdown

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