Skip to content

install: print version before package name in the minimum-release-age error - #37895

Open
robobun wants to merge 1 commit into
mainfrom
farm/b7872bb3/min-release-age-error-arg-order
Open

robobun wants to merge 1 commit into
mainfrom
farm/b7872bb3/min-release-age-error-arg-order

Conversation

@robobun

@robobun robobun commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • When --minimum-release-age (or install.minimumReleaseAge) blocks every version that satisfies a dependency, bun install prints the package name and the requested version in each other's slots: No version matching "regular-package" found for specifier "3.0.0" (blocked by minimum-release-age: 432000 seconds).
  • The neighbouring (but package exists) error fills the same template the other way round, so the two errors a user can get for one dependency disagree.
  • Cause: the age-gate branch passes the two format arguments in the opposite order to the branch beside it. It has been this way since bun install: support for minimumReleaseAge #22801, and this is the only place the message is produced.

Fix

  • Swap the two arguments. The message now reads No version matching "3.0.0" found for specifier "regular-package" (blocked by minimum-release-age: 432000 seconds).
  • Property to check: in both errors the first slot is what a version had to match and the second is the package name. The dist-tag variant already had that shape and is untouched.
  • Verification: the tests that matched this error with a loose regex now pin the full text against the mock registry; the three age-gate assertions fail without the change and pass with it.

Background

  • --minimum-release-age N makes install ignore versions published less than N seconds ago. If nothing that satisfies the dependency remains, install fails rather than taking a newer version.
  • One template, No version matching "X" found for specifier "Y", serves both "nothing satisfies X" and "the age gate blocked everything that does"; only the trailing parenthetical differs.
  • A dependency written as a dist-tag (latest) fails through a separate message naming the package and tag, so it is not affected.
Original description

What

When --minimum-release-age (or install.minimumReleaseAge) blocks every version that satisfies a range, bun install printed the package name and the range in the wrong slots:

error: No version matching "regular-package" found for specifier "3.0.0" (blocked by minimum-release-age: 432000 seconds)

The sibling error for a range that nothing satisfies fills the same template the other way around, and that is the order the rest of the install tests already assert on (bun-install.test.ts, bun-install-registry.test.ts):

error: No version matching "^9" found for specifier "regular-package" (but package exists)

After this change the age-gate variant reads the same way:

error: No version matching "3.0.0" found for specifier "regular-package" (blocked by minimum-release-age: 432000 seconds)

Why

The first slot of the template is the thing a version has to match, so it can only sensibly hold the requested version or range; the TooRecentVersion branch in PackageManagerEnqueue.rs passed name there and version.literal second. The NoMatchingVersion branch a few lines above passes them the other way around, so the two errors a user sees for the same dependency disagreed with each other. The dist-tag variant (Package "x" with tag "latest" not found (all versions blocked ...)) was already in the right order and is unchanged. This has been the case since the feature landed in #22801; it is the only place the message is produced, and nothing else in the repo (docs, other tests) depends on the old order.

Repro

# registry serves regular-package 1.0.0 (30 days old) and 3.0.0 (1 day old)
echo '{"dependencies":{"regular-package":"3.0.0"}}' > package.json
bun install --minimum-release-age 432000

Fix

Swap the two format arguments in the TooRecentVersion branch of enqueue_dependency_with_main_and_success_fn so they line up with the template and with the NoMatchingVersion branch.

Tests

test/cli/install/minimum-release-age.test.ts only matched this error with a loose regex. It now pins the full text for:

  • an exact version that is too recent (FindVersionError::TooRecent), fails before this change
  • a range whose every match is too recent, both ^2.1.0 and * (FindVersionError::AllVersionsTooRecent), fails before this change
  • the dist-tag variant and the (but package exists) variant, whose order was already correct, so the three messages are asserted side by side
USE_SYSTEM_BUN=1 bun test test/cli/install/minimum-release-age.test.ts   # 3 fail (the three age-gate assertions), 48 pass
bun bd test test/cli/install/minimum-release-age.test.ts                 # 51 pass

… error

The TooRecentVersion error for a version range shares its template with
the NoMatchingVersion error ("No version matching X found for specifier
Y") but filled the slots in the opposite order, so it printed the package
name where the range belongs:

  No version matching "regular-package" found for specifier "3.0.0" (blocked by minimum-release-age: 432000 seconds)

Pass the arguments in the same order as the sibling error so it reads:

  No version matching "3.0.0" found for specifier "regular-package" (blocked by minimum-release-age: 432000 seconds)

Pin the exact text in minimum-release-age.test.ts for the exact-version
and range cases, and for the two sibling errors (dist-tag all blocked,
range with no match) whose order was already right.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@robobun, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 3 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9d751afb-a008-4a0c-86e0-92aeefa61da7

📥 Commits

Reviewing files that changed from the base of the PR and between 9a543cc and f26001c.

📒 Files selected for processing (2)
  • src/install/PackageManager/PackageManagerEnqueue.rs
  • test/cli/install/minimum-release-age.test.ts

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

@robobun

robobun commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator Author

Status: reproduced and fixed, waiting on CI.

Reproduced with the released build by running the pinned assertions in test/cli/install/minimum-release-age.test.ts (USE_SYSTEM_BUN=1 bun test ...): the exact-version, ^2.1.0 and * cases print No version matching "<name>" found for specifier "<range>". With the debug build all 51 tests in the file pass.

Review so far: the automated review came back without findings, so there is nothing outstanding on the diff.

@robobun

robobun commented Aug 12, 2026 •

Copy link
Copy Markdown
Collaborator Author
Updated 3:05 PM PT - Aug 12th, 2026

❌ @robobun, your commit f26001c has 3 failures in Build #93411 (All Failures):


🧪   To try this PR locally:

bunx bun-pr 37895

That installs a local version of the PR into your bun-37895 executable, so you can run:

bun-37895 --bun

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — two-argument swap in the error format string, matching the sibling NoMatchingVersion branch.

What was reviewed:

  • Confirmed the (but package exists) branch at PackageManagerEnqueue.rs:803-805 already passes version.literal then name; this change makes TooRecentVersion consistent.
  • Grepped for other consumers of the old message order — only this file and the test file reference it.
  • Test changes tighten loose regexes to exact strings and add the ^2.1.0 range and dist-tag variants; new tests drain stdout/stderr concurrently and assert stderr before exitCode.
Extended reasoning...

Overview

The PR swaps two positional format arguments in the TooRecentVersion error branch of enqueue_dependency_with_main_and_success_fn (src/install/PackageManager/PackageManagerEnqueue.rs) so the version literal fills the "No version matching …" slot and the package name fills the "for specifier …" slot — the same order the adjacent NoMatchingVersion branch already uses. The test file replaces three loose toMatch(/…/) assertions with exact toContain strings and adds two new tests covering the ^2.1.0 range and the dist-tag variant, so all three related error messages are pinned side by side.

Security risks

None. This is a cosmetic reordering of interpolated values in a user-facing error string; no input handling, allocation, or control flow changes.

Level of scrutiny

Low. The native change is a two-line argument transposition with no type changes, and I verified against the current tree that the sibling branch (lines 803-805) uses exactly the order this PR adopts. A grep for the message text confirms nothing else in the repo (docs, other tests) asserts on the old order. The test additions follow the repo's conventions (await using on spawn, Promise.all for pipe draining, stderr asserted before exitCode, exact strings instead of regex).

Other factors

The PR description records that USE_SYSTEM_BUN=1 fails the three new pinned assertions and the debug build passes all 51, so the tests are load-bearing. No prior human review comments to address; the only timeline entries are a CodeRabbit rate-limit notice and the author's status update.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants