Repository navigation
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
📝 WalkthroughWalkthroughAdds ChangesWorkspace root selection
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CliArgs
participant WorkspaceDiscovery
participant Config
participant RecursiveSelector
CliArgs->>WorkspaceDiscovery: Resolve workspace root from --dir
WorkspaceDiscovery-->>CliArgs: Return root directory
CliArgs->>Config: Set workspace_root and resolved directory
Config->>RecursiveSelector: Apply root selector
RecursiveSelector-->>CliArgs: Select root project
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 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(cli): support --workspace-root (-w) in pacquet CLI
AI Description
Diagram
High-Level Assessment
Files changed (11)
|
Confidence Score: 5/5The PR appears safe to merge because no blocking failures eligible for this follow-up review remain. No blocking failure remains. Reviews (8): Last reviewed commit: "test(cli): pin --global conflict per sub..." | Re-trigger Greptile |
There was a problem hiding this comment.
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 `@pnpm/crates/cli/src/cli_args/recursive.rs`:
- Around line 423-426: Update the selector construction in the recursive
argument handling to make workspace_root take precedence over all explicit
filters: when set, use only the root selector and ignore both filters and
filter_prod; otherwise preserve existing filter selection behavior. Add a
regression test covering -r -w with an explicit project filter and assert that
execution targets only the workspace root.
🪄 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: dc34e9dd-ed32-457c-978d-d92e150f7986
📒 Files selected for processing (11)
.changeset/pacquet-workspace-root-flag.mdpnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/config.rspnpm/crates/cli/src/cli_args/dispatch.rspnpm/crates/cli/src/cli_args/recursive.rspnpm/crates/cli/src/cli_args/tests.rspnpm/crates/cli/src/lib.rspnpm/crates/cli/tests/add.rspnpm/crates/cli/tests/run_recursive.rspnpm/crates/config/src/lib.rspnpm/crates/package-manager/src/install_package_from_registry/tests.rs
Code Review by Qodo
Context used✅ Compliance rules (platform):
24 rules 1. Relative dir fallback remains
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Thanks — one finding fixed, one skipped with a reason. 2. "Workspace-root hides dir errors" — fixed in 203a6f4Agreed, and the inconsistency you point at with $ pnpm --dir ./packages/nope add foo -w
Error: ERR_PNPM_CANONICALIZE_DIR
× canonicalizing the `--dir` argument: /tmp/ws/packages/nope: No such file or directory (os error 2)
╰─▶ No such file or directory (os error 2)Covered by 1. "Root selector delimiter break" — skipping, not introduced hereReal, but pre-existing and not specific to It is also what the TypeScript CLI does, so it is not a divergence: filters.push({ filter: `!{${relativeWSDirPath()}}`, followProdDepsOnly: ... })Under this repo's parity rule a bug present in both stacks gets fixed in both, and your Option A (teaching Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 203a6f4 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
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 (1)
pnpm/crates/cli/tests/run_recursive.rs (1)
328-348: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winExercise the workspace-root selector from a project subdirectory.
CommandTempCwd::init()starts pacquet in the workspace root, so these cases only cover root-relative selection. Add one regression that invokes--dir workspace/project-1while assertingroot-ran.txtis created andworkspace/project-{1,2}/ran.txtare absent.Apply the same coverage path to the
-w --filtervariant as well.🤖 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 `@pnpm/crates/cli/tests/run_recursive.rs` around lines 328 - 348, Extend the recursive workspace-root selection tests around recursive_run_workspace_root_selects_only_the_root_project to invoke pacquet with --dir workspace/project-1, then assert root-ran.txt is created while workspace/project-1/ran.txt and workspace/project-2/ran.txt are absent. Add equivalent subdirectory coverage for the -w --filter variant, preserving the existing root-selection assertions.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 `@pnpm/crates/cli/tests/run_recursive.rs`:
- Around line 328-348: Extend the recursive workspace-root selection tests
around recursive_run_workspace_root_selects_only_the_root_project to invoke
pacquet with --dir workspace/project-1, then assert root-ran.txt is created
while workspace/project-1/ran.txt and workspace/project-2/ran.txt are absent.
Add equivalent subdirectory coverage for the -w --filter variant, preserving the
existing root-selection assertions.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: ad575839-0be0-49b5-b665-c6401a6825ee
📒 Files selected for processing (4)
pnpm/crates/cli/src/cli_args/cli_command.rspnpm/crates/cli/src/cli_args/recursive.rspnpm/crates/cli/src/cli_args/tests.rspnpm/crates/cli/tests/run_recursive.rs
🚧 Files skipped from review as they are similar to previous changes (2)
- pnpm/crates/cli/src/cli_args/tests.rs
- pnpm/crates/cli/src/cli_args/recursive.rs
|
Good catch on the coverage gap — done in b8a8e93, though not quite the way you framed it. Rather than add two more near-duplicate tests, I folded both recursive const WORKSPACE_ROOT_START_DIRS: [&str; 2] = [".", "project-1"];One correction to the premise, which I only found by testing it. I'd initially written that the member-dir case guards the What the cases do guard, verified by breaking it: stubbing out the The Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit b8a8e93 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
pnpm parses `--workspace-root` in its CLI arg pass: it points `--dir` at
the workspace root, and under `--recursive` it pushes a `{<root>}`
inclusion selector so the run narrows to the root project. pacquet
surfaced neither, so the `pnpm add -D <pkg> <pkg> -w` form from a
workspace subdirectory died in clap with `unexpected argument '-w'
found`.
Declare `-w` as a CLI-wide flag, apply the `--dir` redirect between the
`--filter` and recursive-by-default promotions (where pnpm applies it),
and thread it into `Config` alongside the other CLI-only selectors.
`AutoExcludeRoot::root_exclusion` becomes `root_selector`: under
`--workspace-root` it returns the `{<root>}` inclusion for every
recursive command, otherwise the existing `run` / `exec` / `add` /
`test` `!{<root>}` exclusion.
`--global` and a missing workspace are rejected with pnpm's
`ERR_PNPM_OPTIONS_CONFLICT` / `ERR_PNPM_NOT_IN_WORKSPACE` codes and
messages. `CliCommand::is_global` reassembles pnpm's CLI-wide
`--global` view from the per-subcommand flags pacquet declares.
Closes #13031
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
`apply_workspace_root` swallowed the `--dir` canonicalization failure and
walked the unresolved path instead, so a `--dir` that does not exist
surfaced as `ERR_PNPM_NOT_IN_WORKSPACE` — pointing at the wrong thing,
and inconsistent with dispatch, which reports the same failure with
context. `-w` no longer changes which error an unusable `--dir` produces.
Also pin the recursive selector semantics with a test: `--workspace-root`
appends `{<root>}` to the `--filter` selection rather than replacing it,
so `-r -w --filter <name>` runs the root *and* the filtered project.
That matches pnpm, which pushes the selector onto the same filter list
(`Scope: 2 of 3 workspace projects` for a three-project workspace), and
the doc comments no longer describe the flag as pinning the selection.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The recursive `--workspace-root` cases only ran from the workspace root,
while the flag exists to be used from a member project. Fold the two
cases into one helper parameterized over the starting `--dir` so each
asserts the same selection from a member as from the root.
Starting from a member does not discriminate the `--dir` redirect on its
own: with the redirect removed the selector becomes `{..}`, which still
resolves to the workspace root, so both cases still pass. What it does
cover is the whole path — redirect, manifest discovery, script lookup —
holding when the command starts inside a member. Breaking the inclusion
arm of `root_selector` fails both cases, which is the regression they
guard.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Micro-Benchmark ResultsLinux |
|
Code review by qodo was updated up to the latest commit 17bc527 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Took the one point that held and am declining the rest. Applied (1e600ee): the Declining the
Converting only the lines this PR happens to touch would make the diff inconsistent with its own files. Each retained comment also carries a non-obvious why rather than restating the code:
The remaining test-name overlap is a single line carrying the issue reference ( Written by an agent (Claude Code, claude-opus-5). |
|
Code review by qodo was updated up to the latest commit 1e600ee |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.6550155167,
"stddev": 0.12791128250488992,
"median": 2.6740666430999998,
"user": 1.5638215,
"system": 1.30934514,
"min": 2.3601578451,
"max": 2.8046030200999996,
"times": [
2.8046030200999996,
2.6278348681,
2.3601578451,
2.7484228891,
2.6901333461,
2.5782110421,
2.5916342571,
2.6579999401,
2.7668946010999997,
2.7242633581
]
},
{
"command": "pacquet@main",
"mean": 2.4764578476,
"stddev": 0.13242615396282165,
"median": 2.4002592771,
"user": 1.6108383,
"system": 1.33425224,
"min": 2.3566909360999997,
"max": 2.6926187511,
"times": [
2.3800233841,
2.6605348480999997,
2.4196423911,
2.5212302570999996,
2.6085958061,
2.3729625601,
2.6926187511,
2.3714033790999998,
2.3808761631,
2.3566909360999997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5507707730000004,
"stddev": 0.15387060287078208,
"median": 1.4923442676,
"user": 1.0562239,
"system": 1.2139759399999999,
"min": 1.3537833081000001,
"max": 1.7723217001000002,
"times": [
1.4390515261,
1.7022854751,
1.6591839971000002,
1.4974389741,
1.4872495611,
1.4028581681,
1.3537833081000001,
1.7723217001000002,
1.7467950101000003,
1.4467400101
]
},
{
"command": "pnpr@main",
"mean": 1.5412756347000003,
"stddev": 0.11501689748336755,
"median": 1.5641483056,
"user": 1.0603431,
"system": 1.19840664,
"min": 1.3906240961,
"max": 1.6754937091000002,
"times": [
1.3906240961,
1.5751954731000002,
1.4817138651000001,
1.5531011381,
1.4072539241000002,
1.5955251881,
1.6707471991000002,
1.6650700511,
1.3980317031,
1.6754937091000002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25792509816000003,
"stddev": 0.006069610183273688,
"median": 0.25795487226,
"user": 0.20954378,
"system": 0.5273716399999999,
"min": 0.24781798476000003,
"max": 0.26649985876000004,
"times": [
0.26246678576000004,
0.25141994676,
0.25455582476000005,
0.25668943976,
0.26486926576,
0.25397314176,
0.24781798476000003,
0.25922030476,
0.26173842876000003,
0.26649985876000004
]
},
{
"command": "pacquet@main",
"mean": 0.25525323726,
"stddev": 0.006835731755646036,
"median": 0.25568729126,
"user": 0.21089648,
"system": 0.53394414,
"min": 0.24280196476000002,
"max": 0.26317887076,
"times": [
0.24736270076000003,
0.25700282376,
0.26108267676,
0.25418218276000004,
0.26239833576000005,
0.25005798676,
0.26009307176,
0.26317887076,
0.25437175876,
0.24280196476000002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.27447622706,
"stddev": 0.03202298998526718,
"median": 0.26603453626000007,
"user": 0.23523547999999997,
"system": 0.52713394,
"min": 0.25329377676000003,
"max": 0.36139961976,
"times": [
0.26656707576000005,
0.28099879676,
0.25668633076,
0.25572452676,
0.25329377676000003,
0.25521984876000003,
0.26550199676,
0.27434082876000004,
0.36139961976,
0.27502946976000003
]
},
{
"command": "pnpr@main",
"mean": 0.2795400148600001,
"stddev": 0.006908929474328707,
"median": 0.28042259676000003,
"user": 0.22438837999999994,
"system": 0.54608394,
"min": 0.27052153276,
"max": 0.29132199276000004,
"times": [
0.28350026976000003,
0.29132199276000004,
0.28307491176000005,
0.27660539576000004,
0.28322378176,
0.27052153276,
0.27777028176,
0.27258656676000004,
0.28564333976,
0.27115207576
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.78544190916,
"stddev": 0.01730247535534297,
"median": 2.7866891665599995,
"user": 1.78783712,
"system": 1.3511924,
"min": 2.75670365456,
"max": 2.81656534056,
"times": [
2.79029899656,
2.7947187685599997,
2.76596363656,
2.7876678885599997,
2.80058090756,
2.78571044456,
2.7722359005599997,
2.75670365456,
2.7839735535599996,
2.81656534056
]
},
{
"command": "pacquet@main",
"mean": 2.7869771640599996,
"stddev": 0.034992410016748056,
"median": 2.77911333556,
"user": 1.7737336199999998,
"system": 1.336711,
"min": 2.7363568305599997,
"max": 2.8526593975599996,
"times": [
2.79085090356,
2.83245476756,
2.8064555365599997,
2.8526593975599996,
2.78065753256,
2.7631286995599997,
2.7638472685599997,
2.7363568305599997,
2.76579156556,
2.77756913856
]
},
{
"command": "pnpr@HEAD",
"mean": 1.65694032376,
"stddev": 0.18433106209913105,
"median": 1.6316476075600002,
"user": 1.07797352,
"system": 1.2414329,
"min": 1.43960722956,
"max": 1.9666940745600001,
"times": [
1.46866202356,
1.6890883595600001,
1.9666940745600001,
1.7864548855600002,
1.8028107395600002,
1.57357645256,
1.44277086356,
1.5742068555600002,
1.8255317535600002,
1.43960722956
]
},
{
"command": "pnpr@main",
"mean": 1.5704806816599999,
"stddev": 0.157616736815579,
"median": 1.5058918290599999,
"user": 1.09305272,
"system": 1.1626301,
"min": 1.42671407556,
"max": 1.8720625345600002,
"times": [
1.50616976556,
1.4303074395600002,
1.8149204255600002,
1.6565159745600002,
1.42671407556,
1.48929478056,
1.50561389256,
1.52087471156,
1.48233321656,
1.8720625345600002
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6377376554199998,
"stddev": 0.024950382739157822,
"median": 0.6444320001199999,
"user": 0.78711726,
"system": 0.69463436,
"min": 0.60439003462,
"max": 0.67183812362,
"times": [
0.66439860162,
0.6451812716199999,
0.64707525462,
0.67183812362,
0.65831706962,
0.62929231462,
0.60439003462,
0.60499290562,
0.60820824962,
0.64368272862
]
},
{
"command": "pacquet@main",
"mean": 0.59829271102,
"stddev": 0.047718295185790856,
"median": 0.59022445262,
"user": 0.7298072600000001,
"system": 0.66863216,
"min": 0.55661874162,
"max": 0.72548576362,
"times": [
0.59476095562,
0.59298379062,
0.58746511462,
0.57211077162,
0.56969735262,
0.72548576362,
0.55661874162,
0.60839415862,
0.60489849862,
0.57051196262
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30601121412,
"stddev": 0.009075486860824504,
"median": 0.30654622762000006,
"user": 0.20779606,
"system": 0.5223246600000001,
"min": 0.29447213662000005,
"max": 0.31777285062000005,
"times": [
0.31777285062000005,
0.31081626562000003,
0.29955225962000004,
0.29447213662000005,
0.29591104562000003,
0.31730828762,
0.30879037362,
0.29652821462,
0.31465862562,
0.30430208162000005
]
},
{
"command": "pnpr@main",
"mean": 0.32266848802000003,
"stddev": 0.008107159488188062,
"median": 0.32072721362,
"user": 0.21418435999999996,
"system": 0.54978966,
"min": 0.31238898862000003,
"max": 0.33799196762000006,
"times": [
0.31828787962000005,
0.32603547862000004,
0.31690705062,
0.31238898862000003,
0.31973234762,
0.33799196762000006,
0.32182759662000004,
0.33473550162000004,
0.32172207962000005,
0.31705598962000003
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.963722705,
"stddev": 0.0428418113232632,
"median": 1.9515746853000002,
"user": 1.0368162,
"system": 0.7696482,
"min": 1.9257668308000002,
"max": 2.0756338968,
"times": [
1.9660167768,
1.9436917748,
1.9446223788,
1.9630484308000002,
1.9257668308000002,
1.9319416798,
1.9833559108,
2.0756338968,
1.9583422848,
1.9448070858000002
]
},
{
"command": "pacquet@main",
"mean": 1.9131928731999999,
"stddev": 0.01351692427213345,
"median": 1.9128934263000001,
"user": 0.9644486999999999,
"system": 0.7431092000000001,
"min": 1.8891082638,
"max": 1.9339151758000002,
"times": [
1.9246241388,
1.9269396828,
1.9193314158,
1.9105316148,
1.9073013028,
1.9032218778,
1.8891082638,
1.9017000218,
1.9152552378,
1.9339151758000002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29545281700000003,
"stddev": 0.00606439152127806,
"median": 0.2969094588,
"user": 0.1903279,
"system": 0.4912800999999999,
"min": 0.2846039238,
"max": 0.30487932980000004,
"times": [
0.2989901988,
0.29242973780000003,
0.2950147698,
0.30487932980000004,
0.29760749280000004,
0.2997993668,
0.2962114248,
0.29801834580000003,
0.2846039238,
0.2869735798
]
},
{
"command": "pnpr@main",
"mean": 0.3113332331,
"stddev": 0.0066463340659391155,
"median": 0.3104100033,
"user": 0.215197,
"system": 0.5436356,
"min": 0.3008926878,
"max": 0.32585499980000004,
"times": [
0.3144869878,
0.30899825880000004,
0.30687169880000004,
0.3069935668,
0.3008926878,
0.3158235958,
0.32585499980000004,
0.31019553580000003,
0.3106244708,
0.31259052880000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.37507816128,
"stddev": 0.025788626410388354,
"median": 0.37409759268000004,
"user": 0.36729910000000004,
"system": 0.060870539999999994,
"min": 0.34366684468,
"max": 0.42832236568000004,
"times": [
0.42832236568000004,
0.39448125868000006,
0.39459601068000005,
0.36265932668000006,
0.3784188666800001,
0.34892559068000006,
0.37407470468000004,
0.37412048068000003,
0.35151616368000005,
0.34366684468
]
},
{
"command": "pacquet@main",
"mean": 0.3658855810800001,
"stddev": 0.009657802693326915,
"median": 0.36641031268,
"user": 0.3573326,
"system": 0.057653640000000006,
"min": 0.34977292368000007,
"max": 0.3782355726800001,
"times": [
0.34977292368000007,
0.35094050368000007,
0.3782355726800001,
0.37595047468000004,
0.36941965968000007,
0.36629179068000006,
0.36444599668000005,
0.37465171768000005,
0.36652883468,
0.36261833668000004
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08620611496125,
"stddev": 0.0023329054468315268,
"median": 0.08679725868,
"user": 0.019734906249999996,
"system": 0.009692866875,
"min": 0.08185144368000001,
"max": 0.09028334568,
"times": [
0.08945033268000001,
0.08500620368,
0.08987279468,
0.08877405368,
0.08654073268000001,
0.08969814668000001,
0.08595373068,
0.08758720568,
0.08559592068,
0.08194858568,
0.08324251368,
0.08730332368,
0.08685565268,
0.08322890768,
0.08754983568000001,
0.08720563968,
0.08723326268,
0.08221401368,
0.08436925768,
0.08672840568000001,
0.08721233268,
0.08692785868000001,
0.08753716168,
0.08673886468,
0.08691791968000001,
0.09028334568,
0.08707575668,
0.08541454968000001,
0.08621466068,
0.08185144368000001,
0.08302564668000001,
0.08303761868000001
]
},
{
"command": "pnpr@main",
"mean": 0.08719352880121213,
"stddev": 0.0008524595104409554,
"median": 0.08721319468000001,
"user": 0.01942263636363636,
"system": 0.01050655393939394,
"min": 0.08485335668,
"max": 0.08829338168,
"times": [
0.08583759368,
0.08829338168,
0.08724550468,
0.08654540168000001,
0.08630860668000001,
0.08721319468000001,
0.08734387868,
0.08667023568,
0.08678179468000001,
0.08710710568,
0.08707636768,
0.08765407168,
0.08756770968000001,
0.08718294768000001,
0.08767453068,
0.08527259268000001,
0.08788209968,
0.08708789968000001,
0.08785781368000001,
0.08822121668,
0.08703457968,
0.08678909868000001,
0.08666020668,
0.08783326868,
0.08716107668,
0.08828909268,
0.08608198168,
0.08813452268000001,
0.08772413368000001,
0.08822061468,
0.08752461868,
0.08485335668,
0.08825595168
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.554857967219999,
"stddev": 0.13795111791217968,
"median": 4.49197866982,
"user": 1.92294858,
"system": 1.4751998,
"min": 4.43945253482,
"max": 4.80962164282,
"times": [
4.45231050582,
4.46211957482,
4.43945253482,
4.57857130182,
4.6024072578199995,
4.45334514282,
4.77664935182,
4.52183776482,
4.80962164282,
4.45226459482
]
},
{
"command": "pacquet@main",
"mean": 4.56300351092,
"stddev": 0.1315751955883205,
"median": 4.51035723682,
"user": 1.9450809799999995,
"system": 1.4798079,
"min": 4.45870255382,
"max": 4.8558430998199995,
"times": [
4.51827885682,
4.65771402682,
4.51905646382,
4.8558430998199995,
4.49180042982,
4.50243561682,
4.69745841182,
4.46394767682,
4.45870255382,
4.46479797282
]
},
{
"command": "pnpr@HEAD",
"mean": 3.55030827152,
"stddev": 0.08346849346685316,
"median": 3.53679559282,
"user": 1.26243358,
"system": 1.3148723999999998,
"min": 3.4489697438199998,
"max": 3.71690668882,
"times": [
3.5576868248199998,
3.71690668882,
3.53985152882,
3.53677330182,
3.67399205782,
3.51277160782,
3.4489697438199998,
3.53681788382,
3.48311984182,
3.49619323582
]
},
{
"command": "pnpr@main",
"mean": 3.5685199626199995,
"stddev": 0.12425720327080687,
"median": 3.4979049883199997,
"user": 1.30748848,
"system": 1.2866431,
"min": 3.4547931518199997,
"max": 3.77848968782,
"times": [
3.4547931518199997,
3.65213529382,
3.4686358398199997,
3.75380913982,
3.5064338138199997,
3.47143423082,
3.4893761628199997,
3.62829231982,
3.77848968782,
3.48179998582
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13281 |
| 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 | 1,439.61 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 284.60 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 294.47 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 81.85 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,353.78 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,448.97 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 253.29 ms |
…laced `is_global` reassembles pnpm's CLI-wide `--global` from eleven per-subcommand flags, but only `add` was tested — the doc comment described the rest instead of asserting it. Drive the conflict check from a table of every subcommand declaring the flag, plus a counter-case that subcommands without it still accept `-w`. Dropping any arm of `is_global` now fails with that subcommand named. The table also records that `approve-builds` declares `--global` with no `-g` short form, unlike its peers. With behavior asserted, the comments describing it are redundant: cut 40 lines of prose that restated test names, listed helper bodies, or repeated the same pnpm-parity rationale in three places. What stays is what no test can express — the call-ordering contract, why the real-path resolution exists (case-insensitive filesystems), and the one canonical note that the root selector is additive rather than an override. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Code review by qodo was updated up to the latest commit 9a07a02 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…kspace (#13297) `pnpm --dir ../../elsewhere add -w foo` from inside a workspace added to that workspace's root instead of failing, when `../../elsewhere` did not exist. pnpm reports ERR_PNPM_NOT_IN_WORKSPACE. `apply_workspace_root` falls back to `std::path::absolute` when the `--dir` cannot be canonicalized, which is what keeps a nonexistent `--dir` inside the workspace working. On Unix that leaves `..` components in place, and `find_workspace_dir` walks ancestors lexically — so the walk climbed back up through the very `..` components that had taken it out of the workspace and found the workspace it had just left. Resolve `..` in the fallback with `pacquet_fs::lexical_normalize` (the existing filesystem-free normalizer) before the walk. A nonexistent `--dir` that stays inside the workspace still resolves to the root, and an existing directory outside it still errors — both already covered by tests. Found by CodeRabbit on #13294, a duplicate of #13281 closed in favor of it; the finding applies to the merged implementation. Verified against the TypeScript CLI: all three `--dir` shapes now agree.
…kspace (pnpm#13297) `pnpm --dir ../../elsewhere add -w foo` from inside a workspace added to that workspace's root instead of failing, when `../../elsewhere` did not exist. pnpm reports ERR_PNPM_NOT_IN_WORKSPACE. `apply_workspace_root` falls back to `std::path::absolute` when the `--dir` cannot be canonicalized, which is what keeps a nonexistent `--dir` inside the workspace working. On Unix that leaves `..` components in place, and `find_workspace_dir` walks ancestors lexically — so the walk climbed back up through the very `..` components that had taken it out of the workspace and found the workspace it had just left. Resolve `..` in the fallback with `pacquet_fs::lexical_normalize` (the existing filesystem-free normalizer) before the walk. A nonexistent `--dir` that stays inside the workspace still resolves to the root, and an existing directory outside it still errors — both already covered by tests. Found by CodeRabbit on pnpm#13294, a duplicate of pnpm#13281 closed in favor of it; the finding applies to the merged implementation. Verified against the TypeScript CLI: all three `--dir` shapes now agree.
Summary
pnpm add -D <pkg> <pkg> -wfrom a workspace subdirectory failed on the Rust CLI with a raw clap error, because-w/--workspace-rootwas not declared at all:(The multiple-selector half of the original report was already fixed by #12995;
-wwas the remaining gap.)This PR adds the flag, matching what pnpm's CLI arg pass does with it:
--dirat the workspace root, so a non-recursive command such asaddwrites to the rootpackage.json;--recursiveit appends a{<workspace-root>}inclusion selector to the--filter/--filter-prodlist — the inverse of the!{<workspace-root>}auto-exclusion an unfiltered recursiverun/exec/add/testalready applies. Note the selector is appended, not substituted, exactly as pnpm does it: an unfiltered-r -wruns the root alone, while-r -w --filter project-1runs the root andproject-1(pnpm v11.17.0 reportsScope: 2 of 3 workspace projectsfor that command). Both cases have a regression test;--globaland "not inside a workspace" are rejected with pnpm'sERR_PNPM_OPTIONS_CONFLICT/ERR_PNPM_NOT_IN_WORKSPACEcodes and messages. A--dirthat does not exist is not an error under-w: pnpm'sfindWorkspaceDirfalls back to the given path whenfs.realpathfails and walks it lexically, so the redirect to the workspace root still happens — verified against pnpm v11.17.0 and covered by a test.Verified against the exact reproduction in the issue: all three packages land in the root manifest,
packages/a/package.jsonis untouched, and both importers stay in the lockfile.TypeScript CLI: no change needed — it already implements
--workspace-root(cli/parse-cli-args,pnpm/src/main.ts). This is a pacquet-only parity gap, so the changeset targetspacquetalone.Closes #13031
Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.TypeScript CLI already had
--workspace-root; nothing to port.pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
Parsing / redirect / conflict / not-in-workspace unit tests, plus e2e tests for
add -wfrom a subdir and-r -w run.Written by an agent (Claude Code, claude-opus-5).
Summary by CodeRabbit
New Features
--workspace-root(-w) option to run commands against the workspace root project.pnpm add -wnow correctly updates the rootpackage.jsonwhen invoked from a workspace subdirectory.-r) with-wcan select only the root project or include it alongside filtered projects.Bug Fixes
-wis used with--dir(including nonexistent paths).--global).