Skip to content

fix: do not crash when a catalog specifier is a range - #11706

Merged
zkochan merged 2 commits into
pnpm:mainfrom
shiminshen:fix/catalog-range-spec-update-crash
Jun 4, 2026
Merged

zkochan merged 2 commits into
pnpm:mainfrom
shiminshen:fix/catalog-range-spec-update-crash

Conversation

@shiminshen

@shiminshen shiminshen commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

pnpm update --recursive --lockfile-only <pkg>@<version> crashed with
Invalid Version: <range> when the catalog entry for <pkg> was a range
(e.g. ^21.2.10) and catalogMode was strict or prefer. This is the
exact command Renovate's pnpm artifact updater runs; monorepos using
catalog: with any range specifier were blocked from Renovate-driven
lockfile updates.

Root cause: in installSome, the catalog-match short-circuit guards
semver.eq(wantedDep.bareSpecifier, catalogDepSpecifier) with
semver.validRange on both sides. validRange returns truthy for ranges,
but semver.eq constructs new SemVer(...) internally and throws on a
range.

Fix: use semver.valid instead of semver.validRange on both sides of
the equality guard. Range specifiers now fall through to the existing
mismatch handling (CatalogVersionMismatchError in strict mode,
warn-and-use-direct in prefer mode) instead of crashing. Behavior for
concrete-on-both-sides is unchanged.

Closes #11570

Behavior after the fix

This turns a crash into pnpm's normal catalog-mismatch handling; it does
not make a strict-mode update succeed when the catalog is a range:

  • catalogMode: strict — rejects with ERR_PNPM_CATALOG_VERSION_MISMATCH
    (clean, actionable error instead of a stack trace).
  • catalogMode: prefer — warns and uses the direct version.
  • concrete-vs-concrete — unchanged (semver.eq still runs).

pacquet parity

The TypeScript fix patches a crash inside pnpm's catalogMode mismatch
gate — a feature pacquet had not ported at all (catalog-mode was in the
config parity test's NOT_PORTED list). Rather than just the one-liner,
this PR ports that gate to pacquet so the two stacks match:

  • config: new CatalogMode { Manual, Strict, Prefer } enum (default
    manual), Config.catalog_mode, wired through pnpm-workspace.yaml
    (catalogMode:) and the env overlay; catalog-mode moved from
    NOT_PORTED to a mapped row in the pnpm_default_parity contract test.
  • package-manager: check_catalog_mode + CatalogVersionMismatchError
    (ERR_PNPM_CATALOG_VERSION_MISMATCH), invoked from update before the
    manifest is mutated. The comparison only treats both sides as equal when
    each parses as a concrete semver version, so a ranged catalog entry falls
    through to the mismatch path instead of reaching an exact-version
    comparison — the Rust analogue of the semver.valid guard above.

The crash itself can't occur in pacquet (Rust's node-semver returns a
Result rather than throwing); the port is the feature with the
range-correct comparison built in, so pacquet behaves like fixed pnpm.

Not ported (the surrounding pieces pacquet still lacks, so wiring them
would diverge from pnpm rather than match it): the add-path cataloging
that relies on defaultCatalog rewriting, and the saveCatalogName →
pnpm-workspace.yaml auto-cataloging half. The gate is therefore wired
into update <pkg>@<version> / --latest (the Renovate scenario), not
add.

Test plan

TypeScript — added test('catalog specifier as a range does not crash with catalogMode: strict', ...) in
installing/deps-installer/test/catalogs.ts, asserting the call rejects
with ERR_PNPM_CATALOG_VERSION_MISMATCH. Full catalogs.ts suite passes
(45/45).

pacquet — 11 new tests:

  • 9 unit tests for check_catalog_mode (strict concrete mismatch, catalog-
    as-range and wanted-as-range, exact match, no catalog entry, runtime:
    skip, named catalog via previous specifier, manual no-op, prefer warns).
  • 1 catalogMode round-trip test from pnpm-workspace.yaml.
  • 1 end-to-end CLI test: pacquet update --lockfile-only <pkg>@<version>
    with a ranged strict catalog entry fails with
    ERR_PNPM_CATALOG_VERSION_MISMATCH (the Renovate scenario).

fmt, workspace clippy --deny warnings, cargo doc -D warnings,
dylint, and typos are all clean.


Written by an agent (Claude Code, claude-opus-4-8).

Summary by CodeRabbit

  • Bug Fixes

    • Fixed a crash when running update with workspace catalog entries given as semver ranges.
  • New Features

    • Added catalogMode (manual, strict, prefer) to control reconciliation of direct deps against workspace catalogs; strict rejects mismatches, prefer warns.
    • pnpm update now validates rewritten versions against workspace catalogs when catalogMode ≠ manual and reports mismatches with code ERR_PNPM_CATALOG_VERSION_MISMATCH.
    • Workspace YAML and env var support for catalogMode added.

@shiminshen
shiminshen requested a review from zkochan as a code owner May 17, 2026 16:38
@coderabbitai

coderabbitai Bot commented May 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: ecf38fed-0be7-4e2b-9b12-de6de987cea7

📥 Commits

Reviewing files that changed from the base of the PR and between 61c944d and a8f1a9c.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/Cargo.toml
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/update.rs
✅ Files skipped from review due to trivial changes (1)
  • pacquet/crates/package-manager/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (9)
  • pacquet/crates/package-manager/Cargo.toml
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/update.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (6)
  • GitHub Check: Lint and Test (macos-latest)
  • GitHub Check: Lint and Test (ubuntu-latest)
  • GitHub Check: Lint and Test (windows-latest)
  • GitHub Check: Doc
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Code Coverage
🧰 Additional context used
📓 Path-based instructions (1)
pacquet/**/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/*.rs: Log emissions are part of matching pnpm — when porting a function that fires pnpm:<channel> events through globalLogger, logger.debug(...), or streamParser.write(...), mirror the call site, payload, and ordering so @pnpm/cli.default-reporter parses pacquet's NDJSON the same way
Declare a newtype wrapper for branded string types instead of collapsing the brand into a plain String or &str in Rust
If upstream TypeScript always validates before construction of a branded string, validate in the Rust wrapper too via TryFrom<String> and/or FromStr and do not provide an infallible public constructor
If upstream TypeScript never validates a branded string, just brand for type-safety in Rust by exposing an infallible From<String> constructor
If upstream TypeScript occasionally constructs a branded string without validation, expose from_str_unchecked in Rust as an escape hatch alongside the validating constructor
Match upstream serde behavior for branded strings crossing JSON, YAML, or INI boundaries by using #[serde(try_from = "String")] for deserialization and #[serde(into = "String")] for serialization
Derive simple conversions for branded strings using #[derive(derive_more::From)] and #[derive(derive_more::Into)] instead of handwriting impl blocks; use manual impl only when conversion needs custom logic
Model TypeScript string literal unions (like 'auto' | 'always' | 'never') as Rust enums instead of newtype wrappers, since the set of valid values is closed
Treat TypeScript string template literal types (like `${string}@${string}`) the same as branded string types in Rust, using a newtype wrapper with validation
Follow the code style guide in CODE_STYLE_GUIDE.md — imports, modules, naming, ownership and borrowing, parameter type selection, trait bounds, pattern matching, pipe-trait, error handling, test layout, and cloning of Arc and Rc
Choose owned vs. borrowed parameters to minimize copies; widen to t...

Files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
🧠 Learnings (17)
📓 Common learnings
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11774
File: pacquet/crates/resolving-deps-resolver/src/resolve_peers.rs:0-0
Timestamp: 2026-05-20T19:41:03.063Z
Learning: In the pacquet project (Rust), the semver crate used is `node-semver` (version ~2.2.0), NOT `nodejs-semver`. These are two distinct crates. `node-semver` only exposes `Range::satisfies` as its public satisfaction API — there is no separate `satisfies_with_prerelease` method. Prerelease-tolerant matching is handled inline by retrying against the stripped `MAJOR.MINOR.PATCH` base when `Range::satisfies` rejects a prerelease version.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11755
File: pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs:193-200
Timestamp: 2026-05-20T01:52:55.764Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs`, the package-level `modified` shortcut for the maturity/minimumReleaseAge filter uses inclusive `<=` (not strict `<`) when comparing `modified_date <= cutoff`. This mirrors the corrected behavior in pnpm (fixed in ab4c96ead5). The reasoning: `modified` is "last modification time," which is an upper bound on every version's `time[v]`. The per-version maturity filter uses `<=` (a version published exactly at the cutoff is mature). Since `modified == cutoff` means every version satisfies the per-version filter, the abbreviated-metadata fast path should accept this case rather than forcing a full-metadata re-fetch or raising `MissingTime`. The same fix was applied to pnpm TS: `pickPackage.ts` (×2) and `pickPackageFromMeta.ts`.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: In `pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs`, the `else` branch that calls `max_satisfying_any` is intentional and matches upstream pnpm's `hoistPeers.ts` (lines 45-59). When `is_exact_version && !auto_install_peers`, pnpm still runs `semver.maxSatisfying(versions, '*', { includePrerelease: true })` and picks the closest available preferred version; any version mismatch is reported downstream as a `bad` peer issue rather than dropping the edge. Do NOT suggest changing this branch to skip `max_satisfying_any` for exact ranges — it would diverge from pnpm.
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Tests that need the mocked registry should start `pnpr` through `pacquet-testing-utils`; `cargo test` / `cargo nextest run` should not require a separate `just registry-mock launch` step

Applied to files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Use snapshot tests with `insta` and carefully review diffs when intentional changes alter snapshots; accept with `cargo insta review` only after careful review

Applied to files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Prefer real fixtures over dependency-injection seams — use `tempfile::TempDir`, the mocked registry, or integration tests spawning the actual binary for happy paths and most error paths; use the DI seam only for filesystem error kinds, deterministic time, shared process-global state, or external-service happy paths

Applied to files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📚 Learning: 2026-05-23T16:55:36.507Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11878
File: pacquet/crates/cli/tests/lockfile_verification.rs:158-162
Timestamp: 2026-05-23T16:55:36.507Z
Learning: In `pacquet/crates/cli/tests/lockfile_verification.rs`, the `trust_lockfile_skips_verification` and `trust_lockfile_cli_flag_skips_verification` tests intentionally do NOT assert `output.status.success()`. The hand-rolled fixture lockfile uses a placeholder integrity hash (`sha512-AAA…`), so the install always fails the downstream tarball integrity check regardless of the supply-chain gate. The contract being tested is "gate-skipped, not install-succeeded"; asserting success would require generating a real lockfile via the `generate_lockfile` pattern (see `hoist.rs`) which is considered not worth the extra wiring for an opt-out smoke test.

Applied to files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📚 Learning: 2026-05-20T21:18:56.391Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11778
File: pacquet/crates/resolving-local-resolver/tests/resolve.rs:365-372
Timestamp: 2026-05-20T21:18:56.391Z
Learning: In `pacquet/crates/resolving-local-resolver/tests/resolve.rs`, the test `fail_when_resolving_from_not_existing_directory_an_injected_dependency` intentionally uses `injected: false`. The test is a verbatim port of the upstream pnpm TypeScript test (resolving/local-resolver/test/index.ts at ef87f3ccff). The `injected` flag only affects the file/link protocol choice for plain directory paths; when the `file:` scheme is explicit in the bare specifier, the flag has no effect on the resolution code path. The misleading test name is inherited from upstream.

Applied to files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📚 Learning: 2026-05-24T08:18:06.019Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11895
File: pnpm/test/deploy.ts:91-95
Timestamp: 2026-05-24T08:18:06.019Z
Learning: In the pnpm/pnpm repository, integration tests that hit the real `registry.npmjs.org` (e.g., for `pacquet` or `pnpm/pacquet`) do NOT use a runtime env-var gate (such as `PNPM_RUN_PUBLIC_REGISTRY_TESTS`). They simply pass `--config.registry=https://registry.npmjs.org/` directly to `execPnpm` and set a higher timeout. This is the established pattern, as seen in `pnpm/test/install/pacquet.ts` and `pnpm/test/deploy.ts`. Do not suggest adding env-var guards for these tests.

Applied to files:

  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Port relevant pnpm tests to Rust tests whenever they translate when porting behavior from pnpm

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Match how the same feature is implemented in the TypeScript pnpm CLI — any change in pacquet must match pnpm's behavior, logic, edge cases, config resolution, error messages, file/lockfile formats, and existing tests

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-25T12:36:42.202Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: User-visible changes (CLI flags, defaults, environment variables, lockfile/manifest/state-file formats, error codes/messages, log emissions, store layout, hook semantics) in pnpm must be mirrored to pacquet in the same PR

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-20T22:49:17.652Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11787
File: pacquet/crates/catalogs-resolver/src/lib.rs:156-167
Timestamp: 2026-05-20T22:49:17.652Z
Learning: In pacquet's `catalogs-resolver` crate (`pacquet/crates/catalogs-resolver/src/lib.rs`), the protocol detection pattern `catalog_lookup.split(':').next().unwrap_or("")` is an intentional byte-for-byte port of pnpm's upstream JavaScript `getProtocol`/split logic in `catalogs/resolver/src/resolveFromCatalog.ts#L95`. A bare value like `"workspace"` (without a colon) is deliberately classified as the `"workspace"` protocol, matching upstream behavior. pacquet's cardinal rule is to match upstream pnpm behavior including quirks; any behavioral change must land in pnpm first and then be ported here.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-24T21:11:04.272Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In the pacquet Rust port (pnpm/pnpm repo), the `ResolvedPackage.optional` AND-folding on revisit intentionally mirrors pnpm's `resolveDependencies.ts:1627-1648` behavior: only the directly-revisited package's `optional` flag is updated; transitive descendants are not re-walked. pnpm CLI corrects stale optional flags downstream via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`, which tracks a `nonOptional` set and re-stamps any package reachable by an all-non-optional path. Pacquet does not yet have this pruner equivalent, so the stale flags flow directly through `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up to port `copyDependencySubGraph` is planned; until then, do not flag the resolver-layer optional propagation gap as a bug in pacquet PRs — it is intentional parity with pnpm's resolver layer.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-24T16:07:54.784Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11904
File: pacquet/crates/package-manager/src/install.rs:556-560
Timestamp: 2026-05-24T16:07:54.784Z
Learning: In pacquet's `is_modules_yaml_consistent` (pacquet/crates/package-manager/src/install.rs), `enableGlobalVirtualStore` is intentionally NOT checked as a separate field. Upstream pnpm's `validateModules.ts` does not persist or check `enableGlobalVirtualStore` in `.modules.yaml` either. Drift on this setting is caught indirectly: toggling `enableGlobalVirtualStore` changes `config.effective_virtual_store_dir()` (GVS-on → `<store>/v11/links`, GVS-off → `<project>/node_modules/.pnpm`), so the existing `modules.virtual_store_dir == config.effective_virtual_store_dir()` comparison in `is_modules_yaml_consistent` already detects the mismatch and prevents the short-circuit. Do not flag the absence of an explicit `enableGlobalVirtualStore` field as a bug.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-20T23:08:06.093Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: Pacquet (pnpm's Rust port) has a cardinal rule: "match pnpm exactly — do not fix pnpm quirks unless the same fix has landed in pnpm first." Review comments should not suggest behavioral deviations from upstream pnpm, even when the upstream behavior appears buggy. If a real bug is identified, it must be fixed upstream first.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : User-facing errors go through `miette` via the `pacquet-diagnostics` crate; match pnpm's error codes and messages where pnpm defines them since error codes are part of the public contract

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-28T16:19:30.483Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12025
File: pacquet/crates/deps-path/src/link_path_to_peer_version.rs:0-0
Timestamp: 2026-05-28T16:19:30.483Z
Learning: In `pacquet/crates/deps-path/src/link_path_to_peer_version.rs`, the `link_path_to_peer_version` function intentionally deviates from upstream pnpm/JS behavior for non-BMP Unicode code points: the JavaScript `filenamify` v4 implementation sees UTF-16 code units and emits two surrogate fragments for a single non-BMP scalar, while the Rust port iterates `chars()` and emits one clean Unicode scalar. pnpm has no tests for non-ASCII link paths, so the behavior was undefined upstream; the Rust scalar form is the intentional, preferred behavior for pacquet.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-20T01:52:55.764Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11755
File: pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs:193-200
Timestamp: 2026-05-20T01:52:55.764Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs`, the package-level `modified` shortcut for the maturity/minimumReleaseAge filter uses inclusive `<=` (not strict `<`) when comparing `modified_date <= cutoff`. This mirrors the corrected behavior in pnpm (fixed in ab4c96ead5). The reasoning: `modified` is "last modification time," which is an upper bound on every version's `time[v]`. The per-version maturity filter uses `<=` (a version published exactly at the cutoff is mature). Since `modified == cutoff` means every version satisfies the per-version filter, the abbreviated-metadata fast path should accept this case rather than forcing a full-metadata re-fetch or raising `MissingTime`. The same fix was applied to pnpm TS: `pickPackage.ts` (×2) and `pickPackageFromMeta.ts`.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
🔇 Additional comments (2)
pacquet/crates/config/src/pnpm_default_parity.rs (1)

28-30: LGTM!

Also applies to: 141-141, 183-189

pacquet/crates/package-manager/src/install_package_from_registry/tests.rs (1)

108-108: LGTM!


📝 Walkthrough

Walkthrough

Tightens installSome's catalog equality check to only compare concrete semver versions, preventing "Invalid Version" crashes for catalog entries expressed as ranges; adds regression tests and integrates a new CatalogMode config, reconciliation logic, update-time validation, and tests across pacquet.

Changes

Catalog Range Comparison Fix

Layer / File(s) Summary
Fix catalog range comparison in installSome
installing/deps-installer/src/install/index.ts
Changes the semver precondition in the catalog equality shortcut to require concrete semver (semver.valid) for both sides so ranges (e.g. ^21.2.10) are not passed to semver.eq().
Regression test and changeset
installing/deps-installer/test/catalogs.ts, .changeset/catalog-range-spec-update-crash.md
Adds a Jest regression test asserting catalog-range mismatches reject with ERR_PNPM_CATALOG_VERSION_MISMATCH instead of crashing, and records a changeset documenting the patch release.

Pacquet catalog-mode implementation

Layer / File(s) Summary
Config surface, workspace YAML/env, and parity tests
pacquet/crates/config/src/lib.rs, pacquet/crates/config/src/workspace_yaml.rs, pacquet/crates/config/src/env_overlay.rs, pacquet/crates/config/src/pnpm_default_parity.rs, pacquet/crates/config/src/workspace_yaml/tests.rs
Introduce CatalogMode enum and Config::catalog_mode, add WorkspaceSettings::catalog_mode and env parsing for CATALOG_MODE, and update parity/workspace tests to round-trip catalogMode values.
Package-manager catalog-mode core and wiring
pacquet/crates/package-manager/Cargo.toml, pacquet/crates/package-manager/src/catalog_mode.rs, pacquet/crates/package-manager/src/lib.rs, pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
Add catalog-related workspace deps, implement check_catalog_mode, CatalogVersionMismatchError, and CatalogModeDep types; wire module and re-exports; initialize test Config default for catalog_mode.
Catalog-mode unit tests
pacquet/crates/package-manager/src/catalog_mode/tests.rs
Add comprehensive unit tests for Manual/Strict/Prefer behaviors, ensuring range-versus-version comparisons do not panic and warning/error behaviors are correct.
Update command catalog-mode reconciliation and CLI test
pacquet/crates/package-manager/src/update.rs, pacquet/crates/cli/tests/update.rs
Extend pacquet update to load workspace catalogs when rewrites exist, build per-dependency CatalogModeDep inputs, invoke check_catalog_mode, add new UpdateError variants for workspace/catalog failures, and add a CLI integration test asserting strict-catalog range mismatch fails with the expected diagnostics.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • pnpm/pnpm#12102: Introduced core pacquet update implementation that this PR extends with catalog-mode validation in update.rs.
  • pnpm/pnpm#11567: Modifies the same installSome catalog-resolution logic in installing/deps-installer/src/install/index.ts.

Suggested reviewers

  • zkochan

🐰 A range in the catalog gave quite a scare,
Semver.eq read it and cried "beware!"
Now versions must be single and neat,
Mismatch logic handles the rest — tidy and sweet. 🥕✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: do not crash when a catalog specifier is a range' accurately describes the main fix—preventing crashes when catalog entries use semver ranges instead of exact versions.
Linked Issues check ✅ Passed All PR changes directly address issue #11570 requirements: fix the crash by using semver.valid instead of semver.validRange, add comprehensive tests for catalog range handling, and port catalog-mode logic to pacquet to prevent similar crashes.
Out of Scope Changes check ✅ Passed All changes are in-scope: the TypeScript fix targets the crash root cause, pacquet changes implement catalog-mode parity, and test additions validate both the fix and new configuration options directly related to issue #11570.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

When catalogMode is `strict` or `prefer` and the catalog entry for a
package is a range (e.g. `^21.2.10`), pnpm passed the range to
`semver.eq()` and crashed with `Invalid Version: ^21.2.10` during
`pnpm update --recursive --lockfile-only <pkg>@<version>` — the exact
command Renovate's pnpm artifact updater runs.

Tighten the catalog-match short-circuit to only call `semver.eq` when
both sides are concrete versions. Range specifiers now fall through to
the existing mismatch handling (CatalogVersionMismatchError in strict,
warn-and-use-direct in prefer) instead of throwing.

Closes pnpm#11570
@zkochan
zkochan force-pushed the fix/catalog-range-spec-update-crash branch from adcb7c9 to 6c65cb5 Compare June 4, 2026 15:00
zkochan added a commit to shiminshen/pnpm that referenced this pull request Jun 4, 2026
Ports pnpm's catalogMode gate (the feature behind pnpm#11706) into pacquet:
a direct `update <pkg>@<version>` / `--latest` version is reconciled
against the matching `catalog:` entry under `catalogMode`. Strict rejects
a mismatch with ERR_PNPM_CATALOG_VERSION_MISMATCH, prefer warns and keeps
the direct version, manual is a no-op.

The comparison only treats both sides as equal when each parses as a
concrete semver version, so a ranged catalog entry (e.g. `^21.2.10`)
falls through to the mismatch path instead of being passed to an
exact-version comparison — the Rust analogue of pnpm guarding
`semver.eq` with `semver.valid` in pnpm#11706.

- config: add `CatalogMode` enum (default `manual`) + `Config.catalog_mode`,
  wired through `pnpm-workspace.yaml` and the env overlay; move
  `catalog-mode` from NOT_PORTED to a mapped row in the parity test.
- package-manager: `check_catalog_mode` + `CatalogVersionMismatchError`,
  invoked from `update` before the manifest is mutated.

Not ported (pacquet hasn't ported the surrounding pieces): the `add`-path
cataloging that relies on `defaultCatalog` rewriting and the
`saveCatalogName` -> `pnpm-workspace.yaml` auto-cataloging half.

---
Written by an agent (Claude Code, claude-opus-4-8).
zkochan added a commit to shiminshen/pnpm that referenced this pull request Jun 4, 2026
Ports pnpm's catalogMode gate (the feature behind pnpm#11706) into pacquet:
a direct `update <pkg>@<version>` / `--latest` version is reconciled
against the matching `catalog:` entry under `catalogMode`. Strict rejects
a mismatch with ERR_PNPM_CATALOG_VERSION_MISMATCH, prefer warns and keeps
the direct version, manual is a no-op.

The comparison only treats both sides as equal when each parses as a
concrete semver version, so a ranged catalog entry (e.g. `^21.2.10`)
falls through to the mismatch path instead of being passed to an
exact-version comparison — the Rust analogue of pnpm guarding
`semver.eq` with `semver.valid` in pnpm#11706.

- config: add `CatalogMode` enum (default `manual`) + `Config.catalog_mode`,
  wired through `pnpm-workspace.yaml` and the env overlay; move
  `catalog-mode` from NOT_PORTED to a mapped row in the parity test.
- package-manager: `check_catalog_mode` + `CatalogVersionMismatchError`,
  invoked from `update` before the manifest is mutated.

Not ported (pacquet hasn't ported the surrounding pieces): the `add`-path
cataloging that relies on `defaultCatalog` rewriting and the
`saveCatalogName` -> `pnpm-workspace.yaml` auto-cataloging half.

---
Written by an agent (Claude Code, claude-opus-4-8).
@zkochan
zkochan force-pushed the fix/catalog-range-spec-update-crash branch from 9f0bf00 to b6ed81d Compare June 4, 2026 17:02

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pacquet/crates/package-manager/src/update.rs`:
- Around line 405-413: The current mapping `prev: HashMap<&str, &str>` uses only
package `name` so entries from different dependency groups can overwrite each
other; change the map to key by a composite of `(name, group)` (e.g.,
HashMap<(String,String), &str> or a joined "name|group" key) when building
`prev` from `direct`, and then when constructing `deps` from `rewrites` look up
`prev_specifier` using that same `(name, group)` composite key; update the
`CatalogModeDep` population (the `prev_specifier` assignment) and any callers
like `check_catalog_mode` to use the corrected lookup so each alias resolves to
the prior specifier for the correct group.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 68352088-37fd-4ed3-bc45-999d5547d54f

📥 Commits

Reviewing files that changed from the base of the PR and between 6c65cb5 and b6ed81d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/Cargo.toml
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/update.rs
✅ Files skipped from review due to trivial changes (2)
  • pacquet/crates/package-manager/Cargo.toml
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Code Coverage
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Dylint
  • GitHub Check: Lint and Test (ubuntu-latest)
  • GitHub Check: Lint and Test (macos-latest)
  • GitHub Check: Lint and Test (windows-latest)
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Compile & Lint
🧰 Additional context used
📓 Path-based instructions (2)
pacquet/**/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/*.rs: Log emissions are part of matching pnpm — when porting a function that fires pnpm:<channel> events through globalLogger, logger.debug(...), or streamParser.write(...), mirror the call site, payload, and ordering so @pnpm/cli.default-reporter parses pacquet's NDJSON the same way
Declare a newtype wrapper for branded string types instead of collapsing the brand into a plain String or &str in Rust
If upstream TypeScript always validates before construction of a branded string, validate in the Rust wrapper too via TryFrom<String> and/or FromStr and do not provide an infallible public constructor
If upstream TypeScript never validates a branded string, just brand for type-safety in Rust by exposing an infallible From<String> constructor
If upstream TypeScript occasionally constructs a branded string without validation, expose from_str_unchecked in Rust as an escape hatch alongside the validating constructor
Match upstream serde behavior for branded strings crossing JSON, YAML, or INI boundaries by using #[serde(try_from = "String")] for deserialization and #[serde(into = "String")] for serialization
Derive simple conversions for branded strings using #[derive(derive_more::From)] and #[derive(derive_more::Into)] instead of handwriting impl blocks; use manual impl only when conversion needs custom logic
Model TypeScript string literal unions (like 'auto' | 'always' | 'never') as Rust enums instead of newtype wrappers, since the set of valid values is closed
Treat TypeScript string template literal types (like `${string}@${string}`) the same as branded string types in Rust, using a newtype wrapper with validation
Follow the code style guide in CODE_STYLE_GUIDE.md — imports, modules, naming, ownership and borrowing, parameter type selection, trait bounds, pattern matching, pipe-trait, error handling, test layout, and cloning of Arc and Rc
Choose owned vs. borrowed parameters to minimize copies; widen to t...

Files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
pacquet/**/tests/**/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/tests/**/*.rs: Prefer real fixtures over dependency-injection seams — use tempfile::TempDir, the mocked registry, or integration tests spawning the actual binary for happy paths and most error paths; use the DI seam only for filesystem error kinds, deterministic time, shared process-global state, or external-service happy paths
Follow test-logging guidance — log before non-assert_eq! assertions, dbg! complex structures, skip logging for simple scalar assert_eq!
Tests must not be tolerant of missing build/runtime environment by silently returning early when a tool isn't found — let the test panic when a required tool is absent
Prefer #[cfg_attr(target_os = "windows", ignore = "...")] (or matching #[cfg(unix)] gates) over runtime probe-and-skip helpers for platform-locked tools
Port relevant pnpm tests to Rust tests whenever they translate when porting behavior from pnpm
Use snapshot tests with insta and carefully review diffs when intentional changes alter snapshots; accept with cargo insta review only after careful review
Tests that need the mocked registry should start pnpr through pacquet-testing-utils; cargo test / cargo nextest run should not require a separate just registry-mock launch step

Files:

  • pacquet/crates/cli/tests/update.rs
🧠 Learnings (51)
📓 Common learnings
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: User-visible changes (CLI flags, defaults, environment variables, lockfile/manifest/state-file formats, error codes/messages, log emissions, store layout, hook semantics) in pnpm must be mirrored to pacquet in the same PR
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: In `pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs`, the `else` branch that calls `max_satisfying_any` is intentional and matches upstream pnpm's `hoistPeers.ts` (lines 45-59). When `is_exact_version && !auto_install_peers`, pnpm still runs `semver.maxSatisfying(versions, '*', { includePrerelease: true })` and picks the closest available preferred version; any version mismatch is reported downstream as a `bad` peer issue rather than dropping the edge. Do NOT suggest changing this branch to skip `max_satisfying_any` for exact ranges — it would diverge from pnpm.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11755
File: pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs:193-200
Timestamp: 2026-05-20T01:52:55.764Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs`, the package-level `modified` shortcut for the maturity/minimumReleaseAge filter uses inclusive `<=` (not strict `<`) when comparing `modified_date <= cutoff`. This mirrors the corrected behavior in pnpm (fixed in ab4c96ead5). The reasoning: `modified` is "last modification time," which is an upper bound on every version's `time[v]`. The per-version maturity filter uses `<=` (a version published exactly at the cutoff is mature). Since `modified == cutoff` means every version satisfies the per-version filter, the abbreviated-metadata fast path should accept this case rather than forcing a full-metadata re-fetch or raising `MissingTime`. The same fix was applied to pnpm TS: `pickPackage.ts` (×2) and `pickPackageFromMeta.ts`.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In the pacquet Rust port (pnpm/pnpm repo), the `ResolvedPackage.optional` AND-folding on revisit intentionally mirrors pnpm's `resolveDependencies.ts:1627-1648` behavior: only the directly-revisited package's `optional` flag is updated; transitive descendants are not re-walked. pnpm CLI corrects stale optional flags downstream via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`, which tracks a `nonOptional` set and re-stamps any package reachable by an all-non-optional path. Pacquet does not yet have this pruner equivalent, so the stale flags flow directly through `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up to port `copyDependencySubGraph` is planned; until then, do not flag the resolver-layer optional propagation gap as a bug in pacquet PRs — it is intentional parity with pnpm's resolver layer.
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Match how the same feature is implemented in the TypeScript pnpm CLI — any change in pacquet must match pnpm's behavior, logic, edge cases, config resolution, error messages, file/lockfile formats, and existing tests
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: Pacquet (pnpm's Rust port) has a cardinal rule: "match pnpm exactly — do not fix pnpm quirks unless the same fix has landed in pnpm first." Review comments should not suggest behavioral deviations from upstream pnpm, even when the upstream behavior appears buggy. If a real bug is identified, it must be fixed upstream first.
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: Always explicitly include 'pnpm' in changeset files with appropriate version bump (patch, minor, or major)
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Reference the upstream pnpm commit/PR when porting code from pnpm in commit messages
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11787
File: pacquet/crates/catalogs-resolver/src/lib.rs:156-167
Timestamp: 2026-05-20T22:49:17.652Z
Learning: In pacquet's `catalogs-resolver` crate (`pacquet/crates/catalogs-resolver/src/lib.rs`), the protocol detection pattern `catalog_lookup.split(':').next().unwrap_or("")` is an intentional byte-for-byte port of pnpm's upstream JavaScript `getProtocol`/split logic in `catalogs/resolver/src/resolveFromCatalog.ts#L95`. A bare value like `"workspace"` (without a colon) is deliberately classified as the `"workspace"` protocol, matching upstream behavior. pacquet's cardinal rule is to match upstream pnpm behavior including quirks; any behavioral change must land in pnpm first and then be ported here.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11774
File: pacquet/crates/resolving-deps-resolver/src/resolve_peers.rs:0-0
Timestamp: 2026-05-20T19:41:03.063Z
Learning: In the pacquet project (Rust), the semver crate used is `node-semver` (version ~2.2.0), NOT `nodejs-semver`. These are two distinct crates. `node-semver` only exposes `Range::satisfies` as its public satisfaction API — there is no separate `satisfies_with_prerelease` method. Prerelease-tolerant matching is handled inline by retrying against the stripped `MAJOR.MINOR.PATCH` base when `Range::satisfies` rejects a prerelease version.
📚 Learning: 2026-05-25T12:36:42.202Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: User-visible changes (CLI flags, defaults, environment variables, lockfile/manifest/state-file formats, error codes/messages, log emissions, store layout, hook semantics) in pnpm must be mirrored to pacquet in the same PR

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Match how the same feature is implemented in the TypeScript pnpm CLI — any change in pacquet must match pnpm's behavior, logic, edge cases, config resolution, error messages, file/lockfile formats, and existing tests

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Use snapshot tests with `insta` and carefully review diffs when intentional changes alter snapshots; accept with `cargo insta review` only after careful review

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Port relevant pnpm tests to Rust tests whenever they translate when porting behavior from pnpm

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-28T16:19:30.483Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12025
File: pacquet/crates/deps-path/src/link_path_to_peer_version.rs:0-0
Timestamp: 2026-05-28T16:19:30.483Z
Learning: In `pacquet/crates/deps-path/src/link_path_to_peer_version.rs`, the `link_path_to_peer_version` function intentionally deviates from upstream pnpm/JS behavior for non-BMP Unicode code points: the JavaScript `filenamify` v4 implementation sees UTF-16 code units and emits two surrogate fragments for a single non-BMP scalar, while the Rust port iterates `chars()` and emits one clean Unicode scalar. pnpm has no tests for non-ASCII link paths, so the behavior was undefined upstream; the Rust scalar form is the intentional, preferred behavior for pacquet.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-25T12:36:42.202Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: Always explicitly include 'pnpm' in changeset files with appropriate version bump (patch, minor, or major)

Applied to files:

  • pacquet/crates/cli/tests/update.rs
📚 Learning: 2026-05-24T16:07:54.784Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11904
File: pacquet/crates/package-manager/src/install.rs:556-560
Timestamp: 2026-05-24T16:07:54.784Z
Learning: In pacquet's `is_modules_yaml_consistent` (pacquet/crates/package-manager/src/install.rs), `enableGlobalVirtualStore` is intentionally NOT checked as a separate field. Upstream pnpm's `validateModules.ts` does not persist or check `enableGlobalVirtualStore` in `.modules.yaml` either. Drift on this setting is caught indirectly: toggling `enableGlobalVirtualStore` changes `config.effective_virtual_store_dir()` (GVS-on → `<store>/v11/links`, GVS-off → `<project>/node_modules/.pnpm`), so the existing `modules.virtual_store_dir == config.effective_virtual_store_dir()` comparison in `is_modules_yaml_consistent` already detects the mismatch and prevents the short-circuit. Do not flag the absence of an explicit `enableGlobalVirtualStore` field as a bug.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T23:07:58.444Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:07:58.444Z
Learning: When reviewing code in this pacquet Rust port, follow the upstream pnpm compatibility rule: only match pnpm’s behavior exactly. Do not propose review changes that intentionally deviate from pnpm’s documented/observed behavior, even if pnpm appears buggy. If you identify a real bug in pnpm behavior, the review should prioritize fixing it upstream in pnpm first, and avoid implementing a pnpm-behavior workaround here unless the same fix has already landed upstream.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T22:49:17.652Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11787
File: pacquet/crates/catalogs-resolver/src/lib.rs:156-167
Timestamp: 2026-05-20T22:49:17.652Z
Learning: In pacquet's `catalogs-resolver` crate (`pacquet/crates/catalogs-resolver/src/lib.rs`), the protocol detection pattern `catalog_lookup.split(':').next().unwrap_or("")` is an intentional byte-for-byte port of pnpm's upstream JavaScript `getProtocol`/split logic in `catalogs/resolver/src/resolveFromCatalog.ts#L95`. A bare value like `"workspace"` (without a colon) is deliberately classified as the `"workspace"` protocol, matching upstream behavior. pacquet's cardinal rule is to match upstream pnpm behavior including quirks; any behavioral change must land in pnpm first and then be ported here.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : Tests are documentation — do not duplicate test scenarios, edge cases, failure modes, or worked examples in prose when they are already captured by tests

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-19T19:23:00.981Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11752
File: pacquet/crates/config/src/lib.rs:1062-1073
Timestamp: 2026-05-19T19:23:00.981Z
Learning: In `pacquet/crates/config/src/lib.rs`, `modules_dir` does not need a `!virtual_store_dir_explicit` guard on its workspace re-anchor because `modules_dir` is in pnpm's `excludedPnpmKeys` (filtered out by `WorkspaceSettings::clear_workspace_only_fields`) and therefore can only be set by workspace yaml (applied immediately after) or env vars (applied later in the cascade) — not by global `config.yaml`. `virtual_store_dir`, by contrast, IS settable from global config and requires the `if !virtual_store_dir_explicit` guard to survive the workspace-root re-anchor.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T20:41:50.322Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11773
File: pacquet/crates/package-manager/src/install_package_from_registry.rs:111-114
Timestamp: 2026-05-20T20:41:50.322Z
Learning: In pacquet (pnpm/pnpm repo, Rust codebase), `install_package_from_registry` is the npm-only install path. The npm resolver always stamps `ResolveResult.id` (a `PkgResolutionId`) as `nameversion`. Parsing it back through `PkgNameVer` with `.expect()` is intentional — a parse failure means a mis-dispatch bug, not malformed external input. Per pacquet's CLAUDE.md: "Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees." Do not suggest replacing such `.expect()` calls with graceful error handling.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-29T18:03:24.797Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pnpr/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:24.797Z
Learning: Applies to pnpr/**/pnpr/**/Cargo.toml : Declare new shared dependencies in the root [workspace.dependencies] and use { workspace = true } in pnpr crate's Cargo.toml

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📚 Learning: 2026-05-21T00:33:05.035Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11789
File: pacquet/crates/resolving-npm-resolver/src/resolve_from_workspace.rs:145-146
Timestamp: 2026-05-21T00:33:05.035Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/resolve_from_workspace.rs`, the guard `bare.starts_with("workspace:.")` is intentionally broad — matching pnpm upstream's identical `startsWith('workspace:.')` check at `resolving/npm-resolver/src/index.ts`. All dot-prefixed workspace forms including `workspace:.foo` are intentionally passed through to the local-resolver, which handles them as `link:`-style directory specs via its prefix-stripping regex. Do not suggest narrowing this to `workspace:./` or `workspace:../` only.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-21T00:33:05.035Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11789
File: pacquet/crates/resolving-npm-resolver/src/resolve_from_workspace.rs:145-146
Timestamp: 2026-05-21T00:33:05.035Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/resolve_from_workspace.rs`, the guard `bare.starts_with("workspace:.")` is intentionally broad — matching pnpm upstream's identical `startsWith('workspace:.')` check. All dot-prefixed workspace forms including `workspace:.foo` are intentionally handed off to the local-resolver, which handles them as `link:`-style directory specs via its prefix-stripping regex. Do not suggest narrowing this to `workspace:./` or `workspace:../` only.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/Cargo.toml : Keep dependencies at the right level — add a new dependency to the specific crate that needs it, not to the workspace root or shared crate unless multiple crates depend on it

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T23:08:06.093Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: In `pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs`, the `else` branch that calls `max_satisfying_any` is intentional and matches upstream pnpm's `hoistPeers.ts` (lines 45-59). When `is_exact_version && !auto_install_peers`, pnpm still runs `semver.maxSatisfying(versions, '*', { includePrerelease: true })` and picks the closest available preferred version; any version mismatch is reported downstream as a `bad` peer issue rather than dropping the edge. Do NOT suggest changing this branch to skip `max_satisfying_any` for exact ranges — it would diverge from pnpm.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Tests that need the mocked registry should start `pnpr` through `pacquet-testing-utils`; `cargo test` / `cargo nextest run` should not require a separate `just registry-mock launch` step

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T19:40:55.051Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11774
File: pacquet/crates/resolving-deps-resolver/src/resolve_peers.rs:0-0
Timestamp: 2026-05-20T19:40:55.051Z
Learning: In the pacquet Rust code, ensure the semver implementation uses the `node-semver` crate (not `nodejs-semver`). `node-semver`’s public API does not include a `satisfies_with_prerelease`-style method; prerelease-tolerant matching should be implemented inline by first calling `Range::satisfies`, and when it rejects a prerelease version, retry matching against a stripped `MAJOR.MINOR.PATCH` base of the prerelease version.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-22T00:08:44.646Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11837
File: pacquet/crates/resolving-npm-resolver/src/pick_package.rs:33-51
Timestamp: 2026-05-22T00:08:44.646Z
Learning: In the pnpm/pnpm repo’s pacquet Rust crates, do not flag Unicode ellipsis characters (U+2026, `…`) in Rust doc comments (`///` / `/** */`) as a lint violation. The pacquet crate’s `dylint.toml` only enables `perfectionist::derive_ordering`, and the Dylint `unicode-ellipsis` rule is not enabled for this project—so `…` in doc comments is an intentional, repo-consistent style.

Applied to files:

  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : External-crate preludes such as `use rayon::prelude::*;` and root-of-module re-exports such as `pub use submodule::*;` in a `lib.rs` are allowed exceptions to the no-star-imports rule

Applied to files:

  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : Do not use star imports inside module bodies — write `use super::{Foo, bar}` instead of `use super::*;` for modules you control

Applied to files:

  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📚 Learning: 2026-05-29T18:03:24.797Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pnpr/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:24.797Z
Learning: Prefer existing pacquet-* crates over writing new code; check pacquet-tarball, pacquet-crypto-hash, pacquet-crypto-shasums-file, pacquet-package-manifest, pacquet-network, pacquet-registry, pacquet-fs, and pacquet-diagnostics before implementing non-trivial functionality

Applied to files:

  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-29T18:03:24.797Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pnpr/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:24.797Z
Learning: Applies to pnpr/**/pnpr/**/*.rs : Follow the pacquet code-style guide (../pacquet/CODE_STYLE_GUIDE.md) for Rust-level conventions including imports, naming, ownership, and error handling

Applied to files:

  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : Search for existing shared helpers before writing new code; shared helpers tend to live in `crates/fs`, `crates/testing-utils`, and `crates/diagnostics`

Applied to files:

  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/Cargo.toml : Check whether the workspace already depends on something suitable in `[workspace.dependencies]` in the root `Cargo.toml` before adding a new dependency

Applied to files:

  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-06-02T14:39:24.423Z
Learnt from: KSXGitHub
Repo: pnpm/pnpm PR: 11938
File: pacquet/crates/config/src/lib.rs:959-966
Timestamp: 2026-06-02T14:39:24.423Z
Learning: In the pnpm/pnpm pacquet Rust port (`pacquet/crates/config/src/lib.rs`), `Config.extra_bin_paths` is intentionally left empty (`Vec::new()`) until workspace fan-out support for `run`/`exec` is implemented. It mirrors pnpm's `Config.extraBinPaths` (the workspace-root `node_modules/.bin`), which is also empty outside a workspace. Populating it before the workspace-root is resolved would put a non-existent path on `PATH`, so it should only be derived once workspace support lands. Do not flag this as a bug or missing derivation in reviews.

Applied to files:

  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/config/src/workspace_yaml.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Do not add a dependency not already declared in `[workspace.dependencies]` without explicit human request; ask for approval and request addition to the workspace root `Cargo.toml`

Applied to files:

  • pacquet/crates/config/src/workspace_yaml/tests.rs
📚 Learning: 2026-05-25T14:58:11.105Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11931
File: pacquet/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs:560-589
Timestamp: 2026-05-25T14:58:11.105Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs`, all per-`(registry, name[, version])` caches in `NpmResolutionVerifier` (`published_at`, `full_meta`, `full_meta_for_trust`, `abbreviated_meta`, `local_meta`) intentionally use the same pattern: lock → miss-check → release lock → await fetch/load → re-acquire lock → insert. This uniform pattern is deliberate; do not flag individual caches for using it. The known follow-up improvement (replacing the pattern with `tokio::sync::OnceCell` per key inside a `Mutex<HashMap<…>>`) is tracked as a future structural change to cover all five caches simultaneously.

Applied to files:

  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
📚 Learning: 2026-05-20T21:18:55.266Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11778
File: pacquet/crates/resolving-local-resolver/src/parse_bare_specifier.rs:253-278
Timestamp: 2026-05-20T21:18:55.266Z
Learning: In `pacquet/crates/resolving-local-resolver/src/parse_bare_specifier.rs`, the `resolve_path` function intentionally short-circuits absolute specifiers verbatim (returns them unchanged without normalizing `..` components), mirroring the upstream TypeScript `resolvePath` in `resolving/local-resolver/src/parseBareSpecifier.ts` at ef87f3ccff. The OS resolves `..` at `fs.read` time. Do not suggest normalizing the absolute branch — it would invent behavior pnpm doesn't have, violating the pacquet AGENTS.md cardinal rule of fidelity to upstream.

Applied to files:

  • pacquet/crates/config/src/env_overlay.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : User-facing errors go through `miette` via the `pacquet-diagnostics` crate; match pnpm's error codes and messages where pnpm defines them since error codes are part of the public contract

Applied to files:

  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T23:07:43.668Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11783
File: pacquet/crates/engine-runtime-bun-resolver/src/bun_resolver.rs:70-88
Timestamp: 2026-05-20T23:07:43.668Z
Learning: In `pacquet/crates/engine-runtime-bun-resolver/src/bun_resolver.rs`, `resolve_impl` intentionally passes `ResolveOptions::default()` (not the caller-provided `opts`) when delegating to the npm resolver. This mirrors the upstream TypeScript code at `engine/runtime/bun-resolver/src/index.ts#L46` which passes an empty `{}` literal; forwarding outer opts would diverge from pnpm's behavior.

Applied to files:

  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:24.797Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pnpr/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:24.797Z
Learning: Applies to pnpr/**/pnpr/crates/**/Cargo.toml : New registry-only crates must be placed under pnpr/crates/<short-name>/ and named pnpr-<short-name> in Cargo.toml, never using the pacquet- prefix

Applied to files:

  • pacquet/crates/config/src/lib.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : Follow Rust API Guidelines for naming

Applied to files:

  • pacquet/crates/config/src/lib.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : Model TypeScript string literal unions (like `'auto' | 'always' | 'never'`) as Rust `enum`s instead of newtype wrappers, since the set of valid values is closed

Applied to files:

  • pacquet/crates/config/src/lib.rs
📚 Learning: 2026-05-24T21:11:04.272Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In the pacquet Rust port (pnpm/pnpm repo), the `ResolvedPackage.optional` AND-folding on revisit intentionally mirrors pnpm's `resolveDependencies.ts:1627-1648` behavior: only the directly-revisited package's `optional` flag is updated; transitive descendants are not re-walked. pnpm CLI corrects stale optional flags downstream via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`, which tracks a `nonOptional` set and re-stamps any package reachable by an all-non-optional path. Pacquet does not yet have this pruner equivalent, so the stale flags flow directly through `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up to port `copyDependencySubGraph` is planned; until then, do not flag the resolver-layer optional propagation gap as a bug in pacquet PRs — it is intentional parity with pnpm's resolver layer.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T01:52:55.764Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11755
File: pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs:193-200
Timestamp: 2026-05-20T01:52:55.764Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs`, the package-level `modified` shortcut for the maturity/minimumReleaseAge filter uses inclusive `<=` (not strict `<`) when comparing `modified_date <= cutoff`. This mirrors the corrected behavior in pnpm (fixed in ab4c96ead5). The reasoning: `modified` is "last modification time," which is an upper bound on every version's `time[v]`. The per-version maturity filter uses `<=` (a version published exactly at the cutoff is mature). Since `modified == cutoff` means every version satisfies the per-version filter, the abbreviated-metadata fast path should accept this case rather than forcing a full-metadata re-fetch or raising `MissingTime`. The same fix was applied to pnpm TS: `pickPackage.ts` (×2) and `pickPackageFromMeta.ts`.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-20T21:18:56.391Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11778
File: pacquet/crates/resolving-local-resolver/tests/resolve.rs:365-372
Timestamp: 2026-05-20T21:18:56.391Z
Learning: In `pacquet/crates/resolving-local-resolver/tests/resolve.rs`, the test `fail_when_resolving_from_not_existing_directory_an_injected_dependency` intentionally uses `injected: false`. The test is a verbatim port of the upstream pnpm TypeScript test (resolving/local-resolver/test/index.ts at ef87f3ccff). The `injected` flag only affects the file/link protocol choice for plain directory paths; when the `file:` scheme is explicit in the bare specifier, the flag has no effect on the resolution code path. The misleading test name is inherited from upstream.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Consult `plans/TEST_PORTING.md` before adding ported tests and update its checkboxes as items land; use `known_failures` modules and `pacquet_testing_utils::allow_known_failure!` at the not-yet-implemented boundary

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Tests must not be tolerant of missing build/runtime environment by silently returning early when a tool isn't found — let the test panic when a required tool is absent

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T23:07:40.480Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11783
File: pacquet/crates/engine-runtime-deno-resolver/src/deno_resolver.rs:79-80
Timestamp: 2026-05-20T23:07:40.480Z
Learning: In `pacquet/crates/engine-runtime-deno-resolver/src/deno_resolver.rs` (and the analogous Bun resolver), passing `ResolveOptions::default()` when delegating version selection to the inner npm resolver is intentional. It mirrors the upstream TypeScript code in `engine/runtime/deno-resolver/src/index.ts#L56` which explicitly passes `{}` (an empty/default options literal). Forwarding the outer `ResolveOptions` would diverge from pnpm upstream behavior and must NOT be flagged as a bug.

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Prefer `#[cfg_attr(target_os = "windows", ignore = "...")]` (or matching `#[cfg(unix)]` gates) over runtime probe-and-skip helpers for platform-locked tools

Applied to files:

  • pacquet/crates/config/src/pnpm_default_parity.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Follow test-logging guidance — log before non-`assert_eq!` assertions, `dbg!` complex structures, skip logging for simple scalar `assert_eq!`

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-23T16:55:36.507Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11878
File: pacquet/crates/cli/tests/lockfile_verification.rs:158-162
Timestamp: 2026-05-23T16:55:36.507Z
Learning: In `pacquet/crates/cli/tests/lockfile_verification.rs`, the `trust_lockfile_skips_verification` and `trust_lockfile_cli_flag_skips_verification` tests intentionally do NOT assert `output.status.success()`. The hand-rolled fixture lockfile uses a placeholder integrity hash (`sha512-AAA…`), so the install always fails the downstream tarball integrity check regardless of the supply-chain gate. The contract being tested is "gate-skipped, not install-succeeded"; asserting success would require generating a real lockfile via the `generate_lockfile` pattern (see `hoist.rs`) which is considered not worth the extra wiring for an opt-out smoke test.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:24.797Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pnpr/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:24.797Z
Learning: Applies to pnpr/**/pnpr/**/*.rs : Follow the pacquet contributing guide (../pacquet/CONTRIBUTING.md) for test layout and Rust conventions

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Prefer real fixtures over dependency-injection seams — use `tempfile::TempDir`, the mocked registry, or integration tests spawning the actual binary for happy paths and most error paths; use the DI seam only for filesystem error kinds, deterministic time, shared process-global state, or external-service happy paths

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-23T09:14:43.635Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11867
File: pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs:726-730
Timestamp: 2026-05-23T09:14:43.635Z
Learning: In `pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs`, the fresh-lockfile path intentionally does not invoke `BuildModules` and discards `side_effects_maps_by_snapshot` from `CreateVirtualStoreOutput`. This is pre-existing, documented behavior (mirroring upstream `link.ts:167-170`): `importing_done` fires once extraction and symlink linking are complete, and the fresh-lockfile path does not run lifecycle scripts. The frozen-lockfile path wires `BuildModules` end-to-end as normal. Do not flag this omission as a bug; wiring lifecycle scripts into the fresh-lockfile path is tracked as future work separate from perf refactors.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-20T10:06:55.749Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11760
File: pacquet/crates/resolving-deps-resolver/src/resolved_tree.rs:15-18
Timestamp: 2026-05-20T10:06:55.749Z
Learning: In `pacquet/crates/resolving-deps-resolver/src/resolved_tree.rs`, the `DirectDep.id`, `ResolvedPackage.id`, and `ResolvedTree.packages` HashMap keys are intentionally plain `String` for now. The natural branded type would be `pacquet_lockfile::PkgNameVer`, but it cannot be used as a HashMap key because `node_semver::Version` does not derive `Hash`. The upstream parity type is `PkgResolutionId` (which carries an optional peer-dep suffix), and the branded type should be introduced alongside peer-dep resolution and lockfile generation work to avoid locking the seam too early.

Applied to files:

  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-05-24T21:11:04.272Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In pacquet (pnpm/pnpm repo), `ResolvedPackage.optional` AND-folding intentionally mirrors pnpm's resolveDependencies.ts:1627-1648 revisit behavior: only the directly-visited package's `optional` flag is updated on revisit, not transitive descendants. pnpm CLI corrects stale optional flags via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`. Pacquet does not yet have this pruner equivalent, so raw `node.optional` flows directly into snapshot/virtual-store via `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up issue to port `copyDependencySubGraph` is planned.

Applied to files:

  • pacquet/crates/package-manager/src/update.rs
📚 Learning: 2026-06-04T14:40:25.306Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12189
File: pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs:435-439
Timestamp: 2026-06-04T14:40:25.306Z
Learning: In `pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs` (pnpm/pnpm repo), the pnpr install accelerator always invokes `Install` with `lockfile_only: true` (hard-coded in `pnpr/crates/pnpr/src/install_accelerator/resolve.rs`). Under `lockfile_only: true`:
1. The `PrefetchingResolver` wrapper is skipped — the bare `inner_resolver` is used instead, so `PrefetchContext { config }` is never constructed.
2. The function returns before `CreateVirtualStore` is reached, so `install_package_by_snapshot` and its `config.auth_headers` fetch path are never hit.
pnpr's tarball fetch is handled separately in `resolve::fetch_uncached`, which independently receives the request-scoped `auth_headers`. Therefore, `auth_override` only needs to be threaded into the resolver-side components (NpmResolver, TarballResolver, NamedRegistryResolver) — not into PrefetchingResolver or CreateVirtualStore — on the pnpr path. For local installs (`lockfile_only: false`), `auth_override` is always `None` a...

Applied to files:

  • pacquet/crates/package-manager/src/update.rs
🔇 Additional comments (10)
pacquet/crates/config/src/lib.rs (1)

287-309: LGTM!

Also applies to: 1264-1269

pacquet/crates/config/src/pnpm_default_parity.rs (1)

28-30: LGTM!

Also applies to: 141-141, 183-189

pacquet/crates/config/src/workspace_yaml.rs (1)

2-3: LGTM!

Also applies to: 409-410, 707-707

pacquet/crates/config/src/env_overlay.rs (1)

20-21: LGTM!

Also applies to: 205-205

pacquet/crates/config/src/workspace_yaml/tests.rs (1)

3-3: LGTM!

Also applies to: 1217-1242

pacquet/crates/package-manager/src/catalog_mode.rs (1)

1-145: LGTM!

pacquet/crates/package-manager/src/lib.rs (1)

6-6: LGTM!

Also applies to: 45-45

pacquet/crates/package-manager/src/catalog_mode/tests.rs (1)

1-165: LGTM!

pacquet/crates/package-manager/src/update.rs (1)

1-20: LGTM!

Also applies to: 126-142, 383-404, 414-417

pacquet/crates/cli/tests/update.rs (1)

414-458: LGTM!

@codecov-commenter

codecov-commenter commented Jun 4, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.40230% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.74%. Comparing base (3b76b8e) to head (a8f1a9c).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
pacquet/crates/config/src/pnpm_default_parity.rs 71.42% 2 Missing ⚠️
pacquet/crates/package-manager/src/catalog_mode.rs 98.07% 1 Missing ⚠️
pacquet/crates/package-manager/src/update.rs 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11706      +/-   ##
==========================================
+ Coverage   87.56%   87.74%   +0.18%     
==========================================
  Files         269      272       +3     
  Lines       30817    31169     +352     
==========================================
+ Hits        26984    27350     +366     
+ Misses       3833     3819      -14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

zkochan added a commit to shiminshen/pnpm that referenced this pull request Jun 4, 2026
Ports pnpm's catalogMode gate (the feature behind pnpm#11706) into pacquet:
a direct `update <pkg>@<version>` / `--latest` version is reconciled
against the matching `catalog:` entry under `catalogMode`. Strict rejects
a mismatch with ERR_PNPM_CATALOG_VERSION_MISMATCH, prefer warns and keeps
the direct version, manual is a no-op.

The comparison only treats both sides as equal when each parses as a
concrete semver version, so a ranged catalog entry (e.g. `^21.2.10`)
falls through to the mismatch path instead of being passed to an
exact-version comparison — the Rust analogue of pnpm guarding
`semver.eq` with `semver.valid` in pnpm#11706.

- config: add `CatalogMode` enum (default `manual`) + `Config.catalog_mode`,
  wired through `pnpm-workspace.yaml` and the env overlay; move
  `catalog-mode` from NOT_PORTED to a mapped row in the parity test.
- package-manager: `check_catalog_mode` + `CatalogVersionMismatchError`,
  invoked from `update` before the manifest is mutated. The previous
  specifier is looked up by `(name, group)` so an alias present in more
  than one dependency group keeps the right catalog group.

Not ported (pacquet hasn't ported the surrounding pieces): the `add`-path
cataloging that relies on `defaultCatalog` rewriting and the
`saveCatalogName` -> `pnpm-workspace.yaml` auto-cataloging half.

---
Written by an agent (Claude Code, claude-opus-4-8).
@zkochan
zkochan force-pushed the fix/catalog-range-spec-update-crash branch from b6ed81d to 61c944d Compare June 4, 2026 17:16

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@pacquet/crates/package-manager/src/catalog_mode/tests.rs`:
- Around line 129-164: The static EVENTS Mutex used by RecordingReporter can
retain logs across tests and cause flakiness; at the start of the test function
prefer_warns_and_keeps_the_direct_version_on_mismatch, acquire EVENTS.lock() and
clear the Vec (e.g., EVENTS.lock().unwrap().clear()) before exercising
check_catalog_mode so the test observes only events emitted during this run and
avoids cross-test pollution.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 462aa82f-09f4-4c5e-a34c-4c0d179ae4e2

📥 Commits

Reviewing files that changed from the base of the PR and between b6ed81d and 61c944d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (12)
  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/Cargo.toml
  • pacquet/crates/package-manager/src/catalog_mode.rs
  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/lib.rs
  • pacquet/crates/package-manager/src/update.rs
✅ Files skipped from review due to trivial changes (2)
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/lib.rs
🚧 Files skipped from review as they are similar to previous changes (9)
  • pacquet/crates/package-manager/Cargo.toml
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/cli/tests/update.rs
  • pacquet/crates/config/src/pnpm_default_parity.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/package-manager/src/update.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/package-manager/src/catalog_mode.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Code Coverage
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Lint and Test (macos-latest)
  • GitHub Check: Lint and Test (windows-latest)
  • GitHub Check: Lint and Test (ubuntu-latest)
  • GitHub Check: Compile & Lint
🧰 Additional context used
📓 Path-based instructions (1)
pacquet/**/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/*.rs: Log emissions are part of matching pnpm — when porting a function that fires pnpm:<channel> events through globalLogger, logger.debug(...), or streamParser.write(...), mirror the call site, payload, and ordering so @pnpm/cli.default-reporter parses pacquet's NDJSON the same way
Declare a newtype wrapper for branded string types instead of collapsing the brand into a plain String or &str in Rust
If upstream TypeScript always validates before construction of a branded string, validate in the Rust wrapper too via TryFrom<String> and/or FromStr and do not provide an infallible public constructor
If upstream TypeScript never validates a branded string, just brand for type-safety in Rust by exposing an infallible From<String> constructor
If upstream TypeScript occasionally constructs a branded string without validation, expose from_str_unchecked in Rust as an escape hatch alongside the validating constructor
Match upstream serde behavior for branded strings crossing JSON, YAML, or INI boundaries by using #[serde(try_from = "String")] for deserialization and #[serde(into = "String")] for serialization
Derive simple conversions for branded strings using #[derive(derive_more::From)] and #[derive(derive_more::Into)] instead of handwriting impl blocks; use manual impl only when conversion needs custom logic
Model TypeScript string literal unions (like 'auto' | 'always' | 'never') as Rust enums instead of newtype wrappers, since the set of valid values is closed
Treat TypeScript string template literal types (like `${string}@${string}`) the same as branded string types in Rust, using a newtype wrapper with validation
Follow the code style guide in CODE_STYLE_GUIDE.md — imports, modules, naming, ownership and borrowing, parameter type selection, trait bounds, pattern matching, pipe-trait, error handling, test layout, and cloning of Arc and Rc
Choose owned vs. borrowed parameters to minimize copies; widen to t...

Files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
🧠 Learnings (22)
📓 Common learnings
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: User-visible changes (CLI flags, defaults, environment variables, lockfile/manifest/state-file formats, error codes/messages, log emissions, store layout, hook semantics) in pnpm must be mirrored to pacquet in the same PR
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: Pacquet (pnpm's Rust port) has a cardinal rule: "match pnpm exactly — do not fix pnpm quirks unless the same fix has landed in pnpm first." Review comments should not suggest behavioral deviations from upstream pnpm, even when the upstream behavior appears buggy. If a real bug is identified, it must be fixed upstream first.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: In `pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs`, the `else` branch that calls `max_satisfying_any` is intentional and matches upstream pnpm's `hoistPeers.ts` (lines 45-59). When `is_exact_version && !auto_install_peers`, pnpm still runs `semver.maxSatisfying(versions, '*', { includePrerelease: true })` and picks the closest available preferred version; any version mismatch is reported downstream as a `bad` peer issue rather than dropping the edge. Do NOT suggest changing this branch to skip `max_satisfying_any` for exact ranges — it would diverge from pnpm.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In the pacquet Rust port (pnpm/pnpm repo), the `ResolvedPackage.optional` AND-folding on revisit intentionally mirrors pnpm's `resolveDependencies.ts:1627-1648` behavior: only the directly-revisited package's `optional` flag is updated; transitive descendants are not re-walked. pnpm CLI corrects stale optional flags downstream via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`, which tracks a `nonOptional` set and re-stamps any package reachable by an all-non-optional path. Pacquet does not yet have this pruner equivalent, so the stale flags flow directly through `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up to port `copyDependencySubGraph` is planned; until then, do not flag the resolver-layer optional propagation gap as a bug in pacquet PRs — it is intentional parity with pnpm's resolver layer.
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Match how the same feature is implemented in the TypeScript pnpm CLI — any change in pacquet must match pnpm's behavior, logic, edge cases, config resolution, error messages, file/lockfile formats, and existing tests
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11787
File: pacquet/crates/catalogs-resolver/src/lib.rs:156-167
Timestamp: 2026-05-20T22:49:17.652Z
Learning: In pacquet's `catalogs-resolver` crate (`pacquet/crates/catalogs-resolver/src/lib.rs`), the protocol detection pattern `catalog_lookup.split(':').next().unwrap_or("")` is an intentional byte-for-byte port of pnpm's upstream JavaScript `getProtocol`/split logic in `catalogs/resolver/src/resolveFromCatalog.ts#L95`. A bare value like `"workspace"` (without a colon) is deliberately classified as the `"workspace"` protocol, matching upstream behavior. pacquet's cardinal rule is to match upstream pnpm behavior including quirks; any behavioral change must land in pnpm first and then be ported here.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11774
File: pacquet/crates/resolving-deps-resolver/src/resolve_peers.rs:0-0
Timestamp: 2026-05-20T19:41:03.063Z
Learning: In the pacquet project (Rust), the semver crate used is `node-semver` (version ~2.2.0), NOT `nodejs-semver`. These are two distinct crates. `node-semver` only exposes `Range::satisfies` as its public satisfaction API — there is no separate `satisfies_with_prerelease` method. Prerelease-tolerant matching is handled inline by retrying against the stripped `MAJOR.MINOR.PATCH` base when `Range::satisfies` rejects a prerelease version.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11755
File: pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs:193-200
Timestamp: 2026-05-20T01:52:55.764Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/pick_package_from_meta.rs`, the package-level `modified` shortcut for the maturity/minimumReleaseAge filter uses inclusive `<=` (not strict `<`) when comparing `modified_date <= cutoff`. This mirrors the corrected behavior in pnpm (fixed in ab4c96ead5). The reasoning: `modified` is "last modification time," which is an upper bound on every version's `time[v]`. The per-version maturity filter uses `<=` (a version published exactly at the cutoff is mature). Since `modified == cutoff` means every version satisfies the per-version filter, the abbreviated-metadata fast path should accept this case rather than forcing a full-metadata re-fetch or raising `MissingTime`. The same fix was applied to pnpm TS: `pickPackage.ts` (×2) and `pickPackageFromMeta.ts`.
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In pacquet (pnpm/pnpm repo), `ResolvedPackage.optional` AND-folding intentionally mirrors pnpm's resolveDependencies.ts:1627-1648 revisit behavior: only the directly-visited package's `optional` flag is updated on revisit, not transitive descendants. pnpm CLI corrects stale optional flags via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`. Pacquet does not yet have this pruner equivalent, so raw `node.optional` flows directly into snapshot/virtual-store via `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up issue to port `copyDependencySubGraph` is planned.
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-05-25T12:36:42.202Z
Learning: Always explicitly include 'pnpm' in changeset files with appropriate version bump (patch, minor, or major)
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Tests that need the mocked registry should start `pnpr` through `pacquet-testing-utils`; `cargo test` / `cargo nextest run` should not require a separate `just registry-mock launch` step

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Port relevant pnpm tests to Rust tests whenever they translate when porting behavior from pnpm

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Use snapshot tests with `insta` and carefully review diffs when intentional changes alter snapshots; accept with `cargo insta review` only after careful review

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : Tests are documentation — do not duplicate test scenarios, edge cases, failure modes, or worked examples in prose when they are already captured by tests

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-23T16:55:36.507Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11878
File: pacquet/crates/cli/tests/lockfile_verification.rs:158-162
Timestamp: 2026-05-23T16:55:36.507Z
Learning: In `pacquet/crates/cli/tests/lockfile_verification.rs`, the `trust_lockfile_skips_verification` and `trust_lockfile_cli_flag_skips_verification` tests intentionally do NOT assert `output.status.success()`. The hand-rolled fixture lockfile uses a placeholder integrity hash (`sha512-AAA…`), so the install always fails the downstream tarball integrity check regardless of the supply-chain gate. The contract being tested is "gate-skipped, not install-succeeded"; asserting success would require generating a real lockfile via the `generate_lockfile` pattern (see `hoist.rs`) which is considered not worth the extra wiring for an opt-out smoke test.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Follow test-logging guidance — log before non-`assert_eq!` assertions, `dbg!` complex structures, skip logging for simple scalar `assert_eq!`

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Consult `plans/TEST_PORTING.md` before adding ported tests and update its checkboxes as items land; use `known_failures` modules and `pacquet_testing_utils::allow_known_failure!` at the not-yet-implemented boundary

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/tests/**/*.rs : Tests must not be tolerant of missing build/runtime environment by silently returning early when a tool isn't found — let the test panic when a required tool is absent

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T21:18:56.391Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11778
File: pacquet/crates/resolving-local-resolver/tests/resolve.rs:365-372
Timestamp: 2026-05-20T21:18:56.391Z
Learning: In `pacquet/crates/resolving-local-resolver/tests/resolve.rs`, the test `fail_when_resolving_from_not_existing_directory_an_injected_dependency` intentionally uses `injected: false`. The test is a verbatim port of the upstream pnpm TypeScript test (resolving/local-resolver/test/index.ts at ef87f3ccff). The `injected` flag only affects the file/link protocol choice for plain directory paths; when the `file:` scheme is explicit in the bare specifier, the flag has no effect on the resolution code path. The misleading test name is inherited from upstream.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:24.797Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pnpr/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:24.797Z
Learning: Applies to pnpr/**/pnpr/**/*.rs : Follow the pacquet contributing guide (../pacquet/CONTRIBUTING.md) for test layout and Rust conventions

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T23:08:06.093Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:08:06.093Z
Learning: In `pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs`, the `else` branch that calls `max_satisfying_any` is intentional and matches upstream pnpm's `hoistPeers.ts` (lines 45-59). When `is_exact_version && !auto_install_peers`, pnpm still runs `semver.maxSatisfying(versions, '*', { includePrerelease: true })` and picks the closest available preferred version; any version mismatch is reported downstream as a `bad` peer issue rather than dropping the edge. Do NOT suggest changing this branch to skip `max_satisfying_any` for exact ranges — it would diverge from pnpm.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T22:49:17.652Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11787
File: pacquet/crates/catalogs-resolver/src/lib.rs:156-167
Timestamp: 2026-05-20T22:49:17.652Z
Learning: In pacquet's `catalogs-resolver` crate (`pacquet/crates/catalogs-resolver/src/lib.rs`), the protocol detection pattern `catalog_lookup.split(':').next().unwrap_or("")` is an intentional byte-for-byte port of pnpm's upstream JavaScript `getProtocol`/split logic in `catalogs/resolver/src/resolveFromCatalog.ts#L95`. A bare value like `"workspace"` (without a colon) is deliberately classified as the `"workspace"` protocol, matching upstream behavior. pacquet's cardinal rule is to match upstream pnpm behavior including quirks; any behavioral change must land in pnpm first and then be ported here.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T20:41:50.322Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11773
File: pacquet/crates/package-manager/src/install_package_from_registry.rs:111-114
Timestamp: 2026-05-20T20:41:50.322Z
Learning: In pacquet (pnpm/pnpm repo, Rust codebase), `install_package_from_registry` is the npm-only install path. The npm resolver always stamps `ResolveResult.id` (a `PkgResolutionId`) as `nameversion`. Parsing it back through `PkgNameVer` with `.expect()` is intentional — a parse failure means a mis-dispatch bug, not malformed external input. Per pacquet's CLAUDE.md: "Don't add error handling, fallbacks, or validation for scenarios that can't happen. Trust internal code and framework guarantees." Do not suggest replacing such `.expect()` calls with graceful error handling.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T19:40:55.051Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11774
File: pacquet/crates/resolving-deps-resolver/src/resolve_peers.rs:0-0
Timestamp: 2026-05-20T19:40:55.051Z
Learning: In the pacquet Rust code, ensure the semver implementation uses the `node-semver` crate (not `nodejs-semver`). `node-semver`’s public API does not include a `satisfies_with_prerelease`-style method; prerelease-tolerant matching should be implemented inline by first calling `Range::satisfies`, and when it rejects a prerelease version, retry matching against a stripped `MAJOR.MINOR.PATCH` base of the prerelease version.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-25T14:58:11.105Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11931
File: pacquet/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs:560-589
Timestamp: 2026-05-25T14:58:11.105Z
Learning: In `pacquet/crates/resolving-npm-resolver/src/create_npm_resolution_verifier.rs`, all per-`(registry, name[, version])` caches in `NpmResolutionVerifier` (`published_at`, `full_meta`, `full_meta_for_trust`, `abbreviated_meta`, `local_meta`) intentionally use the same pattern: lock → miss-check → release lock → await fetch/load → re-acquire lock → insert. This uniform pattern is deliberate; do not flag individual caches for using it. The known follow-up improvement (replacing the pattern with `tokio::sync::OnceCell` per key inside a `Mutex<HashMap<…>>`) is tracked as a future structural change to cover all five caches simultaneously.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-28T16:19:30.483Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 12025
File: pacquet/crates/deps-path/src/link_path_to_peer_version.rs:0-0
Timestamp: 2026-05-28T16:19:30.483Z
Learning: In `pacquet/crates/deps-path/src/link_path_to_peer_version.rs`, the `link_path_to_peer_version` function intentionally deviates from upstream pnpm/JS behavior for non-BMP Unicode code points: the JavaScript `filenamify` v4 implementation sees UTF-16 code units and emits two surrogate fragments for a single non-BMP scalar, while the Rust port iterates `chars()` and emits one clean Unicode scalar. pnpm has no tests for non-ASCII link paths, so the behavior was undefined upstream; the Rust scalar form is the intentional, preferred behavior for pacquet.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-24T16:07:54.784Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11904
File: pacquet/crates/package-manager/src/install.rs:556-560
Timestamp: 2026-05-24T16:07:54.784Z
Learning: In pacquet's `is_modules_yaml_consistent` (pacquet/crates/package-manager/src/install.rs), `enableGlobalVirtualStore` is intentionally NOT checked as a separate field. Upstream pnpm's `validateModules.ts` does not persist or check `enableGlobalVirtualStore` in `.modules.yaml` either. Drift on this setting is caught indirectly: toggling `enableGlobalVirtualStore` changes `config.effective_virtual_store_dir()` (GVS-on → `<store>/v11/links`, GVS-off → `<project>/node_modules/.pnpm`), so the existing `modules.virtual_store_dir == config.effective_virtual_store_dir()` comparison in `is_modules_yaml_consistent` already detects the mismatch and prevents the short-circuit. Do not flag the absence of an explicit `enableGlobalVirtualStore` field as a bug.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-24T21:11:04.272Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11915
File: pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs:553-617
Timestamp: 2026-05-24T21:11:04.272Z
Learning: In the pacquet Rust port (pnpm/pnpm repo), the `ResolvedPackage.optional` AND-folding on revisit intentionally mirrors pnpm's `resolveDependencies.ts:1627-1648` behavior: only the directly-revisited package's `optional` flag is updated; transitive descendants are not re-walked. pnpm CLI corrects stale optional flags downstream via `copyDependencySubGraph` BFS in `lockfile/pruner/src/index.ts:160-205`, which tracks a `nonOptional` set and re-stamps any package reachable by an all-non-optional path. Pacquet does not yet have this pruner equivalent, so the stale flags flow directly through `dependencies_graph_to_lockfile.rs:409` → `create_virtual_store.rs:762` → `installability.rs:394`. A follow-up to port `copyDependencySubGraph` is planned; until then, do not flag the resolver-layer optional propagation gap as a bug in pacquet PRs — it is intentional parity with pnpm's resolver layer.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-29T18:03:15.372Z
Learnt from: CR
Repo: pnpm/pnpm PR: 0
File: pacquet/AGENTS.md:0-0
Timestamp: 2026-05-29T18:03:15.372Z
Learning: Applies to pacquet/**/*.rs : User-facing errors go through `miette` via the `pacquet-diagnostics` crate; match pnpm's error codes and messages where pnpm defines them since error codes are part of the public contract

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-22T00:08:44.646Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11837
File: pacquet/crates/resolving-npm-resolver/src/pick_package.rs:33-51
Timestamp: 2026-05-22T00:08:44.646Z
Learning: In the pnpm/pnpm repo’s pacquet Rust crates, do not flag Unicode ellipsis characters (U+2026, `…`) in Rust doc comments (`///` / `/** */`) as a lint violation. The pacquet crate’s `dylint.toml` only enables `perfectionist::derive_ordering`, and the Dylint `unicode-ellipsis` rule is not enabled for this project—so `…` in doc comments is an intentional, repo-consistent style.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
📚 Learning: 2026-05-20T23:07:58.444Z
Learnt from: zkochan
Repo: pnpm/pnpm PR: 11784
File: pacquet/crates/resolving-deps-resolver/src/hoist_peers.rs:120-133
Timestamp: 2026-05-20T23:07:58.444Z
Learning: When reviewing code in this pacquet Rust port, follow the upstream pnpm compatibility rule: only match pnpm’s behavior exactly. Do not propose review changes that intentionally deviate from pnpm’s documented/observed behavior, even if pnpm appears buggy. If you identify a real bug in pnpm behavior, the review should prioritize fixing it upstream in pnpm first, and avoid implementing a pnpm-behavior workaround here unless the same fix has already landed upstream.

Applied to files:

  • pacquet/crates/package-manager/src/catalog_mode/tests.rs
🔇 Additional comments (2)
pacquet/crates/package-manager/src/catalog_mode/tests.rs (2)

1-23: LGTM!


25-127: LGTM!

Ports pnpm's catalogMode gate (the feature behind pnpm#11706) into pacquet:
a direct `update <pkg>@<version>` / `--latest` version is reconciled
against the matching `catalog:` entry under `catalogMode`. Strict rejects
a mismatch with ERR_PNPM_CATALOG_VERSION_MISMATCH, prefer warns and keeps
the direct version, manual is a no-op.

The comparison only treats both sides as equal when each parses as a
concrete semver version, so a ranged catalog entry (e.g. `^21.2.10`)
falls through to the mismatch path instead of being passed to an
exact-version comparison — the Rust analogue of pnpm guarding
`semver.eq` with `semver.valid` in pnpm#11706.

- config: add `CatalogMode` enum (default `manual`) + `Config.catalog_mode`,
  wired through `pnpm-workspace.yaml` and the env overlay; move
  `catalog-mode` from NOT_PORTED to a mapped row in the parity test.
- package-manager: `check_catalog_mode` + `CatalogVersionMismatchError`,
  invoked from `update` before the manifest is mutated. The previous
  specifier is looked up by `(name, group)` so an alias present in more
  than one dependency group keeps the right catalog group.

Not ported (pacquet hasn't ported the surrounding pieces): the `add`-path
cataloging that relies on `defaultCatalog` rewriting and the
`saveCatalogName` -> `pnpm-workspace.yaml` auto-cataloging half.

---
Written by an agent (Claude Code, claude-opus-4-8).
@zkochan
zkochan force-pushed the fix/catalog-range-spec-update-crash branch from 61c944d to a8f1a9c Compare June 4, 2026 17:27
@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

Each scenario has pacquet rows (direct install) and pnpr rows (the same client through the pnpr install accelerator), so pnpr@HEAD vs pacquet@HEAD is the pnpr-vs-direct ratio. Cold-store scenarios wipe the client store between runs (warm server); hot-store scenarios keep it warm. The pacquet@HEAD rows feed the pacquet Bencher testbed; the pnpr@HEAD rows feed the pnpr testbed.

Scenario: Isolated linker: fresh restore, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 4.852 ± 0.087 4.773 5.044 2.39 ± 0.08
pacquet@main 4.817 ± 0.082 4.723 4.968 2.38 ± 0.08
pnpr@HEAD 2.035 ± 0.061 1.946 2.139 1.00 ± 0.04
pnpr@main 2.027 ± 0.055 1.955 2.105 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 4.852473090739999,
      "stddev": 0.0871202893075507,
      "median": 4.8289027101399995,
      "user": 2.3877916,
      "system": 3.80576024,
      "min": 4.77263414964,
      "max": 5.04397219764,
      "times": [
        4.79085449164,
        4.83481417464,
        4.84119638664,
        5.04397219764,
        4.96660652864,
        4.78772577064,
        4.77263414964,
        4.86436188764,
        4.79957407464,
        4.82299124564
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 4.81701663354,
      "stddev": 0.0816958070324808,
      "median": 4.78660376714,
      "user": 2.3936543,
      "system": 3.7877660399999997,
      "min": 4.72289582664,
      "max": 4.9681478416400005,
      "times": [
        4.9681478416400005,
        4.82254986064,
        4.76989588264,
        4.77222834964,
        4.75561018964,
        4.72289582664,
        4.77466127764,
        4.95075810164,
        4.83487274864,
        4.79854625664
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.0354412795399996,
      "stddev": 0.06112528272813397,
      "median": 2.03408290864,
      "user": 2.5754417,
      "system": 3.33627604,
      "min": 1.94606912464,
      "max": 2.13861427864,
      "times": [
        1.99846419264,
        1.96250871164,
        2.08331071664,
        2.09882616064,
        2.05760849764,
        2.00084529564,
        2.02169131264,
        2.04647450464,
        1.94606912464,
        2.13861427864
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.0269436787399995,
      "stddev": 0.0545321913522823,
      "median": 2.01276131914,
      "user": 2.5622455,
      "system": 3.3652882400000004,
      "min": 1.95451606064,
      "max": 2.10535571664,
      "times": [
        1.95451606064,
        1.98818348264,
        1.98272984964,
        2.0065593426399997,
        2.10535571664,
        1.97328510264,
        2.0707993016399997,
        2.01896329564,
        2.0843633056399997,
        2.08468132964
      ]
    }
  ]
}

Scenario: Isolated linker: fresh restore, hot cache + hot store

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 650.1 ± 29.4 632.5 732.4 1.00
pacquet@main 659.0 ± 11.4 646.7 686.2 1.01 ± 0.05
pnpr@HEAD 666.3 ± 21.1 640.8 716.0 1.02 ± 0.06
pnpr@main 740.2 ± 86.8 647.4 955.0 1.14 ± 0.14
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6500858329200001,
      "stddev": 0.02941205491777267,
      "median": 0.6440091988200001,
      "user": 0.35607932000000003,
      "system": 1.3071479399999997,
      "min": 0.6325372393199999,
      "max": 0.73244833232,
      "times": [
        0.73244833232,
        0.64449068832,
        0.64890335132,
        0.63847594732,
        0.64442663932,
        0.6325372393199999,
        0.64500910932,
        0.64359175832,
        0.63593786832,
        0.63503739532
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6589522513199999,
      "stddev": 0.011414138775909022,
      "median": 0.65588772082,
      "user": 0.36396591999999994,
      "system": 1.3375938399999998,
      "min": 0.64671249032,
      "max": 0.68622178932,
      "times": [
        0.68622178932,
        0.65641834632,
        0.65034948232,
        0.6523325223199999,
        0.66203362232,
        0.65909051432,
        0.65251571832,
        0.65535709532,
        0.64671249032,
        0.66849093232
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 0.6663302195199999,
      "stddev": 0.02106499144833389,
      "median": 0.6586833193199999,
      "user": 0.3567523199999999,
      "system": 1.3247253399999999,
      "min": 0.64076612232,
      "max": 0.71600118532,
      "times": [
        0.71600118532,
        0.65810349232,
        0.6559371953199999,
        0.65666897132,
        0.6592631463199999,
        0.67115149332,
        0.65768241032,
        0.68694751332,
        0.64076612232,
        0.66078066532
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 0.74022006322,
      "stddev": 0.08680553316870257,
      "median": 0.7379006213199999,
      "user": 0.37443262,
      "system": 1.32545874,
      "min": 0.64735317832,
      "max": 0.95495117032,
      "times": [
        0.95495117032,
        0.72627877932,
        0.7495224633199999,
        0.64735317832,
        0.66895619532,
        0.69134025232,
        0.67900902632,
        0.77206824532,
        0.76147408832,
        0.75124723332
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, cold cache + cold store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.144 ± 0.013 2.131 2.175 1.00
pacquet@main 2.150 ± 0.022 2.120 2.192 1.00 ± 0.01
pnpr@HEAD 2.159 ± 0.029 2.121 2.212 1.01 ± 0.01
pnpr@main 2.152 ± 0.033 2.101 2.195 1.00 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.14372747536,
      "stddev": 0.012754756459979286,
      "median": 2.13831125196,
      "user": 3.42072224,
      "system": 3.0206256799999998,
      "min": 2.13084852746,
      "max": 2.1746601604599998,
      "times": [
        2.1387703344599998,
        2.13650503946,
        2.14636957246,
        2.13450634846,
        2.15043518246,
        2.13084852746,
        2.13785216946,
        2.1504897124599998,
        2.1746601604599998,
        2.1368377064599997
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.15023556626,
      "stddev": 0.021998508954885445,
      "median": 2.15216363346,
      "user": 3.43546154,
      "system": 3.0235902799999996,
      "min": 2.12039023446,
      "max": 2.1923150084599996,
      "times": [
        2.17302802546,
        2.16093508146,
        2.12039023446,
        2.1923150084599996,
        2.13263947946,
        2.1551905624599996,
        2.13204977846,
        2.14913670446,
        2.13111489746,
        2.1555558904599996
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 2.15898252786,
      "stddev": 0.029450338013419786,
      "median": 2.1612433314599997,
      "user": 3.4115559399999995,
      "system": 3.0592256799999995,
      "min": 2.12089899346,
      "max": 2.2116232974599996,
      "times": [
        2.1815745064599996,
        2.13372692846,
        2.12089899346,
        2.13636438646,
        2.12676782346,
        2.1534680104599997,
        2.1752085104599996,
        2.1811741694599998,
        2.2116232974599996,
        2.1690186524599997
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 2.15220048066,
      "stddev": 0.033065000070969554,
      "median": 2.14582529446,
      "user": 3.3909848400000002,
      "system": 3.0784734800000004,
      "min": 2.10058154646,
      "max": 2.1953377824599998,
      "times": [
        2.1953377824599998,
        2.18421280846,
        2.17738661846,
        2.15148426646,
        2.14016632246,
        2.13767594046,
        2.1117028144599996,
        2.18890608646,
        2.1345506204599998,
        2.10058154646
      ]
    }
  ]
}

Scenario: Isolated linker: fresh install, hot cache + hot store

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.269 ± 0.013 1.250 1.294 1.02 ± 0.02
pacquet@main 1.263 ± 0.024 1.235 1.311 1.01 ± 0.03
pnpr@HEAD 1.249 ± 0.023 1.228 1.303 1.00
pnpr@main 1.284 ± 0.019 1.264 1.331 1.03 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.2685204261400003,
      "stddev": 0.012625368140556106,
      "median": 1.26757074914,
      "user": 1.3780939399999999,
      "system": 1.7061615199999998,
      "min": 1.24991753664,
      "max": 1.29382122364,
      "times": [
        1.29382122364,
        1.26899502564,
        1.2756715436400001,
        1.26377470564,
        1.27676185964,
        1.25294907864,
        1.2631758126400001,
        1.26614647264,
        1.24991753664,
        1.2739910026399999
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.2633558510399996,
      "stddev": 0.024293540832913393,
      "median": 1.2611066441399998,
      "user": 1.4031074399999997,
      "system": 1.6821113200000002,
      "min": 1.23489623864,
      "max": 1.31062525564,
      "times": [
        1.26713382764,
        1.25507946064,
        1.31062525564,
        1.27196086764,
        1.24532282864,
        1.29331787764,
        1.23723827564,
        1.26813777964,
        1.23489623864,
        1.24984609864
      ]
    },
    {
      "command": "pnpr@HEAD",
      "mean": 1.2485784985400001,
      "stddev": 0.0231068640999216,
      "median": 1.23680364764,
      "user": 1.36012754,
      "system": 1.6820109199999997,
      "min": 1.22769523564,
      "max": 1.30318593064,
      "times": [
        1.22769523564,
        1.25198884464,
        1.26243232364,
        1.26476240364,
        1.23630245164,
        1.30318593064,
        1.23182990464,
        1.23650803764,
        1.23398059564,
        1.23709925764
      ]
    },
    {
      "command": "pnpr@main",
      "mean": 1.2839961832399998,
      "stddev": 0.019194514578346943,
      "median": 1.2810616451399999,
      "user": 1.39118174,
      "system": 1.73194412,
      "min": 1.26350243264,
      "max": 1.33081766364,
      "times": [
        1.28010455364,
        1.29457483364,
        1.27928907364,
        1.26939700964,
        1.28201873664,
        1.33081766364,
        1.28828887664,
        1.26350243264,
        1.26622325364,
        1.28574539864
      ]
    }
  ]
}

@github-actions

github-actions Bot commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/11706
Testbedpacquet

🚨 1 Alert

BenchmarkMeasure
Units
ViewBenchmark Result
(Result Δ%)
Upper Boundary
(Limit %)
isolated-linker.fresh-restore.cold-cache.cold-storeLatency
seconds (s)
📈 plot
🚷 threshold
🚨 alert (🔔)
4.85 s
(+79.67%)Baseline: 2.70 s
3.24 s
(149.73%)

Click to view all benchmark results
BenchmarkLatencyBenchmark Result
milliseconds (ms)
(Result Δ%)
Upper Boundary
milliseconds (ms)
(Limit %)
isolated-linker.fresh-install.cold-cache.cold-store📈 view plot
🚷 view threshold
2,143.73 ms
(-6.40%)Baseline: 2,290.23 ms
2,748.28 ms
(78.00%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,268.52 ms
(-12.35%)Baseline: 1,447.33 ms
1,736.80 ms
(73.04%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
🚨 view alert (🔔)
4,852.47 ms
(+79.67%)Baseline: 2,700.76 ms
3,240.91 ms
(149.73%)

isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
650.09 ms
(-2.41%)Baseline: 666.14 ms
799.37 ms
(81.33%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit e7e99f0 into pnpm:main Jun 4, 2026
23 checks passed
zkochan added a commit that referenced this pull request Jun 4, 2026
…Name / catalog writes) (#12202)

* feat(package-manager): port catalogMode auto-cataloging to pacquet

Implements the auto-cataloging half of pnpm's `catalogMode` (the gate was
ported in #11706): under `catalogMode: strict`/`prefer` (or
`--save-catalog[-name]`), `add`/`update` write `catalog:`/`catalog:<name>`
to `package.json`, insert the entry into `pnpm-workspace.yaml`, and record
the resolved snapshot in `pnpm-lock.yaml`'s `catalogs:`.

- config: add `saveCatalogName`; move `save-catalog-name` out of the parity
  NOT_PORTED list
- new crate `pacquet-workspace-manifest-writer`: format-preserving
  (comment/blank-line/key-order/quote-style) catalog write-back, byte-for-byte
  with pnpm, on top of yamlpatch/yamlpath/yaml_serde
- lockfile: add `catalogs:` snapshot (CatalogSnapshots/ResolvedCatalogEntry)
- catalog_mode: `decide_catalog` per-dep decision (gate + auto-catalog)
- add: parse `pkg@version`; `--save-catalog`/`--save-catalog-name` flags
- update: route the catalog gate through the decision core, handling
  `--latest` on catalog deps

Closes #12196

* fix(package-manager): address review feedback on catalog auto-cataloging

- update: gate the `pnpm-workspace.yaml` write on `save` so `--no-save`
  persists nothing to disk, matching pnpm's `if (opts.save !== false)`
- workspace-manifest-writer: detect each block's child indent dynamically
  instead of assuming two spaces
- tests: assert the lockfile `catalogs:` snapshot in the named-catalog
  `update --latest` e2e test; add `--no-save` and four-space-indent cases
ByronDWall added a commit to commercetools/merchant-center-application-kit that referenced this pull request Aug 7, 2026
strict mode requires the requested version to be string-identical to the
catalog specifier, even when the catalog entry is a range (e.g. ^7.22.17)
that the requested version already satisfies. This breaks Renovate's
artifact-update flow: `pnpm update <pkg>@<version> --recursive
--lockfile-only` against any range-pinned catalog entry always fails with
ERR_PNPM_CATALOG_VERSION_MISMATCH, regardless of whether the version is
in range.

Confirmed via pnpm/pnpm#11570 (closed by pnpm/pnpm#11706) that this is
intentional pnpm behavior, not a bug pnpm intends to fix further —
strict mode is documented to require exact equality, not semver
satisfaction.

prefer warns on catalog drift instead of hard-failing, unblocking
targeted Renovate updates (currently affecting #4047, #4049, #4050).
scripts/check-workspace-constraints.js still enforces "every catalog-
listed dep must be consumed via its catalog reference" in CI, so that
guarantee is unaffected — only the exact-version-match requirement for
targeted updates is relaxed.
zkochan pushed a commit to ByronDWall/pnpm that referenced this pull request Aug 11, 2026
The catalogMode strict comparison rejected a wanted version whenever the
catalog entry was a semver range, even when that version fell squarely
inside the range. semver.valid() returns false for a range like
^7.22.17, so the existing check (both sides valid and equal) could never
succeed for range-based catalog entries, no matter what version was
requested. Every comparison fell through to CatalogVersionMismatchError.

This blocked pnpm update <pkg>@<version> --recursive --lockfile-only
against any workspace using catalogMode: strict with range-based catalog
entries, which is the common, documented, recommended way to declare a
catalog entry. Renovate's pnpm artifact-update flow runs exactly that
command, so this broke automated dependency updates on such workspaces.

The fix adds a second branch: when the catalog specifier is a valid
range and the wanted version satisfies it, the comparison now accepts
the dependency instead of throwing. Concrete-vs-concrete comparisons and
a wanted specifier that is itself a range still correctly fall through
to rejection, since semver.valid() on a range is still false.

This behavior was introduced by pnpm#11706, which fixed a crash in this same
comparison (passing a range to semver.eq() threw Invalid Version) but
deliberately preserved the reject-on-range behavior without addressing
whether range satisfaction should succeed. That question was raised in
pnpm#11570's own Expected Behavior section and never addressed.

Closes pnpm#11570

Written by an agent (Claude Code, claude-sonnet-5).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pnpm update <pkg>@<ver> --recursive --lockfile-only crashes with Invalid Version when catalog spec is a range

3 participants