install: name satisfies_dependency_version's range-side arguments after the dependency - #39127
Conversation
…er the dependency Resolution::satisfies_dependency_version took `version` (a dependency::Version, the declared range) and `version_buf`, and forwarded `version_buf` into Group::satisfies's `group_buf` slot while `resolution_buf` went into its `version_buf` slot. The call is correct: the dependency's range is the group and the resolution holds the concrete version. Only the names disagreed, so rename them to `dep_version` / `dep_version_buf`. Regenerate the bun_install section of mordant-baseline.toml. That drops the cleared arg_named_like_other_param entry for resolution.rs and the always_unwrapped_option entry for PackageInstall.rs, whose Option field was removed in #38271 after the baseline was recorded. No behavior change.
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
Comment |
|
Status: ready for review.
|
There was a problem hiding this comment.
LGTM — pure parameter rename to clear a mordant arg_named_like_other_param finding, plus baseline regen.
What was reviewed:
- Confirmed
Group::satisfies(&self, version, group_buf, version_buf)atsrc/semver/SemverQuery.rs:556—dep_version_bufcorrectly lands ingroup_bufandresolution_bufinversion_buf; argument order is unchanged. - All three callers (
PackageManagerEnqueue.rs:2915,:2933,lockfile/bun.lock.rs:3414) pass positionally with the same buffer in both slots, so no caller updates needed. - Verified
walker: Option<...>no longer exists inPackageInstall.rs, so the droppedalways_unwrapped_optionbaseline entry is stale as described.
Extended reasoning...
Overview
This PR renames two parameters of Resolution::satisfies_dependency_version in src/install/resolution.rs from version/version_buf to dep_version/dep_version_buf, and updates the doc comment and function body accordingly. It also removes two entries from the [bun_install] section of mordant-baseline.toml: the arg_named_like_other_param:src/install/resolution.rs entry cleared by this rename, and a stale always_unwrapped_option:src/install/PackageInstall.rs entry whose underlying field was removed in a prior PR.
Security risks
None. This is a local identifier rename in a semver comparison helper plus a lint-baseline edit. No user input handling, no I/O, no allocation, no control-flow change.
Level of scrutiny
Low. The diff is a mechanical rename with zero behavior change: every call site inside the function body passes the renamed locals in exactly the same positional order as before (.satisfies(self.npm().version, dep_version_buf, resolution_buf) vs the old .satisfies(self.npm().version, version_buf, resolution_buf); likewise for the git/github .eql arms). I cross-checked the callee signature at SemverQuery.rs:556 and confirmed the mapping in the PR description is correct — the dependency's buffer is the group buffer, the resolution's buffer is the version buffer — so the lint was a naming collision, not a transposition bug.
Other factors
The three external callers all pass arguments positionally (and pass the same lockfile string buffer for both buffer slots), so the parameter rename cannot affect them. The second dropped baseline entry was verified stale by grepping PackageInstall.rs for walker.*Option — no matches. The PR description explicitly justifies the absence of a new test (no behavior change), which matches the repo's review guidance for pure renames. No prior human review comments to address; the only timeline entry is a coderabbit rate-limit notice.
|
Updated 11:05 AM PT - Aug 15th, 2026
❌ @robobun, your commit 39a754d has some failures in 🧪 To try this PR locally: bunx bun-pr 39127That installs a local version of the PR into your bun-39127 --bun |
There was a problem hiding this comment.
LGTM — pure parameter rename plus the matching mordant baseline entry removal; no behavior change.
What was reviewed
- Confirmed
Group::satisfiesatsrc/semver/SemverQuery.rs:556takes(version, group_buf, version_buf);dep_version_buf→group_bufandresolution_buf→version_bufpreserves the pre-rename argument order in all three arms. - All three callers (
PackageManagerEnqueue.rs:2915,:2933,lockfile/bun.lock.rs:3414) pass positional args with the same buffer in both slots, so the rename is invisible to them. - The dropped
arg_named_like_other_param:src/install/resolution.rsbaseline entry corresponds exactly to the renamed site.
Extended reasoning...
Overview
Two files touched: src/install/resolution.rs renames the version / version_buf parameters of Resolution::satisfies_dependency_version to dep_version / dep_version_buf (plus the doc comment), and mordant-baseline.toml drops the now-cleared arg_named_like_other_param:src/install/resolution.rs = 1 entry from the [bun_install] section. The function body is byte-for-byte identical modulo the identifier rename and rustfmt reflow of the git arm — every call passes the same expressions in the same positions as before.
Security risks
None. This is an identifier rename in a semver/git-repo comparison helper and a lint-baseline count file; no input handling, allocation, or control-flow changes.
Level of scrutiny
Low. Mechanical rename to satisfy a lint that flags same-typed adjacent parameters where a caller-side name matches the other parameter. I verified against Group::satisfies's actual signature that the pre-existing argument order was already correct (the dependency's range buffer goes to group_buf, the resolution's buffer to version_buf), so the rename clarifies without swapping. The three call sites are all positional and unaffected. This matches the pattern of several recently-merged mordant cleanups (#39117, #39118, #39130, #39137).
Other factors
The PR description mentions a second baseline entry (always_unwrapped_option:src/install/PackageInstall.rs) also being dropped, but the final diff after merging main only removes the one line — that stale entry appears to have been cleared on main already, so the description is slightly out of date but the diff is consistent. No new test is expected per REVIEW.md since there is no behavior change to observe. The bug hunting system found nothing.
Problem
arg_named_like_other_paramflagssrc/install/resolution.rs:34:version_bufis passed asGroup::satisfies'sgroup_bufparameter, andsatisfiesalso has aversion_bufparameter of the same type (satisfies(version, group_buf, version_buf)insrc/semver/SemverQuery.rs:556).Resolution::satisfies_dependency_version,versionis adependency::Version(the declared range, which is the group), so its buffer belongs ingroup_buf;selfis the resolution holding the concrete version, soresolution_bufbelongs insatisfies'sversion_buf. The git and github arms agree (selfislhswithresolution_buf, the dependency isrhswith its own buffer). The two vocabularies just collide on the wordversion.PackageManagerEnqueue.rs:2915,:2933,lockfile/bun.lock.rs:3414) pass the same lockfile string buffer in both slots, so a swap would not have been observable there either way.Fix
dep_version/dep_version_buf.resolution_bufis unchanged. No behavior change, so no new test.[bun_install]section ofmordant-baseline.toml(MORDANT_BASELINE_WRITE=1 cargo dylint --all -p bun_install --no-deps). Besides the clearedarg_named_like_other_param:src/install/resolution.rsentry, this dropsalways_unwrapped_option:src/install/PackageInstall.rs: thewalker: Option<Walker>field it counted was removed in install: let the walker own the cache dir it walks and build InstallDirState in one go #38271, which landed after the baseline was recorded in ci: bump the mordant pin (sixteen new lints) and record their baseline #38846.cargo dylint --all -p bun_install --no-deps(the pinned mordant) with this baseline: no findings. With the rename reverted and the same baseline, it reports exactly theresolution.rs:34finding as over the baseline, so the baseline edit and the rename match.bun bdbuilds; the three callers' paths pass on it:bun bd test test/cli/install/test-dev-peer-dependency-priority.test.ts(4/4),test/cli/install/bun-lock.test.ts(40/40, peer resolution while loading bun.lock),test/cli/install/bun-install-patch.test.ts(20/20, patched package lookup).Background
Group::satisfies(version, group_buf, version_buf)tests a concrete semver version against a parsed range (the "group"). Both sides store their string pieces (prerelease and build tags) as offsets into a byte buffer, which is why each side passes the buffer that backs it.mordant-baseline.tomlis the ratchet for the mordant lint pack: it records the per-(lint, file) finding counts that predate the job, so CI fails only on new findings. Fixing a site means its entry goes away; entries whose findings were fixed without touching the file (like thePackageInstall.rsone) are harmless but stale until the section is regenerated.