Skip to content

feat(pacquet): port resolution/versions settings (#12042) - #12052

Merged
zkochan merged 1 commit into
mainfrom
resolution-settings
May 29, 2026
Merged

zkochan merged 1 commit into
mainfrom
resolution-settings

Conversation

@zkochan

@zkochan zkochan commented May 29, 2026 •

Copy link
Copy Markdown
Member

Ports the Resolution / versions section of the pacquet-parity tracking issue (#12042) to pacquet.

Full behavioral wiring

resolutionMode (highest / time-based / lowest-direct)

  • highest (default) — unchanged: highest satisfying version everywhere.
  • lowest-direct — direct deps resolve to their lowest satisfying version; transitive deps stay highest.
  • time-based — direct deps resolve lowest, and transitive deps are constrained to versions published no later than the newest resolved direct dep (+ 1h), clamped by minimumReleaseAge. The cutoff is computed workspace-wide in a pre-pass before the main tree walk.

The deps-resolver now hands the npm resolver per-depth ResolveOptions: importer (depth == 0) deps get the lowest-pick + minimumReleaseAge cutoff; transitive deps (depth > 0) get the highest-pick + the time-based cutoff. The wanted-dep memoization key was extended with the pick-affecting params so direct/transitive occurrences of the same spec don't collide (no change in highest mode).

registrySupportsTimeField

Gates the full-metadata fetch that time-based (and the no-downgrade trust policy) need for per-version publish dates: (time-based || no-downgrade) && !registrySupportsTimeField, mirroring pnpm's createNewStoreController.

Config-surface parity

Parsed from pnpm-workspace.yaml + PNPM_CONFIG_* env, stored on Config, and consumed once the surrounding feature lands — the same "parse now, consume when the architecture arrives" posture pacquet already uses for other not-yet-active settings:

  • allowedDeprecatedVersions — pacquet doesn't emit deprecation warnings yet.
  • updateConfig.ignoreDependencies — pacquet has no update/outdated command yet.
  • peerDependencyRules (ignoreMissing / allowAny / allowedVersions) — pacquet has no missing/bad peer-issue reporting pass yet.

Drive-by parity fix

minimumReleaseAge: 0 now disables the maturity cutoff (matching pnpm's falsy opts.minimumReleaseAge ? ... : undefined). While a cutoff is active the picker always prefers the highest mature version (pnpm's pickRespectingMinReleaseAge ignores the lowest-version preference), so disabling it is what lets lowest-direct / time-based actually take effect on direct deps.

Tests

  • Config parsing/apply_to for all 5 settings (+ env overlay) and the minimumReleaseAge: 0 disable helper.
  • deps-resolver: per-depth option threading for each mode; workspace-wide time-based cutoff computation + minimumReleaseAge clamp.
  • CLI e2e against the mock registry: highest picks @pnpm.e2e/[email protected], lowest-direct (with minimumReleaseAge: 0) picks @pnpm.e2e/[email protected].

just ready + just dylint pass. Pacquet-only change, so no changeset.


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

Summary by CodeRabbit

  • New Features

    • Added support for multiple dependency resolution modes (highest, time-based, lowest-direct) to control version selection strategy
    • New workspace settings: registry time-field support, allowed deprecated versions, update config, and peer-dependency rules
    • Environment variables and workspace YAML can now configure resolution mode and related settings
  • Tests

    • Added end-to-end and unit tests validating resolution modes and time-based transitive cutoff behavior

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 29, 2026 •

Copy link
Copy Markdown
Contributor

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: 45d3db4d-f98d-4b1d-8325-fd09e624fe90

📥 Commits

Reviewing files that changed from the base of the PR and between 9822b02 and a444053.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/src/build_resolution_verifiers.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/resolving-deps-resolver/Cargo.toml
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
🚧 Files skipped from review as they are similar to previous changes (14)
  • pacquet/crates/resolving-deps-resolver/Cargo.toml
  • pacquet/crates/package-manager/src/build_resolution_verifiers.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/config/src/lib.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). (2)
  • GitHub Check: Run benchmark on ubuntu-latest
  • GitHub Check: Lint and Test (macos-latest)

📝 Walkthrough

Walkthrough

Adds ResolutionMode config and workspace YAML/env parsing; implements depth-aware resolver options (pick_lowest_direct, published_by cutoff), a workspace pre-pass computing time-based transitive cutoff, threads mode into install/resolver wiring, and adds unit and integration tests including CLI e2e cases.

Changes

Resolution mode and dependency selection

Layer / File(s) Summary
ResolutionMode and Config schema
pacquet/crates/config/src/lib.rs
Adds ResolutionMode (Highest, TimeBased, LowestDirect), picks_lowest_direct(), new public Config fields, and resolved_minimum_release_age() with unit test.
Workspace YAML + env overlay
pacquet/crates/config/src/workspace_yaml.rs, pacquet/crates/config/src/env_overlay.rs
Extends WorkspaceSettings with resolutionMode, registrySupportsTimeField, allowedDeprecatedVersions, updateConfig, peerDependencyRules; adds UpdateConfig and PeerDependencyRules serde models; parses PNPM_CONFIG_* env vars and wires into Config.
Workspace YAML tests
pacquet/crates/config/src/workspace_yaml/tests.rs
New tests for resolutionMode round-trip, registrySupportsTimeField, allowedDeprecatedVersions, updateConfig.ignoreDependencies, and peerDependencyRules deserialization and apply_to wiring.

Depth-aware resolver architecture

Layer / File(s) Summary
TreeCtx, WantedKey, importer specs
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
Adds importer_direct_wanted_specs(); expands WantedKey with pick_lowest_version and published_by; refactors TreeCtx to hold direct_opts and subdep_opts and adds opts_for_depth / with_resolution_mode.
ResolveImporter options and initial wanted list
pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
Adds pick_lowest_direct: bool and subdep_published_by: Option<DateTime<Utc>> to ResolveImporterOptions; threads them into TreeCtx and uses importer_direct_wanted_specs for initial wanted specs.
Chrono dependency
pacquet/crates/resolving-deps-resolver/Cargo.toml
Adds workspace chrono dependency for DateTime/Utc support.

Workspace resolution and time-based cutoff

Layer / File(s) Summary
Workspace resolve orchestration
pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
Adds pick_lowest_direct and time_based to WorkspaceResolveOptions; pre-builds importer options; computes maximum_published_by; when time_based enabled runs compute_time_based_cutoff pre-pass to derive subdep_published_by (newest direct published_at +1h, clamped); injects values into importers.
Workspace resolve tests
pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
Adds RecordingResolver, fake_result, fake_manifest, option builders, and three async tests validating newest+1h cutoff, clamping by maximum, and lowest-direct behavior (no cutoff).

Resolver behavior validation

Layer / File(s) Summary
ResolveImporter tests
pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
Adds resolution_mode test module with RecordingResolver capturing (pick_lowest_version, published_by) per alias and tests for highest, lowest-direct, and time-based modes ensuring depth-specific options are passed.
Resolve dependency tree tests
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
Importer wanted-spec extraction and depth-aware caching logic updated and covered via the importer/importer/ workspace tests.

Install flow integration

Layer / File(s) Summary
InstallWithFreshLockfile wiring
pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
Derives time_based, pick_lowest_direct, and full_metadata from config.resolution_mode, config.trust_policy, and config.registry_supports_time_field; passes full_metadata into resolvers and propagates pick_lowest_direct/subdep_published_by into workspace/importer options.
Verifiers and test config
pacquet/crates/package-manager/src/build_resolution_verifiers.rs, pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
build_resolution_verifiers() uses config.resolved_minimum_release_age(); test fixture create_config() initializes new Config fields.
CLI e2e tests
pacquet/crates/cli/tests/install.rs
Adds two end-to-end tests asserting default (highest) resolution picks highest matching direct version and lowest-direct picks lowest direct version (with minimumReleaseAge: 0).

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

Possibly related PRs

  • pnpm/pnpm#11760: Upstream resolver plumbing for published_by/published cutoff this PR builds on.
  • pnpm/pnpm#12023: Related changes to multi-importer resolver flow; both modify resolve_workspace/importer wiring.
  • pnpm/pnpm#11794: Related full_metadata/resolver fast-path wiring.

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant ResolveWorkspace
  participant ComputeCutoff
  participant Resolver
  Installer->>ResolveWorkspace: run with pick_lowest_direct/time_based
  ResolveWorkspace->>ComputeCutoff: compute_time_based_cutoff (if time_based)
  ComputeCutoff->>Resolver: resolve direct deps (pick_lowest_direct)
  Resolver-->>ComputeCutoff: ResolveResult with published_at
  ComputeCutoff-->>ResolveWorkspace: subdep_published_by (newest+1h clamped)
  ResolveWorkspace->>Resolver: resolve importers with per-importer options
  Resolver-->>Installer: resolution results
Loading

Poem

🐰 "I hop the trees where versions hide,

I sniff the dates and check the tide,
When direct I choose the lowest beat,
When time calls, transitive cuts are neat—
A tidy workspace, resolved with pride!"

🚥 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 accurately and concisely describes the primary change: porting resolution and versions settings to pacquet. It aligns directly with the PR's main objective of implementing resolutionMode and related configuration features.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch resolution-settings

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.

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Review Summary by Qodo

Port resolution/versions settings and implement resolutionMode with time-based cutoff

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Port resolution/versions settings from pnpm parity tracking issue
• Implement resolutionMode with three modes: highest, time-based, lowest-direct
• Add registrySupportsTimeField to gate full-metadata fetches for time-based resolution
• Parse and store config surface settings: allowedDeprecatedVersions, updateConfig,
  peerDependencyRules
• Implement workspace-wide time-based cutoff pre-pass for transitive dependency constraints
• Fix minimumReleaseAge: 0 to disable maturity cutoff (matching pnpm behavior)
Diagram
flowchart LR
  Config["Config: resolutionMode<br/>registrySupportsTimeField<br/>allowedDeprecatedVersions<br/>updateConfig<br/>peerDependencyRules"]
  ResMode["ResolutionMode enum<br/>highest/time-based/lowest-direct"]
  DirectOpts["Direct deps options<br/>pick_lowest_version"]
  SubdepOpts["Subdep options<br/>published_by cutoff"]
  TimeCutoff["Time-based cutoff<br/>pre-pass"]
  Resolver["Resolver per-depth<br/>options threading"]
  
  Config --> ResMode
  ResMode --> DirectOpts
  ResMode --> SubdepOpts
  SubdepOpts --> TimeCutoff
  DirectOpts --> Resolver
  SubdepOpts --> Resolver
  TimeCutoff --> Resolver

Loading

Grey Divider

File Changes

1. pacquet/crates/config/src/lib.rs ✨ Enhancement +134/-1

Add ResolutionMode enum and config fields for resolution settings

pacquet/crates/config/src/lib.rs


2. pacquet/crates/config/src/workspace_yaml.rs ✨ Enhancement +60/-2

Parse resolution settings from pnpm-workspace.yaml

pacquet/crates/config/src/workspace_yaml.rs


3. pacquet/crates/config/src/env_overlay.rs ✨ Enhancement +7/-2

Add env var overlay for resolution settings

pacquet/crates/config/src/env_overlay.rs


View more (13)
4. pacquet/crates/config/src/workspace_yaml/tests.rs 🧪 Tests +114/-1

Test config parsing for resolution and peer dependency settings

pacquet/crates/config/src/workspace_yaml/tests.rs


5. pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs ✨ Enhancement +35/-11

Thread resolution mode into resolver and compute time-based cutoff

pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs


6. pacquet/crates/package-manager/src/build_resolution_verifiers.rs 🐞 Bug fix +1/-1

Use resolved_minimum_release_age helper for verifier options

pacquet/crates/package-manager/src/build_resolution_verifiers.rs


7. pacquet/crates/package-manager/src/install_package_from_registry/tests.rs 🧪 Tests +5/-0

Initialize new resolution config fields in test helper

pacquet/crates/package-manager/src/install_package_from_registry/tests.rs


8. pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs ✨ Enhancement +123/-5

Extend wanted-dep cache key with resolution mode parameters

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs


9. pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs ✨ Enhancement +123/-5

Extract importer_direct_wanted_specs for reuse in time-based cutoff

pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs


10. pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs ✨ Enhancement +29/-43

Add pick_lowest_direct and subdep_published_by to importer options

pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs


11. pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs ✨ Enhancement +29/-43

Thread resolution mode into TreeCtx with per-depth options

pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs


12. pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs 🧪 Tests +147/-0

Test per-depth resolution options for each resolution mode

pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs


13. pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs ✨ Enhancement +115/-4

Add time-based cutoff pre-pass and workspace-wide orchestration

pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs


14. pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs 🧪 Tests +283/-0

Test time-based cutoff computation and clamping logic

pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs


15. pacquet/crates/resolving-deps-resolver/Cargo.toml Dependencies +1/-0

Add chrono dependency for datetime handling

pacquet/crates/resolving-deps-resolver/Cargo.toml


16. pacquet/crates/cli/tests/install.rs 🧪 Tests +67/-0

Add e2e tests for resolution mode version picking

pacquet/crates/cli/tests/install.rs


Grey Divider

Qodo Logo

Port the "Resolution / versions" section of the pnpm-parity tracking
issue to pacquet.

Full behavioral wiring:

- `resolutionMode` (`highest` / `time-based` / `lowest-direct`): direct
  deps pick lowest under `time-based`/`lowest-direct`; `time-based`
  additionally constrains transitive deps to a publish-date cutoff
  (newest resolved direct dep + 1h, clamped by `minimumReleaseAge`),
  computed workspace-wide in a pre-pass.
- `registrySupportsTimeField`: gates the full-metadata fetch the
  `time-based` cutoff (and the `no-downgrade` trust policy) need —
  `(time-based || no-downgrade) && !registrySupportsTimeField`.

Config-surface parity (parsed + stored, consumed once the surrounding
feature lands, as pacquet already does for other not-yet-active
settings):

- `allowedDeprecatedVersions` (no deprecation warnings yet),
- `updateConfig.ignoreDependencies` (no `update`/`outdated` command yet),
- `peerDependencyRules` (no peer-issue reporting pass yet).

Also treat `minimumReleaseAge: 0` as disabled (matching pnpm's falsy
`opts.minimumReleaseAge ? ... : undefined` check). While a maturity
cutoff is active the picker always prefers the highest mature version,
so this is what lets `lowest-direct`/`time-based` take effect on direct
deps.

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

🧹 Nitpick comments (2)
pacquet/crates/config/src/env_overlay.rs (1)

185-189: ⚡ Quick win

Add direct tests for the new env-overlay keys.

These mappings currently rely on helper coverage only. A suffix typo or wrong parser macro here would silently drop the override, so please add from_pnpm_config_env assertions for RESOLUTION_MODE, REGISTRY_SUPPORTS_TIME_FIELD, ALLOWED_DEPRECATED_VERSIONS, UPDATE_CONFIG, and PEER_DEPENDENCY_RULES.

🤖 Prompt for 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.

In `@pacquet/crates/config/src/env_overlay.rs` around lines 185 - 189, Add
explicit unit tests that assert from_pnpm_config_env correctly maps the new
env-overlay keys: "RESOLUTION_MODE", "REGISTRY_SUPPORTS_TIME_FIELD",
"ALLOWED_DEPRECATED_VERSIONS", "UPDATE_CONFIG", and "PEER_DEPENDENCY_RULES";
specifically, write tests that set these env vars and call from_pnpm_config_env
to verify the resulting Config/Overlay has the expected values (exercise parsing
for enum_field! used for resolution_mode and json_field! used for the others),
so any suffix typos or macro/parser regressions will fail the assertions.
pacquet/crates/cli/tests/install.rs (1)

689-692: ⚡ Quick win

Make YAML append resilient to missing trailing newline.

If pnpm-workspace.yaml ever loses its trailing newline, this append can produce invalid YAML. Add a separator newline before appending.

Proposed fix
 let workspace_yaml = workspace.join("pnpm-workspace.yaml");
 let mut existing = fs::read_to_string(&workspace_yaml).expect("read pnpm-workspace.yaml");
+if !existing.ends_with('\n') {
+    existing.push('\n');
+}
 existing.push_str("resolutionMode: lowest-direct\nminimumReleaseAge: 0\n");
 fs::write(&workspace_yaml, existing).expect("write pnpm-workspace.yaml");
🤖 Prompt for 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.

In `@pacquet/crates/cli/tests/install.rs` around lines 689 - 692, The test appends
configuration lines to the pnpm-workspace.yaml by reading into existing, calling
existing.push_str(...), and writing back via fs::write, but if the file lacks a
trailing newline this produces invalid YAML; update the logic around
workspace_yaml/existing so you ensure a separating newline before appending
(e.g., check if existing.ends_with('\n') and if not, append one) and then append
the "resolutionMode: lowest-direct\nminimumReleaseAge: 0\n" string before
calling fs::write to make the YAML append resilient.
🤖 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.

Nitpick comments:
In `@pacquet/crates/cli/tests/install.rs`:
- Around line 689-692: The test appends configuration lines to the
pnpm-workspace.yaml by reading into existing, calling existing.push_str(...),
and writing back via fs::write, but if the file lacks a trailing newline this
produces invalid YAML; update the logic around workspace_yaml/existing so you
ensure a separating newline before appending (e.g., check if
existing.ends_with('\n') and if not, append one) and then append the
"resolutionMode: lowest-direct\nminimumReleaseAge: 0\n" string before calling
fs::write to make the YAML append resilient.

In `@pacquet/crates/config/src/env_overlay.rs`:
- Around line 185-189: Add explicit unit tests that assert from_pnpm_config_env
correctly maps the new env-overlay keys: "RESOLUTION_MODE",
"REGISTRY_SUPPORTS_TIME_FIELD", "ALLOWED_DEPRECATED_VERSIONS", "UPDATE_CONFIG",
and "PEER_DEPENDENCY_RULES"; specifically, write tests that set these env vars
and call from_pnpm_config_env to verify the resulting Config/Overlay has the
expected values (exercise parsing for enum_field! used for resolution_mode and
json_field! used for the others), so any suffix typos or macro/parser
regressions will fail the assertions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 40664095-49e8-4265-bb97-83bc95be81b6

📥 Commits

Reviewing files that changed from the base of the PR and between efcc336 and 9822b02.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (14)
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/package-manager/src/build_resolution_verifiers.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/resolving-deps-resolver/Cargo.toml
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/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). (1)
  • GitHub Check: Compile & Lint
🧰 Additional context used
📓 Path-based instructions (2)
pacquet/**/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/*.rs: Warnings are errors (--deny warnings in lint). Do not silence them with #[allow(...)] unless there is a specific, justified reason.
Choose owned vs. borrowed parameters to minimize copies; widen to the most encompassing type (&Path over &PathBuf, &str over &String) when it doesn't force extra copies.
Prefer Arc::clone(&x) / Rc::clone(&x) over x.clone() for reference-counted types, so the cost is visible at the call site.
Follow Rust API Guidelines for naming: https://rust-lang.github.io/api-guidelines/naming.html
No star imports inside module bodies. Write use super::{Foo, bar} instead of use super::*;, and the same for any other glob whose target is a module you control. Two forms stay allowed: external-crate preludes such as use rayon::prelude::*; and root-of-module re-exports such as pub use submodule::*; in a lib.rs.
Doc comments (///, //!) document the contract: preconditions, postconditions, panics, the reason the function exists. They are not a re-narration of the body.
Do not restate at call sites what the callee's doc comment already says. If /// on the function says 'no-op when …', the caller should not repeat that. Update the doc once; let every call site benefit.
Tests are documentation. Do not duplicate them in prose. If a behavioral scenario, edge case, failure mode, or worked example is already captured by a test, do not also narrate it in the doc comment on the implementation. The same applies in reverse: a test's own doc comment should not re-explain what the asserts already say, only the why if it is not obvious.
Use // SAFETY:, // TODO:, and similar prefixes to signal hidden invariants or known follow-ups that a reader cannot recover from the code alone.
When editing existing code, do not break a method chain (including pipe-trait .pipe(...) chains) into intermediate let bindings unless you can justify the rewrite. Valid justifications include a chain that fails to compile after your...

Files:

  • pacquet/crates/package-manager/src/build_resolution_verifiers.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
pacquet/**/{tests,test}/*.rs

📄 CodeRabbit inference engine (pacquet/AGENTS.md)

pacquet/**/{tests,test}/*.rs: Tests must not be tolerant of a missing build / runtime environment by silently returning early when a tool isn't found. If the test needs a tool, just call into it and let the existing .unwrap() / .expect(...) panic when the tool is absent.
Prefer platform-specific gates like #[cfg_attr(target_os = "windows", ignore = "...")] or #[cfg(unix)] over runtime probe-and-skip helpers for platform-locked tools, because the gate is visible to cargo test and shows up in the test report.
Follow the test-logging guidance in the style guide — log before non-assert_eq! assertions, dbg! complex structures, skip logging for simple scalar assert_eq!.

Files:

  • pacquet/crates/cli/tests/install.rs
🧠 Learnings (5)
📚 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/build_resolution_verifiers.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.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/build_resolution_verifiers.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.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/build_resolution_verifiers.rs
  • pacquet/crates/config/src/env_overlay.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/cli/tests/install.rs
  • pacquet/crates/package-manager/src/install_package_from_registry/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/package-manager/src/install_with_fresh_lockfile.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/config/src/workspace_yaml/tests.rs
  • pacquet/crates/config/src/lib.rs
  • pacquet/crates/config/src/workspace_yaml.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
📚 Learning: 2026-05-24T21:10:50.292Z
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:10:50.292Z
Learning: When implementing dependency “revisit”/optional-folding in pacquet, mirror pnpm’s `resolveDependencies.ts` behavior: on revisit, update the `optional` flag only for the directly visited package, and do not automatically change `optional` for transitive descendants. pnpm corrects stale optional flags later via `copyDependencySubGraph` (a BFS in `lockfile/pruner/src/index.ts`/`copyDependencySubGraph`). Until pacquet has an equivalent pruner/copy-subgraph step, be aware that the raw `node.optional` can flow through to the lockfile/virtual store via `dependencies_graph_to_lockfile.rs` → `create_virtual_store.rs` → `installability.rs`, so review changes that affect optional flag propagation for this mismatch.

Applied to files:

  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
📚 Learning: 2026-05-24T21:10:50.292Z
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:10:50.292Z
Learning: In pacquet’s Rust resolver layer, the behavior of `ResolvedPackage.optional` “AND-folding”/revisit updates is intentionally aligned with pnpm: when a package is directly revisited, only that package’s `optional` flag is updated; transitive descendants are not re-walked/rescored in this stage. pnpm later corrects any stale optional flags downstream via its pruner/BFS logic (`copyDependencySubGraph` + `nonOptional` reachability stamping in the lockfile pruner). Since pacquet does not yet have that pruner equivalent, review should NOT flag the downstream/stale optional propagation as a bug in pacquet PRs; treat the resolver-layer optional propagation gap as expected parity until the pruning/stamping step is ported.

Applied to files:

  • pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs
  • pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs
🔇 Additional comments (10)
pacquet/crates/resolving-deps-resolver/src/resolve_dependency_tree.rs (1)

247-287: LGTM!

Also applies to: 315-326, 461-541, 703-749

pacquet/crates/resolving-deps-resolver/src/resolve_importer.rs (1)

29-29: LGTM!

Also applies to: 47-48, 97-113, 166-167, 245-271

pacquet/crates/resolving-deps-resolver/Cargo.toml (1)

25-25: LGTM!

pacquet/crates/resolving-deps-resolver/src/resolve_workspace.rs (1)

23-28: LGTM!

Also applies to: 68-81, 121-153, 204-269

pacquet/crates/resolving-deps-resolver/src/resolve_importer/tests.rs (1)

94-95: LGTM!

Also applies to: 989-1132

pacquet/crates/resolving-deps-resolver/src/resolve_workspace/tests.rs (1)

1-283: LGTM!

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

14-14: LGTM!

Also applies to: 360-371, 400-407, 530-533, 616-617, 645-653

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

92-92: LGTM!

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

94-98: LGTM!

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

645-671: LGTM!

@zkochan
zkochan force-pushed the resolution-settings branch from 9822b02 to a444053 Compare May 29, 2026 00:39
@github-actions

Copy link
Copy Markdown
Contributor

Micro-Benchmark Results

Linux

group                          main                                   pr
-----                          ----                                   --
tarball/download_dependency    1.00      7.7±0.20ms   566.4 KB/sec    1.01      7.8±0.54ms   559.4 KB/sec

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.28571% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.99%. Comparing base (efcc336) to head (a444053).

Files with missing lines Patch % Lines
...lving-deps-resolver/src/resolve_dependency_tree.rs 93.22% 4 Missing ⚠️
...s/resolving-deps-resolver/src/resolve_workspace.rs 95.08% 3 Missing ⚠️
...es/resolving-deps-resolver/src/resolve_importer.rs 75.00% 2 Missing ⚠️
...package-manager/src/install_with_fresh_lockfile.rs 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   pnpm/pnpm#12052      +/-   ##
==========================================
+ Coverage   88.94%   88.99%   +0.04%     
==========================================
  Files         235      235              
  Lines       30930    31067     +137     
==========================================
+ Hits        27510    27647     +137     
  Misses       3420     3420              

☔ View full report in Codecov by Sentry.
📢 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.

@github-actions

Copy link
Copy Markdown
Contributor

Integrated-Benchmark Report (Linux)

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.093 ± 0.079 2.003 2.251 1.00 ± 0.05
pacquet@main 2.090 ± 0.056 2.023 2.168 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.09311149996,
      "stddev": 0.07859819367329422,
      "median": 2.0807677022599997,
      "user": 2.59384634,
      "system": 3.37154854,
      "min": 2.0033857662599996,
      "max": 2.2506567782599998,
      "times": [
        2.0033857662599996,
        2.2506567782599998,
        2.1017026632599998,
        2.16786828526,
        2.04869939426,
        2.0303756272599998,
        2.08535452226,
        2.0761808822599996,
        2.01056353126,
        2.15632754926
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.09041328096,
      "stddev": 0.05645458319202318,
      "median": 2.0779106152599995,
      "user": 2.67476554,
      "system": 3.3596562399999996,
      "min": 2.02349519026,
      "max": 2.16770069826,
      "times": [
        2.06309880426,
        2.02349519026,
        2.07089742826,
        2.16621616126,
        2.16770069826,
        2.0849238022599996,
        2.1626421682599997,
        2.0299068652599996,
        2.0942056392599997,
        2.04104605226
      ]
    }
  ]
}

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

Command Mean [ms] Min [ms] Max [ms] Relative
pacquet@HEAD 658.5 ± 20.6 640.8 713.0 1.01 ± 0.04
pacquet@main 650.4 ± 10.2 637.8 668.3 1.00
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 0.6584509090799999,
      "stddev": 0.02058717000436605,
      "median": 0.65441862928,
      "user": 0.35832169999999997,
      "system": 1.33224084,
      "min": 0.64084522678,
      "max": 0.7129660397800001,
      "times": [
        0.7129660397800001,
        0.65653732578,
        0.6497118377800001,
        0.65382725878,
        0.64084522678,
        0.64238145678,
        0.6550099997800001,
        0.66165189978,
        0.6640572907800001,
        0.64752075478
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 0.6503880554799999,
      "stddev": 0.010211095704321882,
      "median": 0.6490170792800001,
      "user": 0.3614345,
      "system": 1.32375314,
      "min": 0.63775642978,
      "max": 0.6683277767800001,
      "times": [
        0.6603992107800001,
        0.6570386057800001,
        0.6483138217800001,
        0.65818620378,
        0.63775642978,
        0.6416988867800001,
        0.64251828678,
        0.6399209957800001,
        0.6683277767800001,
        0.6497203367800001
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 2.307 ± 0.028 2.257 2.343 1.00
pacquet@main 2.332 ± 0.035 2.272 2.391 1.01 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 2.30665253922,
      "stddev": 0.028074467890449373,
      "median": 2.31755475792,
      "user": 3.7252862799999997,
      "system": 3.1425353800000004,
      "min": 2.2570905074199996,
      "max": 2.34319239342,
      "times": [
        2.3325632014199997,
        2.28945170442,
        2.31474041142,
        2.3203691044199997,
        2.27391811042,
        2.3275435324199996,
        2.2871352994199996,
        2.2570905074199996,
        2.3205211274199997,
        2.34319239342
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 2.33191823682,
      "stddev": 0.034946488417464935,
      "median": 2.3303125094199997,
      "user": 3.8276687800000007,
      "system": 3.12597648,
      "min": 2.27209616642,
      "max": 2.3906168264199996,
      "times": [
        2.3906168264199996,
        2.3544939114199996,
        2.31791967642,
        2.37406271342,
        2.27209616642,
        2.33133518042,
        2.3311026074199996,
        2.3236725154199998,
        2.3295224114199997,
        2.2943603594199997
      ]
    }
  ]
}

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

Command Mean [s] Min [s] Max [s] Relative
pacquet@HEAD 1.465 ± 0.023 1.431 1.516 1.00
pacquet@main 1.481 ± 0.019 1.455 1.517 1.01 ± 0.02
BENCHMARK_REPORT.json
{
  "results": [
    {
      "command": "pacquet@HEAD",
      "mean": 1.46451570864,
      "stddev": 0.023218218432645595,
      "median": 1.46371337274,
      "user": 1.6651248199999997,
      "system": 1.81947394,
      "min": 1.4314434707400001,
      "max": 1.51580602974,
      "times": [
        1.4403533987400001,
        1.44971776774,
        1.4314434707400001,
        1.47781860774,
        1.51580602974,
        1.46214959174,
        1.46527715374,
        1.47121690674,
        1.47253211674,
        1.45884204274
      ]
    },
    {
      "command": "pacquet@main",
      "mean": 1.4812276972400003,
      "stddev": 0.0189532640972597,
      "median": 1.47804481524,
      "user": 1.6825986199999998,
      "system": 1.8207404399999998,
      "min": 1.45541554874,
      "max": 1.51658268874,
      "times": [
        1.51658268874,
        1.46189541374,
        1.45541554874,
        1.4741603387400002,
        1.48192929174,
        1.49852816574,
        1.4674668077400002,
        1.47201379274,
        1.4984980917400001,
        1.4857868327400001
      ]
    }
  ]
}

@github-actions

Copy link
Copy Markdown
Contributor

🐰 Bencher Report

Branchpr/12052
Testbedpacquet
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,306.65 ms
(-1.96%)Baseline: 2,352.69 ms
2,823.23 ms
(81.70%)
isolated-linker.fresh-install.hot-cache.hot-store📈 view plot
🚷 view threshold
1,464.52 ms
(-0.29%)Baseline: 1,468.80 ms
1,762.56 ms
(83.09%)
isolated-linker.fresh-restore.cold-cache.cold-store📈 view plot
🚷 view threshold
2,093.11 ms
(-0.29%)Baseline: 2,099.30 ms
2,519.16 ms
(83.09%)
isolated-linker.fresh-restore.hot-cache.hot-store📈 view plot
🚷 view threshold
658.45 ms
(-3.62%)Baseline: 683.20 ms
819.84 ms
(80.31%)
🐰 View full continuous benchmarking report in Bencher

@zkochan
zkochan merged commit aa3135b into main May 29, 2026
28 checks passed
@zkochan
zkochan deleted the resolution-settings branch May 29, 2026 09:39
zkochan added a commit that referenced this pull request May 29, 2026
Port the "Resolution / versions" section of the pnpm-parity tracking
issue to pacquet.

Full behavioral wiring:

- `resolutionMode` (`highest` / `time-based` / `lowest-direct`): direct
  deps pick lowest under `time-based`/`lowest-direct`; `time-based`
  additionally constrains transitive deps to a publish-date cutoff
  (newest resolved direct dep + 1h, clamped by `minimumReleaseAge`),
  computed workspace-wide in a pre-pass.
- `registrySupportsTimeField`: gates the full-metadata fetch the
  `time-based` cutoff (and the `no-downgrade` trust policy) need —
  `(time-based || no-downgrade) && !registrySupportsTimeField`.

Config-surface parity (parsed + stored, consumed once the surrounding
feature lands, as pacquet already does for other not-yet-active
settings):

- `allowedDeprecatedVersions` (no deprecation warnings yet),
- `updateConfig.ignoreDependencies` (no `update`/`outdated` command yet),
- `peerDependencyRules` (no peer-issue reporting pass yet).

Also treat `minimumReleaseAge: 0` as disabled (matching pnpm's falsy
`opts.minimumReleaseAge ? ... : undefined` check). While a maturity
cutoff is active the picker always prefers the highest mature version,
so this is what lets `lowest-direct`/`time-based` take effect on direct
deps.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants