Repository navigation
docs(pm): make the dedupe / prune / audit fix / licenses / --filter / --catalog docs readable #38686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
docs(pm): make the dedupe / prune / audit fix / licenses / --filter / --catalog docs readable #38686
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 This drops a qualifier the old text had: an explicit exact version that already satisfies the existing catalog range (e.g.
bun add react@19.1.0 --catalogwith an entry of^19.0.0) does not replace the entry — peradd_catalog.rsexact_within→Outcome::Moved, the original range is written back and only the locked version moves. The same over-simplification is indocs/pm/catalogs.mdx("reused unless you pass an explicit version"). Consider e.g. "Pass a version outside the existing range to replace the entry".Extended reasoning...
What the new text says vs. what the code does
The rewritten bullet at
docs/pm/cli/add.mdx:113reads:and
docs/pm/catalogs.mdxnow says:Both are stated as unconditional. The old text this PR trimmed correctly said:
Code path
In
src/install/PackageManager/add_catalog.rs:edit_root_before_install(~lines 907–919): with an existing catalog entry andCandidate::Explicit(wanted), it writeswantedto the catalog for the install pass, then callsexact_within(wanted, &entry). If that returns true, the outcome isOutcome::Moved { entry }, which stores the original entry text.exact_within(~lines 851–862): parseswanted, callsgroup.get_exact_version(). Returns true only whenwantedis a single exact version and the existing entry's rangesatisfiesit.edit_root_after_install(~line 1077):Outcome::Moved { entry } => entry.to_vec(), and lines ~1109–1123 write that literal back into the root catalog.Net effect: when the user passes an exact version that already fits the existing entry, the catalog entry is not replaced — the original range is restored to the root
package.jsonand only the locked/installed version changes.Step-by-step example
"react": "^19.0.0".bun add react@19.1.0 --catalog, expecting the catalog entry to become19.1.0per the new doc.Candidate::Explicit("19.1.0"), existing entry"^19.0.0"→exact_within("19.1.0", "^19.0.0"):"19.1.0"parses to a single exact version viaget_exact_version(), and^19.0.0satisfies19.1.0→ true.Moved { entry: "^19.0.0" }.edit_root_after_installwrites"^19.0.0"back to the catalog.^19.0.0;bun.locknow has react@19.1.0. The doc's promised replacement did not happen.Note the doc's own inline example,
react@19, does replace the entry —19is a range, soget_exact_version()returnsNone,exact_withinis false, and the outcome isSeeded. The inaccuracy is only in the blanket claim, not the example.Why existing wording doesn't cover it
The PR description says "No behaviour documented in #38333 was changed, only trimmed", but this trim removed a load-bearing qualifier. Nothing else on either page mentions the exact-within-range case any more, so a user reading the new text has no way to learn that
react@19.1.0andreact@19behave differently against an existing^19.0.0entry.Impact
Documentation-only. Worst case: a user runs
bun add react@19.1.0 --catalogexpecting to pin the catalog to19.1.0, sees^19.0.0still there, and is confused. Nothing breaks at runtime; the common case (crossing the existing range, or passing a range like@19) behaves as documented.Fix
Restore the qualifier in a short form, e.g. in
add.mdx:and in
catalogs.mdx: