Skip to content

fix(version): honor CLI_VERSION define under Bun 1.4.0 - #434

Closed
rafa-thayto wants to merge 1 commit into
mainfrom
rafa-thayto/version-define-bun-1.4
Closed

fix(version): honor CLI_VERSION define under Bun 1.4.0#434
rafa-thayto wants to merge 1 commit into
mainfrom
rafa-thayto/version-define-bun-1.4

Conversation

@rafa-thayto

Copy link
Copy Markdown
Contributor

Summary

CI started failing on every PR today: the 3 compiled version tests in version.test.ts fail because setup-bun now resolves >=1.3.13 to the freshly released Bun 1.4.0, which no longer substitutes --define globals during macro execution. The typeof CLI_VERSION guard inside version.macro.ts therefore always saw undefined, and compiled binaries ignored the injected version and reported the checkout-derived dev version. This would also have broken the next release build (binaries reporting 3.1.0-dev.*, flipping IS_DEV_BUILD behaviors: keychain namespace, update-check suppression).

Fix: the macro no longer reads CLI_VERSION at all — it returns only the checkout-derived fallback string. The define check and the one-line dev classification now live in version.ts module code, where --define still folds reliably on both 1.3.x and 1.4.0. .claude/rules/versioning.md updated to match.

Repro (before this fix): bunx bun@1.4.0 test packages/cli-core/src/lib/version.test.ts fails 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.0
  • bun run lint, typecheck, test (2653 pass) green

Note: PR #433 is red on CI solely because of this — rerun it after this merges.

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-bot

changeset-bot Bot commented Aug 21, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8763ad9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
clerk Patch

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

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2ad04d4f-66a2-48a5-8c85-10d80347a48e

📥 Commits

Reviewing files that changed from the base of the PR and between 0a0130b and 8763ad9.

📒 Files selected for processing (4)
  • .changeset/version-define-bun-1-4.md
  • .claude/rules/versioning.md
  • packages/cli-core/src/lib/version.macro.ts
  • packages/cli-core/src/lib/version.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • clerk/clerk_go (manual)
  • clerk/dashboard (manual)
  • clerk/accounts (manual)
  • clerk/backoffice (manual)
  • clerk/clerk (manual)
  • clerk/clerk-docs (manual)
  • clerk/cloudflare-workers (manual)
  • clerk/javascript (auto-detected)

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.


📝 Walkthrough

Walkthrough

The version macro now returns only a checkout-based development version with optional Git metadata. Module code handles injected CLI_VERSION values and classifies development builds from prerelease suffixes. Versioning guidance documents this separation. A patch changeset records the Bun 1.4.0 fix for injected release versions in compiled binaries.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 8763a

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: wyattjoh

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (2 skipped: 2 unsupported.) Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the version fix that makes CLI_VERSION defines work under Bun 1.4.0.
Description check ✅ Passed The description directly explains the Bun 1.4.0 failure, the code change, and the reported validation results.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@rafa-thayto

Copy link
Copy Markdown
Contributor Author

Superseded by #435 — the same Bun 1.4 fix (CLI_VERSION define check moved out of the macro into version.ts module scope, macro reduced to the checkout fallback, versioning rule doc updated, patch changeset) landed on main in 432ea9f. Closing to avoid a duplicate changelog entry and rename churn.

@rafa-thayto
rafa-thayto deleted the rafa-thayto/version-define-bun-1.4 branch August 21, 2026 18:03
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.

2 participants