fix(version): honor CLI_VERSION define under Bun 1.4.0 - #434
Conversation
Bun 1.4.0 stopped substituting --define globals inside macro execution, so the typeof CLI_VERSION guard in version.macro.ts always saw undefined and every compiled binary reported the checkout-derived dev version. Move the define check and dev classification into version.ts module code (where defines still fold) and let the macro return only the checkout fallback string.
🦋 Changeset detectedLatest commit: 8763ad9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
Included review availability: 8 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour. 📝 WalkthroughWalkthroughThe version macro now returns only a checkout-based development version with optional Git metadata. Module code handles injected Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This localized change moves CLI version handling to the reliable module-level path for Bun 1.3.x and 1.4.0, with the stated test suite and checks passing; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Summary
CI started failing on every PR today: the 3
compiled versiontests inversion.test.tsfail because setup-bun now resolves>=1.3.13to the freshly released Bun 1.4.0, which no longer substitutes--defineglobals during macro execution. Thetypeof CLI_VERSIONguard insideversion.macro.tstherefore always sawundefined, and compiled binaries ignored the injected version and reported the checkout-derived dev version. This would also have broken the next release build (binaries reporting3.1.0-dev.*, flippingIS_DEV_BUILDbehaviors: keychain namespace, update-check suppression).Fix: the macro no longer reads
CLI_VERSIONat all — it returns only the checkout-derived fallback string. The define check and the one-line dev classification now live inversion.tsmodule code, where--definestill folds reliably on both 1.3.x and 1.4.0..claude/rules/versioning.mdupdated to match.Repro (before this fix):
bunx bun@1.4.0 test packages/cli-core/src/lib/version.test.tsfails the 3 compiled-version tests on plain main; Bun 1.3.14 passes.Test plan
bun test version.test.ts: 9/9 pass on Bun 1.3.14 AND Bun 1.4.0bun run lint,typecheck,test(2653 pass) greenNote: PR #433 is red on CI solely because of this — rerun it after this merges.