Repository navigation
feat(pacquet-cli): implement pnpm peers command - #12706
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new Changespeers subcommand
shared URL encoding helpers
Sequence Diagram(s)sequenceDiagram
participant CliCommand
participant dispatch
participant dispatch_query
participant PeersArgs
CliCommand->>dispatch: route(CliCommand::Peers)
dispatch->>dispatch_query: peers(ctx, args)
dispatch_query->>PeersArgs: run(cfg, dir, recursive)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested labels
Suggested reviewers
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
PR Summary by Qodofeat(pacquet-cli): add peers and repo commands with lockfile checks and URL opening Description
Diagram
High-Level Assessment
Files changed (9)
|
Code Review by Qodo
1. Missing importer silently ignored
|
There was a problem hiding this comment.
Actionable comments posted: 11
🧹 Nitpick comments (2)
pacquet/crates/cli/src/cli_args/peers/tests.rs (1)
3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace the glob import with explicit test imports.
use super::*;violates the pacquet Rust import rule and also makes it harder to see which helpers this module is actually exercising. As per coding guidelines, "Do not use star imports inside module bodies; prefer explicit imports such asuse super::{Foo, bar}." As per path instructions,pacquet/CODE_STYLE_GUIDE.mdsays "Imports: avoid star/glob imports inside module bodies (nouse super::*;)."🤖 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/src/cli_args/peers/tests.rs` at line 3, Replace the glob import in the peers tests module with explicit imports from super; update the test module’s import statement to name only the helper types/functions it actually uses instead of `use super::*;`, following the import style used by the `peers/tests.rs` test code and keeping the test dependencies clear.Sources: Coding guidelines, Path instructions
pacquet/crates/cli/src/cli_args/repo/tests.rs (1)
1-1: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winReplace the glob import with explicit imports.
use super::*;breaks the pacquet Rust import rule and makes the test surface harder to track as this module grows. As per coding guidelines, "Do not use star imports inside module bodies; prefer explicit imports such asuse super::{Foo, bar}." As per path instructions, "Imports: avoid star/glob imports inside module bodies (nouse super::*;)."🤖 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/src/cli_args/repo/tests.rs` at line 1, Replace the glob import in the test module with explicit imports from super, listing only the items actually used by the tests. Update the import at the top of repo tests.rs to follow the module-body import rule and keep the test dependencies easy to audit as the module grows.Sources: Coding guidelines, Path instructions
🤖 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/cli/src/cli_args/peers.rs`:
- Around line 123-127: The importer selection in peers handling is too broad for
non-recursive runs because it expands to all workspace importers when
config.workspace_dir differs from the current directory. Update the logic around
the importer_ids assignment to use resolve_importer_id(lockfile_dir, dir) for
normal runs and only collect lockfile.importers.keys() when recursive is true,
so pacquet peers matches pnpm’s scoped behavior and avoids unrelated workspace
packages affecting the result.
- Around line 348-367: The have_common_version helper is using guessed candidate
versions instead of checking range overlap, which can misclassify open ranges as
conflicting. Update have_common_version in peers.rs to compute compatibility by
intersecting the version constraints directly rather than iterating over
extract_candidate_version results and probing with satisfies. Keep the existing
function name and call sites, but change the logic so any overlapping ranges are
recognized correctly.
- Around line 413-461: The filtering in peers handling updates
project_issues.missing and project_issues.intersections but leaves
project_issues.conflicts stale, so recompute conflicts after the pruning step in
the same loop. Update the logic around the issues.values_mut() processing in
peers.rs to rebuild conflicts from the filtered missing map before returning,
ensuring the JSON and text outputs stay consistent when ignoreMissing removes
all missing peers.
- Around line 81-84: The no-lockfile branch in peers handling currently prints
plain text via the peers command path, which breaks the machine-readable
contract for --json. Update the logic in the peers-related argument handling so
it checks the JSON output mode before emitting the “No lockfile found” message,
and in that case return a valid JSON shape instead of plain text. Keep the
behavior aligned with pnpm’s output contract by using the existing peers command
flow and its JSON output handling rather than unconditional println output.
- Around line 487-493: Scoped peer selectors are being parsed incorrectly
because `split_once('@')` in the `peers.rs` selector handling treats the leading
scope marker as the version separator, so `target_name` can become empty and
`allowedVersions` won’t match. Update the selector parsing logic around
`target_name` to ignore a leading scoped `@scope/` prefix and only split on the
version delimiter after the package name, so `match_all.entry(target_name)`
receives the correct scoped package key.
In `@pacquet/crates/cli/src/cli_args/peers/tests.rs`:
- Around line 214-232: Add a regression test for filter_peer_issues that
exercises parent-scoped allowedVersions, since the existing
parse_allowed_versions tests only cover parsing and not enforcement. Use
BadPeerIssue with parents set to match a rule like `@foo/bar`>react, then assert
filter_peer_issues keeps or filters the peer issue accordingly when the scoped
rule is present. Reuse the existing parse_allowed_versions and
filter_peer_issues symbols so the test verifies the behavior contract
end-to-end.
In `@pacquet/crates/cli/src/cli_args/repo.rs`:
- Around line 342-351: Add a safety comment for the unsafe ShellExecuteW call in
repo.rs explaining why the null pointers and the NUL-terminated url_wide buffer
satisfy the Windows API contract. Update the unsafe block around ShellExecuteW
to document the invariants being upheld, using the ShellExecuteW invocation and
url_wide construction as the key symbols to locate the change.
- Around line 60-108: get_repo_url_from_registry currently ignores the requested
version/range and always reads repository info from package.latest(), which can
point to the wrong release. Use the parsed spec from parse_wanted_dependency and
the resolved package data to select the matching packument entry for the
requested version before calling pick_repo_url. Update the repository lookup
logic in get_repo_url_from_registry so repo [email protected] resolves metadata from the
requested release instead of dist-tags.latest.
- Around line 211-212: The repository URL handling in repositoryToWebUrl is
missing common git forms, so valid git:// and scp-style git@host:owner/repo.git
inputs can fall through to Url::parse and trigger ERR_PNPM_NO_REPO_URL. Update
the early hosted-URL detection around try_hosted_url so it recognizes git:// as
well as scp-style git@ URLs, and route those cases through the hosted URL
conversion path before any generic parsing fallback.
In `@pacquet/crates/cli/src/cli_args/repo/tests.rs`:
- Around line 80-82: The monorepo URL expectations in the repository URL tests
are out of sync with the current repository_to_web_url behavior, which formats
directory links with HEAD instead of master. Update the assertions in the
relevant test cases in tests.rs to match the existing contract from
repository_to_web_url, or if master is the intended public shape, adjust
repository_to_web_url first and then keep the tests aligned. Use
repository_to_web_url and the monorepo URL test names as the anchor points when
updating both sides.
In `@pacquet/crates/cli/tests/repo.rs`:
- Around line 25-32: The repo CLI test is only matching a few substrings, so it
does not fully protect the public stderr contract for RepoError::NoRepoUrlLocal.
Tighten the assertion in the repo test to verify the complete expected guidance
sentence together with ERR_PNPM_NO_REPO_URL, using the stable diagnostic text
defined by the repo command implementation so wording regressions are caught.
Keep the check centered on the existing stderr assertion in the repo test and
update it to compare against the full message rather than partial fragments.
---
Nitpick comments:
In `@pacquet/crates/cli/src/cli_args/peers/tests.rs`:
- Line 3: Replace the glob import in the peers tests module with explicit
imports from super; update the test module’s import statement to name only the
helper types/functions it actually uses instead of `use super::*;`, following
the import style used by the `peers/tests.rs` test code and keeping the test
dependencies clear.
In `@pacquet/crates/cli/src/cli_args/repo/tests.rs`:
- Line 1: Replace the glob import in the test module with explicit imports from
super, listing only the items actually used by the tests. Update the import at
the top of repo tests.rs to follow the module-body import rule and keep the test
dependencies easy to audit as the module grows.
🪄 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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4953f9c5-fb51-487b-a1ca-f22678b29ff0
📒 Files selected for processing (9)
pacquet/crates/cli/src/cli_args.rspacquet/crates/cli/src/cli_args/cli_command.rspacquet/crates/cli/src/cli_args/dispatch.rspacquet/crates/cli/src/cli_args/dispatch_query.rspacquet/crates/cli/src/cli_args/peers.rspacquet/crates/cli/src/cli_args/peers/tests.rspacquet/crates/cli/src/cli_args/repo.rspacquet/crates/cli/src/cli_args/repo/tests.rspacquet/crates/cli/tests/repo.rs
|
Code review by qodo was updated up to the latest commit c32753a |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.1026432560799995,
"stddev": 0.1149770292116461,
"median": 4.10631621678,
"user": 3.9372966199999992,
"system": 3.52772282,
"min": 3.97104798428,
"max": 4.37024450528,
"times": [
4.11751452228,
3.97104798428,
4.37024450528,
4.13487992628,
4.15035768928,
4.09511791128,
3.99008246228,
4.06305523928,
4.13666304528,
3.99746927528
]
},
{
"command": "pacquet@main",
"mean": 3.9944649765799993,
"stddev": 0.09354125285277778,
"median": 3.98057488178,
"user": 3.8571911199999995,
"system": 3.4629822199999993,
"min": 3.8794575502799997,
"max": 4.18020569728,
"times": [
4.10684155628,
3.94292558728,
4.18020569728,
4.0048372922799995,
3.96755431628,
4.03862601428,
3.92984026628,
3.9935954472799997,
3.8794575502799997,
3.90076603828
]
},
{
"command": "pnpr@HEAD",
"mean": 2.15426637218,
"stddev": 0.1111824238624308,
"median": 2.1512984042800003,
"user": 2.66735922,
"system": 3.029309819999999,
"min": 2.00228606728,
"max": 2.29737109728,
"times": [
2.27862033128,
2.0198374702799997,
2.17690797328,
2.00228606728,
2.2269773422799997,
2.26889790528,
2.09742272628,
2.12568883528,
2.29737109728,
2.04865397328
]
},
{
"command": "pnpr@main",
"mean": 2.14867900068,
"stddev": 0.12219267166575039,
"median": 2.0987434497799997,
"user": 2.6204900199999996,
"system": 3.0210373199999987,
"min": 2.03868916728,
"max": 2.36972192128,
"times": [
2.36972192128,
2.09926638428,
2.13606108728,
2.07823630428,
2.03868916728,
2.23868235128,
2.33425158528,
2.04305081028,
2.0506098802799997,
2.09822051528
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6418296312999999,
"stddev": 0.0074453254742661065,
"median": 0.6402845794,
"user": 0.3987176,
"system": 1.3094685,
"min": 0.6326658929,
"max": 0.6581653069,
"times": [
0.6465889569000001,
0.6326658929,
0.6358595519,
0.6395293569,
0.6344775079,
0.6408564659,
0.6581653069,
0.6397126929,
0.6462222429,
0.6442183379
]
},
{
"command": "pacquet@main",
"mean": 0.6433761194,
"stddev": 0.01206172991836948,
"median": 0.6446973679000001,
"user": 0.3736731,
"system": 1.3237291,
"min": 0.6262782029,
"max": 0.6637101829000001,
"times": [
0.6537949729,
0.6431698579,
0.6462248779,
0.6324522839,
0.6539598419,
0.6302408779,
0.6356808449,
0.6637101829000001,
0.6482492509000001,
0.6262782029
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6905066708999998,
"stddev": 0.012980619499586022,
"median": 0.6887734154,
"user": 0.3978862,
"system": 1.3500695999999999,
"min": 0.6699083249000001,
"max": 0.7142080889,
"times": [
0.6699083249000001,
0.6810812149000001,
0.6927240019,
0.6857857649,
0.6937681529,
0.7081441689,
0.6912811609,
0.7142080889,
0.6819001609,
0.6862656699
]
},
{
"command": "pnpr@main",
"mean": 0.6943397882,
"stddev": 0.013737114966279853,
"median": 0.6961842844,
"user": 0.38929959999999997,
"system": 1.3468037,
"min": 0.6712848379,
"max": 0.7177091869000001,
"times": [
0.7074730909,
0.7024334369,
0.6873981689,
0.6997372519,
0.6943856749,
0.6849063079000001,
0.6979828939,
0.7177091869000001,
0.6712848379,
0.6800870319
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.24688452044,
"stddev": 0.04612292920093075,
"median": 4.23965137084,
"user": 3.7916856399999994,
"system": 3.3864395000000003,
"min": 4.178913361839999,
"max": 4.321270783839999,
"times": [
4.25409640884,
4.21106058084,
4.178913361839999,
4.22293095184,
4.20294083384,
4.26833124884,
4.22520633284,
4.321270783839999,
4.300505225839999,
4.2835894758399995
]
},
{
"command": "pacquet@main",
"mean": 4.245366665939999,
"stddev": 0.048284453433652945,
"median": 4.246969583339999,
"user": 3.760251939999999,
"system": 3.3715996000000006,
"min": 4.14842546584,
"max": 4.3052041678399995,
"times": [
4.14842546584,
4.20041577584,
4.253455091839999,
4.23513856784,
4.29552725384,
4.2404840748399995,
4.220762114839999,
4.295168674839999,
4.3052041678399995,
4.25908547184
]
},
{
"command": "pnpr@HEAD",
"mean": 2.2005868141400002,
"stddev": 0.10893745036371125,
"median": 2.1688670093400004,
"user": 2.5348892399999996,
"system": 2.9114792,
"min": 2.02882994084,
"max": 2.3459643478400003,
"times": [
2.3315410998400004,
2.12445582484,
2.18704026384,
2.32947481384,
2.1506937548400002,
2.25485730884,
2.3459643478400003,
2.12334578484,
2.1296650018400003,
2.02882994084
]
},
{
"command": "pnpr@main",
"mean": 2.1746917320400003,
"stddev": 0.15045631291427558,
"median": 2.1186306108400004,
"user": 2.49069054,
"system": 2.9111895,
"min": 1.99920441284,
"max": 2.46448384284,
"times": [
2.46448384284,
2.33685663284,
2.1200915948400003,
2.09469761784,
2.03376703184,
2.0866606778400003,
2.16983076184,
2.11716962684,
1.99920441284,
2.32415512084
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3436516506599998,
"stddev": 0.01688786564828589,
"median": 1.3412441822599999,
"user": 1.35416344,
"system": 1.6796418999999996,
"min": 1.32280103026,
"max": 1.37471399426,
"times": [
1.36656953226,
1.3414478452599998,
1.3319684862599999,
1.32280103026,
1.33350022526,
1.3507868512599999,
1.32572799426,
1.34796002826,
1.34104051926,
1.37471399426
]
},
{
"command": "pacquet@main",
"mean": 1.4176664801599999,
"stddev": 0.0811547993927226,
"median": 1.39281362976,
"user": 1.3235602400000002,
"system": 1.7729449,
"min": 1.38105236526,
"max": 1.6469071742599999,
"times": [
1.4038620762599998,
1.3957332242599998,
1.6469071742599999,
1.38989403526,
1.39717135726,
1.38224564626,
1.38311302526,
1.3856020412599999,
1.38105236526,
1.4110838562599999
]
},
{
"command": "pnpr@HEAD",
"mean": 0.67318557846,
"stddev": 0.029774927305360112,
"median": 0.6645808632600001,
"user": 0.34621324000000003,
"system": 1.2775877999999998,
"min": 0.6545232012600001,
"max": 0.7565059712600001,
"times": [
0.66281398426,
0.7565059712600001,
0.6650184972600001,
0.6545232012600001,
0.6688464672600001,
0.65914030926,
0.67469504826,
0.6608629142600001,
0.66414322926,
0.6653061622600001
]
},
{
"command": "pnpr@main",
"mean": 0.6653781855600001,
"stddev": 0.046230511358964305,
"median": 0.6519468202600001,
"user": 0.32816383999999993,
"system": 1.2735447999999998,
"min": 0.63702099026,
"max": 0.79334967426,
"times": [
0.6578520022600001,
0.6753953782600001,
0.65519689526,
0.65304174226,
0.63702099026,
0.65085189826,
0.6444967692600001,
0.6463458872600001,
0.64023061826,
0.79334967426
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0307918950600006,
"stddev": 0.054140963448469026,
"median": 3.02030452956,
"user": 1.8255780600000002,
"system": 1.9535120600000002,
"min": 2.98116995206,
"max": 3.15214051906,
"times": [
3.01777504006,
2.98387218106,
3.0956177730600003,
2.9885874120600002,
3.0228340190600003,
3.00296413606,
3.0311607300600003,
3.03179718806,
3.15214051906,
2.98116995206
]
},
{
"command": "pacquet@main",
"mean": 2.9913459187599996,
"stddev": 0.02940922733857478,
"median": 2.9901477080600003,
"user": 1.76898776,
"system": 1.95680276,
"min": 2.9535756930600003,
"max": 3.04884521606,
"times": [
2.9984864910600004,
2.9535756930600003,
2.98239461006,
2.9979008060600005,
2.9682287410600003,
2.9731077310600003,
2.9641679570600004,
3.02564302206,
3.04884521606,
3.00110892006
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6784901436599999,
"stddev": 0.00974835386847517,
"median": 0.67698023656,
"user": 0.35197736,
"system": 1.30925856,
"min": 0.6660734740600001,
"max": 0.6999893850600001,
"times": [
0.68238596706,
0.6999893850600001,
0.67392752906,
0.68003294406,
0.6722761860600001,
0.6660734740600001,
0.68499529506,
0.67254989606,
0.67021146706,
0.68245929306
]
},
{
"command": "pnpr@main",
"mean": 0.66630397836,
"stddev": 0.018785378060794458,
"median": 0.66783562906,
"user": 0.33671006000000003,
"system": 1.26682856,
"min": 0.63996318206,
"max": 0.70943153006,
"times": [
0.65570082306,
0.65152835406,
0.63996318206,
0.66825290806,
0.66741835006,
0.67677921006,
0.67128257306,
0.70943153006,
0.65417784706,
0.6685050060600001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.84823525136,
"stddev": 0.08304111846384664,
"median": 6.8395724951600005,
"user": 4.077625920000001,
"system": 3.75876502,
"min": 6.73104227666,
"max": 6.980230205660001,
"times": [
6.73104227666,
6.769246933660001,
6.96421275566,
6.77591826266,
6.980230205660001,
6.83512221466,
6.84402277566,
6.84585672666,
6.81844363166,
6.9182567306600005
]
},
{
"command": "pacquet@main",
"mean": 6.82974412926,
"stddev": 0.07301540368957164,
"median": 6.83981736866,
"user": 4.009920320000001,
"system": 3.76785652,
"min": 6.73155264966,
"max": 6.9507327956600005,
"times": [
6.84431590566,
6.83531883166,
6.7547527056600005,
6.88618853866,
6.7324057256600005,
6.811858490660001,
6.9507327956600005,
6.73155264966,
6.894247759660001,
6.85606788966
]
},
{
"command": "pnpr@HEAD",
"mean": 4.958437763260001,
"stddev": 0.10681104414778171,
"median": 4.93626846916,
"user": 2.7858786199999996,
"system": 3.23801792,
"min": 4.81003980066,
"max": 5.124106788660001,
"times": [
4.90868847866,
4.824267738660001,
5.10369643666,
4.81003980066,
4.9095016216600005,
5.124106788660001,
4.96207330066,
5.0025579676600005,
4.91046363766,
5.02898186166
]
},
{
"command": "pnpr@main",
"mean": 5.041732223160001,
"stddev": 0.1262900080333376,
"median": 5.00519871866,
"user": 2.76320882,
"system": 3.2344974199999994,
"min": 4.89011197966,
"max": 5.31352587666,
"times": [
4.927660358660001,
4.89011197966,
4.963461955660001,
5.158203165660001,
4.982383916660001,
5.04185515166,
5.00988921166,
5.31352587666,
5.12972238966,
5.00050822566
]
}
]
} |
|
| Branch | pr/12706 |
| Testbed | pnpr |
⚠️ WARNING: No Threshold found!Without a Threshold, no Alerts will ever be generated.
Click here to create a new Threshold
For more information, see the Threshold documentation.
To only post results if a Threshold exists, set the--ci-only-thresholdsflag.
Click to view all benchmark results
| Benchmark | Latency | milliseconds (ms) |
|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 2,200.59 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 678.49 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 673.19 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,154.27 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 4,958.44 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 690.51 ms |
|
Code review by qodo was updated up to the latest commit f80614a |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pacquet/crates/cli/src/cli_args/peers.rs (2)
331-334: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftDon’t use the first range as the merged intersection.
When multiple missing-peer ranges overlap, this stores
issues[0].wanted_range, which can be broader than the actual common constraint. For example,>=1.0.0 <3.0.0plus<2.0.0should not render/report>=1.0.0 <3.0.0as the safe intersection. Compute the real intersection or keep/render all contributing ranges. As per path instructions, peer/range behavior and output shape must mirror pnpm.🤖 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/src/cli_args/peers.rs` around lines 331 - 334, The overlap handling in the peer range merge logic is using the first entry’s wanted range as the combined result, which can overstate the actual safe intersection. Update the intersection path in the code around have_common_version and intersections.insert so it computes the real merged constraint from all issues, or preserves all contributing ranges for later rendering, instead of reusing issues[0].wanted_range. Make sure the resulting peer/range output shape stays aligned with pnpm’s behavior.Source: Path instructions
238-245: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftResolve linked peer versions before marking them bad.
This path reports every
link:peer as unsatisfied, even when a workspace-linked package’s manifest version satisfiespeer_range. Resolve the link target/importer version before creatingBadPeerIssue, or mirror pnpm’s upstream peer-issue source for linked peers. As per path instructions, pacquet behavior and output must match pnpm exactly.🤖 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/src/cli_args/peers.rs` around lines 238 - 245, The linked-peer branch in peers.rs is treating every dep_ref.as_link_target() case as unsatisfied, even when the workspace-linked package’s manifest version actually satisfies peer_range. Update the peer resolution flow to inspect the link target/importer package version before pushing a BadPeerIssue, and only record it as bad when that resolved version truly fails the range. Align the logic in this branch with pnpm’s upstream peer-issue handling for linked peers, using the existing BadPeerIssue construction path as the location to adjust.Source: Path instructions
🤖 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.
Outside diff comments:
In `@pacquet/crates/cli/src/cli_args/peers.rs`:
- Around line 331-334: The overlap handling in the peer range merge logic is
using the first entry’s wanted range as the combined result, which can overstate
the actual safe intersection. Update the intersection path in the code around
have_common_version and intersections.insert so it computes the real merged
constraint from all issues, or preserves all contributing ranges for later
rendering, instead of reusing issues[0].wanted_range. Make sure the resulting
peer/range output shape stays aligned with pnpm’s behavior.
- Around line 238-245: The linked-peer branch in peers.rs is treating every
dep_ref.as_link_target() case as unsatisfied, even when the workspace-linked
package’s manifest version actually satisfies peer_range. Update the peer
resolution flow to inspect the link target/importer package version before
pushing a BadPeerIssue, and only record it as bad when that resolved version
truly fails the range. Align the logic in this branch with pnpm’s upstream
peer-issue handling for linked peers, using the existing BadPeerIssue
construction path as the location to adjust.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 4960198b-93fb-482c-b536-7b3b304a4e1d
📒 Files selected for processing (1)
pacquet/crates/cli/src/cli_args/peers.rs
|
Code review by qodo was updated up to the latest commit f80614a |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #12706 +/- ##
==========================================
- Coverage 85.62% 84.98% -0.64%
==========================================
Files 413 414 +1
Lines 64343 65172 +829
==========================================
+ Hits 55093 55387 +294
- Misses 9250 9785 +535 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Code review by qodo was updated up to the latest commit 085d14e |
|
Code review by qodo was updated up to the latest commit 085d14e |
|
Code review by qodo was updated up to the latest commit 3444919 |
|
Code review by qodo was updated up to the latest commit 3444919 |
|
Code review by qodo was updated up to the latest commit 88a1f83 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 88a1f83 |
|
Code review by qodo was updated up to the latest commit 61854d2 |
|
Code review by qodo was updated up to the latest commit 51aca94 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 51aca94 |
|
Code review by qodo was updated up to the latest commit 849eb56 |
1 similar comment
|
Code review by qodo was updated up to the latest commit 849eb56 |
…n peers.rs Rename peers.rs violated two perfectionist lints: - import_granularity: split use statements merged into one - derive_ordering: Default must precede Clone in derive list
…aw_string in peers - rename single-letter closure params |r| -> |range|, |s| -> |seg| - use raw string literals for expected output in tests
Make the peers command deterministic and behaviorally identical to the TypeScript CLI: - Use BTreeMap for project, bad, missing, and intersection maps so JSON key order and rendered section order no longer vary between runs. - Share one visited set across importers and skip already-visited packages before evaluating their peers, matching pnpm's lockfile walker, which walks each package exactly once. - Resolve importer link: targets relative to the importer directory instead of the lockfile root; previously any link target from a non-root workspace package escaped the traversal guard and fell back to version 0.0.0. - Treat a missing lockfile as empty issues so the text mode prints "No peer dependency issues found" like pnpm, and emit per-importer empty entries when the lockfile has no packages section. - Use bright color variants matching chalk's yellowBright/cyanBright, dedupe packages per wanted range, and end the report with a newline. - Return PeersOutcome from PeersArgs::run and map it to the exit code in the dispatch layer, following the OutdatedOutcome/AuditOutcome pattern (clippy::exit never fires inside impl methods, so an expect attribute there is unfulfilled). - Replace the star import in the unit tests with explicit imports and fix a dylint raw-string warning.
|
Code review by qodo was updated up to the latest commit ab3298f |
…Missing filterPeerDependencyIssues pruned the missing and intersections maps but passed conflicts through unchanged, so a missing peer excluded via pnpm.peerDependencyRules.ignoreMissing could still surface as a conflict in the JSON output while the text output reported no issues. Keep only the conflicts whose peer survived the missing filter. This matches the pacquet peers command, which already recomputes conflicts from the filtered missing map.
|
Code review by qodo was updated up to the latest commit 3b2fe5e |
1 similar comment
|
Code review by qodo was updated up to the latest commit 3b2fe5e |
Summary
Implements the
pnpm peerscommand in the Rust pacquet port, matching the TypeScript CLI behavior: it reads the current (or wanted, with--lockfile-only) lockfile, walks each importer's dependency graph, and reports unmet and missing peer dependencies. Supports--json,--lockfile-only,-r/--recursive, honorspnpm.peerDependencyRules(ignoreMissing,allowAny,allowedVersionsincluding parent-scoped selectors), and exits non-zero when issues are found.Also fixes a bug in the TypeScript
@pnpm/deps.inspection.peers-checker: a missing peer excluded viapnpm.peerDependencyRules.ignoreMissingcould still surface as a stale conflict in the JSON output. The pacquet implementation recomputes conflicts after filtering; the TypeScript side now does the equivalent.Related to: #11633
Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Written by an agent (Claude Code, claude-fable-5).