Repository navigation
Conversation
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (16)
📝 WalkthroughWalkthroughThe change adds ChangesExtra environment propagation
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant UpdateConfigHook
participant ConfigHooks
participant Config
participant CLICommands
participant LifecycleScripts
UpdateConfigHook->>ConfigHooks: return extraEnv and extraBinPaths
ConfigHooks->>Config: update validated values
Config->>CLICommands: provide extra_env
Config->>LifecycleScripts: provide extra_env and extra_bin_paths
CLICommands->>LifecycleScripts: pass environment with reserved stamps
Possibly related PRs
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12943 +/- ##
==========================================
+ Coverage 85.26% 85.42% +0.16%
==========================================
Files 486 489 +3
Lines 77280 77849 +569
==========================================
+ Hits 65890 66504 +614
+ Misses 11390 11345 -45 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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": 3.8912902370199993,
"stddev": 0.12744635685565917,
"median": 3.88718005702,
"user": 3.6718969799999996,
"system": 3.4904693599999996,
"min": 3.67374813602,
"max": 4.15926824602,
"times": [
3.79187307202,
3.81663841802,
3.67374813602,
3.90322601402,
3.86130756802,
3.92009526802,
3.87113410002,
3.94257976202,
3.97303178602,
4.15926824602
]
},
{
"command": "pacquet@main",
"mean": 3.99704435362,
"stddev": 0.1803636285128406,
"median": 3.98197976502,
"user": 3.6607750799999996,
"system": 3.5086341599999997,
"min": 3.74111481202,
"max": 4.31100123402,
"times": [
4.04955304502,
3.87260331802,
4.10656497102,
3.74111481202,
4.31100123402,
3.87004750002,
4.21697200002,
3.83862712602,
3.91706935902,
4.04689017102
]
},
{
"command": "pnpr@HEAD",
"mean": 2.15664374572,
"stddev": 0.10816589832966503,
"median": 2.12153150802,
"user": 2.74004668,
"system": 3.09611766,
"min": 2.0404010810199997,
"max": 2.3466591010199997,
"times": [
2.0614654780199997,
2.34025375602,
2.0857246900199997,
2.3466591010199997,
2.1284316840199997,
2.12348388602,
2.0404010810199997,
2.20809760202,
2.11957913002,
2.11234104902
]
},
{
"command": "pnpr@main",
"mean": 2.1047473476199996,
"stddev": 0.042875802712651324,
"median": 2.10521757352,
"user": 2.69447908,
"system": 3.1066019600000003,
"min": 2.04654237602,
"max": 2.16640008002,
"times": [
2.16640008002,
2.1201392650199997,
2.1127645990199997,
2.15560643102,
2.09767054802,
2.07659358702,
2.04654237602,
2.07560329402,
2.14648744502,
2.04966585102
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6702852108000001,
"stddev": 0.007419734360383104,
"median": 0.6706611594,
"user": 0.39074064,
"system": 1.3645284,
"min": 0.6578743504000001,
"max": 0.6834134664,
"times": [
0.6717881264000001,
0.6681651324000001,
0.6779058784,
0.6640764254,
0.6578743504000001,
0.6635525344000001,
0.6704023904,
0.6709199284,
0.6834134664,
0.6747538754000001
]
},
{
"command": "pacquet@main",
"mean": 0.6967781437,
"stddev": 0.0747180327437137,
"median": 0.6790962489000001,
"user": 0.39723023999999996,
"system": 1.3602859999999999,
"min": 0.6515237894,
"max": 0.9055564454,
"times": [
0.6951312844,
0.6886676194000001,
0.6593759154000001,
0.6789252304000001,
0.6555241144,
0.6734292954000001,
0.6515237894,
0.6792672674000001,
0.6803804754,
0.9055564454
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7276394614,
"stddev": 0.07279384375671001,
"median": 0.7110352429000001,
"user": 0.41502884,
"system": 1.3656544999999998,
"min": 0.6824273504,
"max": 0.9289029264,
"times": [
0.7216182094000001,
0.6882234694,
0.7004522764000001,
0.6898210484,
0.6824273504,
0.6911327794000001,
0.7222954264000001,
0.7233349164,
0.9289029264,
0.7281862114000001
]
},
{
"command": "pnpr@main",
"mean": 0.7554220391000002,
"stddev": 0.021065567480831476,
"median": 0.7474248354,
"user": 0.41454743999999993,
"system": 1.4321597000000001,
"min": 0.7378942164000001,
"max": 0.8030015254,
"times": [
0.8030015254,
0.7419140914000001,
0.7378942164000001,
0.7444410584000001,
0.7504086124,
0.7537500584000001,
0.7573846654,
0.7819918044,
0.7435009774000001,
0.7399333814000001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.34233304558,
"stddev": 0.055013759820038866,
"median": 4.34072513128,
"user": 3.82803572,
"system": 3.4799137599999996,
"min": 4.24854879378,
"max": 4.40977823678,
"times": [
4.324603269780001,
4.39719650178,
4.403940357780001,
4.298729803780001,
4.37620581378,
4.40977823678,
4.35036177278,
4.282877415780001,
4.33108848978,
4.24854879378
]
},
{
"command": "pacquet@main",
"mean": 4.304054993579999,
"stddev": 0.04404891363210717,
"median": 4.30090367978,
"user": 3.74731302,
"system": 3.4616643599999994,
"min": 4.247441422780001,
"max": 4.405127305780001,
"times": [
4.405127305780001,
4.28467099678,
4.32407691578,
4.32076177278,
4.29390857678,
4.2972445307800005,
4.251309384780001,
4.311446200780001,
4.30456282878,
4.247441422780001
]
},
{
"command": "pnpr@HEAD",
"mean": 2.20853256368,
"stddev": 0.12872508337371544,
"median": 2.1614959952799997,
"user": 2.54027242,
"system": 2.99083226,
"min": 2.10091279878,
"max": 2.51109059178,
"times": [
2.1672764337799997,
2.2158050667799998,
2.10091279878,
2.1749462827799997,
2.51109059178,
2.36031417778,
2.12913160478,
2.1557155567799997,
2.12510061778,
2.1450325057799997
]
},
{
"command": "pnpr@main",
"mean": 2.2021221123799997,
"stddev": 0.1229847589718072,
"median": 2.1563478812799994,
"user": 2.51146972,
"system": 2.9950087599999997,
"min": 2.08097097978,
"max": 2.44110387778,
"times": [
2.1326790777799998,
2.1731726867799996,
2.1489724237799996,
2.2414719977799997,
2.0967960037799998,
2.14427629778,
2.1637233387799997,
2.08097097978,
2.3980544397799997,
2.44110387778
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3764555713000002,
"stddev": 0.01110734792633902,
"median": 1.3738198027,
"user": 1.30050492,
"system": 1.7579504199999998,
"min": 1.3614785222,
"max": 1.3962478102,
"times": [
1.3962478102,
1.3614785222,
1.3695063892000001,
1.3758447052,
1.3705449692,
1.3777888062,
1.3687648362,
1.3717949002,
1.3944942682,
1.3780905062
]
},
{
"command": "pacquet@main",
"mean": 1.3626253390999998,
"stddev": 0.06056952745110461,
"median": 1.3449133282,
"user": 1.2845727200000001,
"system": 1.72091702,
"min": 1.3148765502000002,
"max": 1.5263175732,
"times": [
1.3882784832000001,
1.3381056802,
1.3505372312000001,
1.5263175732,
1.3534426712,
1.3452884312000002,
1.3313251532,
1.3148765502000002,
1.3335433922000002,
1.3445382252
]
},
{
"command": "pnpr@HEAD",
"mean": 0.6909436678000002,
"stddev": 0.0833730331735753,
"median": 0.6658737402000001,
"user": 0.34294592,
"system": 1.2883303199999998,
"min": 0.6514204292000001,
"max": 0.9271737462,
"times": [
0.6676703552000001,
0.6610675352000001,
0.6514204292000001,
0.9271737462,
0.6776537612000001,
0.6743943612000001,
0.6656091442000001,
0.6630179052,
0.6661383362000001,
0.6552911042
]
},
{
"command": "pnpr@main",
"mean": 0.6743677766,
"stddev": 0.00548170166502661,
"median": 0.6758185202,
"user": 0.34115622,
"system": 1.3050962199999998,
"min": 0.6650013012000001,
"max": 0.6817691502000001,
"times": [
0.6817691502000001,
0.6744675862,
0.6795481442000001,
0.6779183272000001,
0.6650013012000001,
0.6759453832000001,
0.6766952542000001,
0.6756916572,
0.6700056352000001,
0.6666353272000001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.14595252566,
"stddev": 0.07661724267846128,
"median": 3.14296558826,
"user": 1.86854534,
"system": 2.00022288,
"min": 3.02860211326,
"max": 3.27434302026,
"times": [
3.27434302026,
3.18487350426,
3.10205659626,
3.06487189126,
3.09541360926,
3.12018348526,
3.02860211326,
3.16574769126,
3.19945099226,
3.22398235326
]
},
{
"command": "pacquet@main",
"mean": 3.1333608376600006,
"stddev": 0.13124092028035414,
"median": 3.1308220002600002,
"user": 1.8402064400000004,
"system": 2.0253550799999998,
"min": 2.97781633726,
"max": 3.31619880026,
"times": [
3.22460060926,
3.00059926726,
2.97781633726,
3.05924987326,
2.98492288726,
3.05099488826,
3.28176082526,
3.23507076126,
3.31619880026,
3.20239412726
]
},
{
"command": "pnpr@HEAD",
"mean": 0.69273633636,
"stddev": 0.011827687458144338,
"median": 0.69185671376,
"user": 0.35896014,
"system": 1.3247499799999998,
"min": 0.67570438726,
"max": 0.7106731442600001,
"times": [
0.7106731442600001,
0.67570438726,
0.6911764612600001,
0.69253696626,
0.6830612312600001,
0.68859541526,
0.69303936326,
0.7096641692600001,
0.68040889126,
0.70250333426
]
},
{
"command": "pnpr@main",
"mean": 0.71677862636,
"stddev": 0.011782837778517597,
"median": 0.7166859187600001,
"user": 0.37964213999999996,
"system": 1.3572269799999996,
"min": 0.69698789526,
"max": 0.73129887126,
"times": [
0.71203683326,
0.72339721926,
0.69698789526,
0.70695594226,
0.70759612926,
0.72909554726,
0.72984141126,
0.73129887126,
0.7092414102600001,
0.7213350042600001
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.67354179446,
"stddev": 0.020342165618849307,
"median": 0.67824959956,
"user": 0.6320383199999999,
"system": 0.16142182,
"min": 0.62930894956,
"max": 0.6991243865600001,
"times": [
0.6559253635600001,
0.6991243865600001,
0.6768857445600001,
0.68470904956,
0.68125449656,
0.62930894956,
0.66889832256,
0.67961345456,
0.6951708855600001,
0.66452729156
]
},
{
"command": "pacquet@main",
"mean": 0.6641550434600001,
"stddev": 0.020111558915582525,
"median": 0.66887567906,
"user": 0.63012592,
"system": 0.15523552000000002,
"min": 0.62717225056,
"max": 0.68630114756,
"times": [
0.6814304535600001,
0.66873406256,
0.6532924895600001,
0.6839181765600001,
0.6792386825600001,
0.62717225056,
0.65169258756,
0.66901729556,
0.68630114756,
0.64075328856
]
},
{
"command": "pnpr@HEAD",
"mean": 0.10794328364000001,
"stddev": 0.0008853908802570811,
"median": 0.10775085956000001,
"user": 0.028784180000000003,
"system": 0.0186322,
"min": 0.10618439056000001,
"max": 0.10960848256,
"times": [
0.10834182456000001,
0.10874354756,
0.10726444056000001,
0.10848771656,
0.10681471056,
0.10815732856,
0.10898247256,
0.10762078756,
0.10772600356,
0.10762477456,
0.10775085956000001,
0.10774582956,
0.10876471556,
0.10684300256,
0.10948875956,
0.10711289656,
0.10718348956,
0.10960848256,
0.10618439056000001,
0.10842390756,
0.10864877856,
0.10678947156,
0.10728001056,
0.10842938856,
0.10856450156
]
},
{
"command": "pnpr@main",
"mean": 0.10852233396000001,
"stddev": 0.001976325764032801,
"median": 0.10791195156,
"user": 0.02934662,
"system": 0.018669919999999996,
"min": 0.10569487456,
"max": 0.11343584256,
"times": [
0.10780750556,
0.11329002956,
0.10569487456,
0.10791195156,
0.10804069156,
0.10818501956,
0.10858396756000001,
0.10767508656000001,
0.10930740056,
0.10692761956,
0.11018243856,
0.10718091256000001,
0.10874810456,
0.10605545056,
0.10882515856,
0.10785946256000001,
0.10700398356,
0.10979243756,
0.10676193056,
0.11010748756000001,
0.11148923956000001,
0.10688927956000001,
0.10775632856,
0.10754614556,
0.11343584256
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 6.691588219479999,
"stddev": 0.1233731535745642,
"median": 6.649725408579999,
"user": 3.82994898,
"system": 3.7199316000000002,
"min": 6.57073404608,
"max": 6.95522755808,
"times": [
6.60741665608,
6.95522755808,
6.84989424508,
6.640197918079999,
6.57073404608,
6.60228308808,
6.659252899079999,
6.60739644108,
6.68756351408,
6.73591582908
]
},
{
"command": "pacquet@main",
"mean": 6.71381351118,
"stddev": 0.23501370035190083,
"median": 6.67091844308,
"user": 3.7902817799999995,
"system": 3.714611,
"min": 6.43801332208,
"max": 7.14492556008,
"times": [
7.14492556008,
6.74376878808,
6.5829859190799995,
6.43801332208,
6.7455092270799994,
6.737456325079999,
6.58084012408,
6.604380561079999,
7.07772654408,
6.482528741079999
]
},
{
"command": "pnpr@HEAD",
"mean": 5.00912409638,
"stddev": 0.08326886154371585,
"median": 4.9824501430799994,
"user": 2.81887318,
"system": 3.2796674,
"min": 4.90605091808,
"max": 5.17286930208,
"times": [
5.04012048108,
4.90605091808,
5.17286930208,
4.9697901160799995,
4.948388782079999,
4.929036132079999,
5.09851141308,
5.06157353308,
4.99224615208,
4.97265413408
]
},
{
"command": "pnpr@main",
"mean": 5.04344979438,
"stddev": 0.09156772063664319,
"median": 5.05135501158,
"user": 2.7796528799999995,
"system": 3.2727843,
"min": 4.89481637708,
"max": 5.181125039079999,
"times": [
5.04724093808,
4.94945353108,
4.989682903079999,
5.181125039079999,
5.089223660079999,
4.89481637708,
4.98337593308,
5.0554690850799995,
5.074786317079999,
5.1693241600799995
]
}
]
} |
|
| Branch | pr/12943 |
| 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,208.53 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 692.74 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 690.94 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 107.94 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,156.64 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 5,009.12 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 727.64 ms |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
Confidence Score: 4/5The core wiring is correct for most spawn sites, but exec.rs has a behavioral gap that this PR exposes: a hook-set NODE_OPTIONS is overwritten when package_map_path_for_execution applies and config.node_options is unset. The exec.rs change applies config.extra_env before pnpm's own PATH and user-agent, which is correct. But the NODE_OPTIONS computation that follows reads only from config.node_options, ignoring any NODE_OPTIONS the hook placed in extra_env. When package_map_path_for_execution returns a path and config.node_options is None, the generated package-map option overwrites the hook's value entirely and silently. run.rs handles this correctly by seeding node_options from extra_env first; exec.rs needs the same treatment. pnpm/crates/cli/src/cli_args/exec.rs — the node_options computation at the package_map_path_for_execution block should be seeded from config.extra_env.get("NODE_OPTIONS") before applying make_node_package_map_option, mirroring the pattern in run.rs.
|
There was a problem hiding this comment.
Pull request overview
Brings the Rust pacquet CLI into parity with the TypeScript pnpm CLI by round-tripping extraBinPaths and extraEnv through the updateConfig pnpmfile hook and forwarding extra_env into child-process spawn sites (lifecycle scripts, run, exec, dlx, pack, publish), with added unit/e2e coverage.
Changes:
- Added
extra_envto pacquetConfigand wiredupdateConfighook seeding + delta re-application forextraBinPaths/extraEnv. - Forwarded
config.extra_envinto env construction across install/build and CLI command spawn paths. - Added tests validating
updateConfigcan extendextraBinPathsand setextraEnv, plus an e2e lifecycle-script assertion.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm/crates/package-manager/src/install.rs | Seeds lifecycle-script env with config.extra_env during install. |
| pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs | Seeds build/lifecycle env with config.extra_env for fresh-lockfile installs. |
| pnpm/crates/package-manager/src/install_package_from_registry/tests.rs | Updates test config construction to include the new extra_env field. |
| pnpm/crates/package-manager/src/install_frozen_lockfile.rs | Seeds build/lifecycle env with config.extra_env for frozen-lockfile installs. |
| pnpm/crates/config/src/lib.rs | Adds Config::extra_env with documentation describing its source/semantics. |
| pnpm/crates/cli/tests/lifecycle_scripts.rs | Adds e2e test ensuring updateConfig-set extraEnv reaches lifecycle scripts. |
| pnpm/crates/cli/src/config_deps/tests.rs | Adds unit tests for updateConfig extending extraBinPaths and setting extraEnv. |
| pnpm/crates/cli/src/config_deps.rs | Seeds hook input with extraBinPaths/extraEnv and re-applies them from the hook delta. |
| pnpm/crates/cli/src/cli_args/run/recursive.rs | Starts recursive run env from config.extra_env. |
| pnpm/crates/cli/src/cli_args/run.rs | Starts run env from config.extra_env. |
| pnpm/crates/cli/src/cli_args/publish.rs | Forwards config.extra_env into publish script env/options. |
| pnpm/crates/cli/src/cli_args/pack.rs | Forwards config.extra_env into pack options (and removes now-unneeded HashMap import). |
| pnpm/crates/cli/src/cli_args/exec.rs | Applies config.extra_env into exec child-process env. |
| pnpm/crates/cli/src/cli_args/dlx.rs | Threads extra_env into dlx bin spawn env and updates imports. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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/package-manager/src/install.rs (1)
2220-2241: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winForward
config.extra_bin_pathsto project lifecycle scripts.This path now forwards
extra_env, but the sameRunPostinstallHookscall still suppliesextra_bin_paths: &[]. Consequently,extraBinPathsreturned byupdateConfigis ignored for project lifecycle scripts, despite the Config contract defining it as a PATH prefix for scripts. Pass&config.extra_bin_pathsand add a regression that verifies the executable is visible inside the lifecycle script.Suggested fix
run_project_lifecycle_scripts::<Reporter>(&RunPostinstallHooks { dep_path: &dep_path, pkg_root: project_dir, root_modules_dir: &root_modules_dir, init_cwd: workspace_root, - extra_bin_paths: &[], + extra_bin_paths: &config.extra_bin_paths, extra_env: &extra_env,Based on path instructions:
REVIEW_GUIDE.mdrequires testing the real lifecycle effect, andpnpm/crates/config/src/lib.rs:1212-1222definesextraBinPathsas script PATH prefixes.🤖 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/package-manager/src/install.rs` around lines 2220 - 2241, Update the RunPostinstallHooks construction in the project_manifests loop to pass &config.extra_bin_paths instead of an empty slice, preserving the Config extraBinPaths contract for lifecycle scripts. Add a regression test that runs a project lifecycle script and verifies an executable from the configured extra bin paths is available.Source: Path instructions
🧹 Nitpick comments (1)
pnpm/crates/cli/tests/lifecycle_scripts.rs (1)
951-955: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRemove the redundant test narration.
The test name and assertion already express the contract. Keep comments only for non-obvious rationale; the TypeScript parity and PnpmBuild explanation duplicates information visible from the test itself.
As per path instructions, tests should express the contract once through assertions rather than duplicating the scenario in prose; this also follows the Rust comment guidance.
🤖 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/lifecycle_scripts.rs` around lines 951 - 955, Remove the redundant doc comment above the lifecycle-script test; the test name and assertions already define the contract. Keep the test implementation and assertions unchanged, retaining comments only if they explain non-obvious rationale.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.
Outside diff comments:
In `@pnpm/crates/package-manager/src/install.rs`:
- Around line 2220-2241: Update the RunPostinstallHooks construction in the
project_manifests loop to pass &config.extra_bin_paths instead of an empty
slice, preserving the Config extraBinPaths contract for lifecycle scripts. Add a
regression test that runs a project lifecycle script and verifies an executable
from the configured extra bin paths is available.
---
Nitpick comments:
In `@pnpm/crates/cli/tests/lifecycle_scripts.rs`:
- Around line 951-955: Remove the redundant doc comment above the
lifecycle-script test; the test name and assertions already define the contract.
Keep the test implementation and assertions unchanged, retaining comments only
if they explain non-obvious rationale.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8daf8d2f-a048-437b-b8d5-2a4872041269
📒 Files selected for processing (14)
pnpm/crates/cli/src/cli_args/dlx.rspnpm/crates/cli/src/cli_args/exec.rspnpm/crates/cli/src/cli_args/pack.rspnpm/crates/cli/src/cli_args/publish.rspnpm/crates/cli/src/cli_args/run.rspnpm/crates/cli/src/cli_args/run/recursive.rspnpm/crates/cli/src/config_deps.rspnpm/crates/cli/src/config_deps/tests.rspnpm/crates/cli/tests/lifecycle_scripts.rspnpm/crates/config/src/lib.rspnpm/crates/package-manager/src/install.rspnpm/crates/package-manager/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_package_from_registry/tests.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
3acaffe to
3eb213c
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm/crates/executor/src/make_env/tests.rs (1)
177-213: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winCover the early generated stamps in this regression.
The test validates
INIT_CWD, user-agent, the verify-deps guard, andnpm_lifecycle_script, but all of those are written afterextra_env. It would still pass ifextraEnvcontinued to overwritenpm_lifecycle_eventornpm_package_*. Add conflicting entries and assert the authoritative generated values.🤖 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/executor/src/make_env/tests.rs` around lines 177 - 213, Extend reserved_stamps_win_over_extra_env_but_custom_keys_apply to include conflicting extra entries for the early generated npm_lifecycle_event and at least one npm_package_* value. Assert those generated values remain authoritative after build_env, while preserving the existing CUSTOM assertion.pnpm/crates/package-manager/src/install.rs (1)
481-490: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winKeep the frozen-store validation out of this PR.
This behavior is unrelated to
extraEnv/extraBinPathspropagation and expands the user-visible parity surface without a corresponding TypeScript change in the supplied context. Split it into a separate change, or add matching TypeScript behavior and tests.As per path instructions, this PR should only change environment wiring and precedence.
Also applies to: 581-583
🤖 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/package-manager/src/install.rs` around lines 481 - 490, Remove the frozenStore/force validation additions, including ConfigConflictFrozenStoreWithForce and its associated handling around the referenced validation code. Keep this PR scoped to extraEnv/extraBinPaths environment wiring and precedence; defer frozen-store behavior to a separate change unless matching TypeScript behavior and tests are added.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.
Nitpick comments:
In `@pnpm/crates/executor/src/make_env/tests.rs`:
- Around line 177-213: Extend
reserved_stamps_win_over_extra_env_but_custom_keys_apply to include conflicting
extra entries for the early generated npm_lifecycle_event and at least one
npm_package_* value. Assert those generated values remain authoritative after
build_env, while preserving the existing CUSTOM assertion.
In `@pnpm/crates/package-manager/src/install.rs`:
- Around line 481-490: Remove the frozenStore/force validation additions,
including ConfigConflictFrozenStoreWithForce and its associated handling around
the referenced validation code. Keep this PR scoped to extraEnv/extraBinPaths
environment wiring and precedence; defer frozen-store behavior to a separate
change unless matching TypeScript behavior and tests are added.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 25c8c0e7-bc29-41d9-bb54-053e73762ee4
📒 Files selected for processing (16)
pnpm/crates/cli/src/cli_args/dlx.rspnpm/crates/cli/src/cli_args/exec.rspnpm/crates/cli/src/cli_args/pack.rspnpm/crates/cli/src/cli_args/publish.rspnpm/crates/cli/src/cli_args/run.rspnpm/crates/cli/src/cli_args/run/recursive.rspnpm/crates/cli/src/config_deps.rspnpm/crates/cli/src/config_deps/tests.rspnpm/crates/cli/tests/lifecycle_scripts.rspnpm/crates/config/src/lib.rspnpm/crates/executor/src/make_env.rspnpm/crates/executor/src/make_env/tests.rspnpm/crates/package-manager/src/install.rspnpm/crates/package-manager/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_package_from_registry/tests.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
✅ Files skipped from review due to trivial changes (1)
- pnpm/crates/package-manager/src/install_package_from_registry/tests.rs
🚧 Files skipped from review as they are similar to previous changes (11)
- pnpm/crates/cli/src/cli_args/publish.rs
- pnpm/crates/config/src/lib.rs
- pnpm/crates/cli/src/cli_args/run/recursive.rs
- pnpm/crates/package-manager/src/install_frozen_lockfile.rs
- pnpm/crates/package-manager/src/install_with_fresh_lockfile.rs
- pnpm/crates/cli/src/cli_args/exec.rs
- pnpm/crates/cli/src/cli_args/run.rs
- pnpm/crates/cli/src/cli_args/pack.rs
- pnpm/crates/cli/src/config_deps.rs
- pnpm/crates/cli/src/cli_args/dlx.rs
- pnpm/crates/cli/src/config_deps/tests.rs
|
Addressed the automated review in 3eb213c (also rebased on
Written by an agent (Claude Code, claude-opus-4-8). |
… hook Body placeholder.
…sites Address review of the extraEnv wiring: the publish lifecycle scripts, the pnpm exec child, and the dlx bin spawn did not forward config.extra_env, unlike the pack path and the install-family lifecycle sites. None is a live bug today (extra_env is populated only by the updateConfig hook, which currently runs only for install-family commands, so it is empty at these sites), but the asymmetry was inconsistent and the Config::extra_env doc comment overstated the reach. - publish: run_publish_scripts now passes &config.extra_env instead of an empty map. - exec: spawn_in_dir applies config.extra_env before pnpm's own keys, so PATH/user-agent/NODE_OPTIONS still win on conflict (matching TS makeEnv). - dlx: run_bin takes an extra_env argument and applies it the same way. - Config::extra_env: doc comment now states the hook runs only for install-family commands, so other commands' spawn sites read an empty map until the hook broadens.
Address PR review. Now that config.extra_env carries the user's updateConfig extraEnv (not just pnpm-controlled values), applying it last in build_env let a hook override pnpm's reserved per-call stamps (INIT_CWD, PNPM_SCRIPT_SRC_DIR, npm_config_user_agent, the verify-deps-before-run guard). TS runLifecycleHook spreads extraEnv before those keys, so pnpm wins on conflict. - make_env: apply extra_env before the reserved per-call stamps, so pnpm's stamps override it; a non-reserved extraEnv key still applies. Update the docs and the precedence test accordingly. - install: forward config.extra_bin_paths to project lifecycle scripts instead of an empty slice, matching TS (install/index.ts passes extraBinPaths to the root scripts). - dlx: correct the extra_env comment — dlx does not run updateConfig, so the map is currently always empty there. - Add an e2e regression asserting a hook extraEnv cannot override INIT_CWD.
The make_env doc described extra_env as purely the user's updateConfig extraEnv, but callers merge pnpm-controlled keys (e.g. NODE_OPTIONS from nodeOptions) into it before build_env sees it. Widen the EnvOptions field doc and the step-4 comment to say extra_env carries the user extraEnv plus any pnpm-controlled keys the caller adds, and that the reserved per-call stamps override all of it regardless of origin. The precedence contract is unchanged.
Applying config.extra_env before the reserved per-call stamps also moved it after the npm_config_node_gyp insertion, so a hook's extraEnv could no longer override npm_config_node_gyp. That diverges from TS npm-lifecycle, which sets npm_config_node_gyp before spreading extraEnv, leaving it overridable. It is not one of pnpm's reserved stamps (INIT_CWD, PNPM_SCRIPT_SRC_DIR, npm_config_user_agent, the verify-deps guard, npm_lifecycle_script), and neither the make_env doc nor the PR description lists it as one. Stamp npm_config_node_gyp before extra_env so a hook extraEnv wins, matching TS. Extend the reserved-stamps unit test to assert that the non-reserved stamps generated before extra_env (npm_lifecycle_event, npm_config_node_gyp, npm_package_*) stay overridable.
342a3d3 to
fcaa135
Compare
Code Review by Qodo
Context used✅ Compliance rules (platform):
18 rules 1. extraBinPaths unvalidated in PATH
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR.
|
Summary
The TypeScript pnpm CLI passes the entire
Configobject through theupdateConfigpnpmfile hook and adopts the returned object wholesale, so a hookcan read and extend
extraBinPaths/extraEnv. Pacquet only round-trippedWorkspaceSettingsthrough the hook, silently dropping both fields — a hook thatset them was a no-op.
This brings pacquet to parity:
extra_envtoConfig(extra_bin_pathsalready existed).updateConfighook input with the liveextraBinPaths/extraEnvso a hook can append to them, then reads the hook's values back from the delta
and assigns them to
Config. Neither is apnpm-workspace.yamlkey, so theyare special-cased like
storeDir/catalogsrather than going throughWorkspaceSettings::apply_to.config.extra_envinto every child-process spawn site — theinstall-family lifecycle scripts (install, fresh/frozen lockfile installs),
run, recursiverun,pack,publish,exec, and thedlxbin. Thelifecycle env builder (
make_env.rs) appliesextra_envbefore pnpm'sreserved per-call stamps (
INIT_CWD,PNPM_SCRIPT_SRC_DIR,npm_config_user_agent, the verify-deps guard), so pnpm's keys win onconflict while non-reserved
extraEnvkeys still apply — matching TSrunLifecycleHook. Theexec/dlxspawns apply it the same way.config.extra_bin_pathsto project (root) lifecycle scripts,matching TS
install/index.ts.Note on scope:
config.extra_envis populated only by theupdateConfighook,which today runs only for the install-family commands (install, deploy, dedupe,
prune). So it is non-empty only under those; the seedings at the other spawn
sites read an empty map until the hook broadens, but are wired uniformly so
behavior stays consistent when it does.
npmPathis intentionally not implemented: it is a type-only field on theTypeScript
Configthat is never read as a value, andpublishis native onboth stacks, so pacquet ignoring it already matches TypeScript behavior.
Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting.Pacquet-only parity fix: the TypeScript CLI already honors these fields
because it passes the whole
ConfigthroughupdateConfig.pnpm changeset) if this PR changes any publishedpackage. Not applicable — no published-package behavior changes; the
TypeScript CLI already had this behavior.
config_deps/tests.rsand oneend-to-end lifecycle-script test in
lifecycle_scripts.rs.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
New Features
updateConfighooks can now provide additional environment variables and binary paths.Bug Fixes