fix(release): don't require version field to start a line - #1511
Conversation
writeManifestVersion anchored on ^ + multiline, requiring the version field to open its own line. package.json always parses fine with JSON.parse regardless of formatting, but the anchor made the rewrite itself fragile - it hit the anchor-mismatch case on CI at least twice (2026-08-18, 2026-08-24), aborting the v1.x publish workflow with a false "no top-level version line" error. Match the fleet's own canonical scripts/fleet/bump.mts, which drops the anchor and matches the first "version": " occurrence anywhere in the manifest.
Bring writeManifestVersion to byte-for-byte parity with the fleet's
scripts/fleet/bump.mts replaceVersion: require at least one character in
the existing version (an empty version is as broken as a missing one)
and use a replacer function instead of a $1${version}$2 template, which
would mis-substitute if the derived version ever contained a literal $.
|
[agent] Follow-up commit brings Also worth noting while double-checking this: the canonical Separately: this PR's own merge state is currently |
|
[agent] Correction to my last comment: this PR's DetailsVerified directly - v1.x has no classic branch protection and its ruleset only enforces |
LLM Description written by Claude Code:Claude Sonnet 5
Summary
writeManifestVersioninscripts/release/bump.mtsrewritespackage.json's version field with/^(\s*"version":\s*")[^"]*(")/m- anchored to require the field to open its own line. That anchor is fragile: the v1.x publish workflow hit the mismatch on CI twice (2026-08-18, 2026-08-24), aborting the release with a false "no top-level version line" error even thoughJSON.parseon the exact same content resolvesversioncorrectly every time (confirmed by pulling the committedpackage.jsonat each failing run's exact commit SHA and testing the regex against it directly - it matches fine in isolation, so the anchor is failing against something in the CI-checked-out bytes that a plaingit showdoesn't reproduce).The fleet's own canonical
scripts/fleet/bump.mts(used bymainand every other fleet member) already solves this the same way this PR does: no^anchor, no/mflag, just match the first"version": "..."occurrence anywhere in the file.mainand other fleet repos were never at risk - onlyv1.x, which predates the fleet migration and still carries its own bespoke copy of this script.Changes
scripts/release/bump.mts: drop the anchor/multiline flag, matching the fleet-canonical patterntest/release-bump.test.mts: new coverage forwriteManifestVersion, including a minified-manifest case that reproduces the exact class of failure the old anchor was vulnerable toTest plan
pnpm run test:unit test/release-bump.test.mts- 3/3 passpnpm run test:unit test/release-version.test.mts- 29/29 pass (sibling suite unaffected)pnpm exec oxlinton touched files - 0 warnings/errorsNote
Low Risk
Narrow change to release-time string replacement plus tests; no auth, runtime CLI, or user data paths.
Overview
Fixes intermittent CI release failures where
writeManifestVersionfalsely reported it could not find a top-levelversioninpackage.jsoneven thoughJSON.parsesucceeded.The bump script now replaces the version with an unanchored regex that matches the first
"version": "…"anywhere in the file, instead of requiring that pattern at the start of a line (^+/m). That aligns with the fleet bump approach and handles minified or oddly formatted manifests that still parse as valid JSON.Adds
test/release-bump.test.mtswith unit tests for pretty-printed and minifiedpackage.json, plus the error path whenversionis missing.Reviewed by Cursor Bugbot for commit 09f7713. Configure here.