Repository navigation
fix(self-update): stop the project config from steering the pnpm download - #12813
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:
📝 WalkthroughWalkthrough
ChangesSelf-update trusted config path
Estimated code review effort: 3 (Moderate) | ~25 minutes Assessment against linked issues
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 |
PR Summary by QodoSelf-update: load config from trusted sources and force strict release-age by default
AI Description
Diagram
High-Level Assessment
Files changed (12)
|
Code Review by Qodo
Context used 1. Workspace dir not set
|
There was a problem hiding this comment.
Pull request overview
This PR fixes #12803 by making pnpm self-update ignore minimumReleaseAge* settings coming from the current project’s pnpm-workspace.yaml, so the self-update release-age policy cannot be influenced by the directory you run the command from. The change is implemented in both the TypeScript CLI and the Rust pacquet/ port, with tests and a changeset.
Changes:
- Add an
ignoreProjectReleaseAgeconfig-loading mode used byself-updateto skipminimumReleaseAge*from the project workspace manifest and defaultminimumReleaseAgeStricttotrueunless explicitly disabled by trusted sources. - Add TypeScript config-reader tests validating workspace release-age keys are ignored while unrelated workspace settings still apply and CLI overrides still work.
- Mirror the behavior in pacquet by adding
current_for_self_updateand routing pacquet’sself-updatecommand through it, plus Rust tests.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm11/pnpm/src/main.ts | Routes self-update through config loading with ignoreProjectReleaseAge. |
| pnpm11/pnpm/src/getConfig.ts | Threads the new ignoreProjectReleaseAge option through the pnpm CLI wrapper. |
| pnpm11/config/reader/src/index.ts | Skips minimumReleaseAge* keys from project workspace manifest when requested and enforces strict-by-default for self-update. |
| pnpm11/config/reader/test/index.ts | Adds coverage for the self-update “trusted layers only” release-age behavior. |
| pacquet/crates/config/src/workspace_yaml.rs | Adds workspace-settings application mode that can skip release-age fields. |
| pacquet/crates/config/src/lib.rs | Introduces current_for_self_update and enforces strict-by-default when ignoring project release age. |
| pacquet/crates/config/src/tests.rs | Adds tests validating workspace release-age policy is ignored for self-update and env overrides are honored. |
| pacquet/crates/cli/src/cli_args/dispatch.rs | Adds a separate config loader closure for self-update using current_for_self_update. |
| pacquet/crates/cli/src/cli_args/dispatch_query.rs | Switches pacquet self-update to use the self-update-specific config loader. |
| .changeset/self-update-release-age.md | Publishes the behavioral change as a patch release note. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Code review by qodo was updated up to the latest commit 09c7c7e |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #12813 +/- ##
==========================================
+ Coverage 86.91% 86.96% +0.05%
==========================================
Files 530 530
Lines 90785 90848 +63
==========================================
+ Hits 78903 79008 +105
+ Misses 11882 11840 -42 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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)
pacquet/crates/config/src/lib.rs (1)
2000-2046: 🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick winSkip
minimumReleaseAge*fromexplicit_settingson self-update.config_to_record()readsConfig::explicit_settingsforpnpm config list/get, so workspaceminimumReleaseAge*values are still surfaced as explicit even whenself-updateignores them. Filter those keys in theignore_project_release_agebranch so the reported config matches the effective one.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pacquet/crates/config/src/lib.rs` around lines 2000 - 2046, `Config::explicit_settings` is still collecting workspace `minimumReleaseAge*` entries even when `ignore_project_release_age` is true, so `pnpm config list/get` can report values that are not actually applied. Update the `workspace_yaml` handling in `Config` so the `ignore_project_release_age` path filters out `minimumReleaseAge*` before or during `collect_explicit_settings`, while leaving the normal `settings.apply_to` path unchanged. Use the existing `collect_explicit_settings` and `apply_to_skipping_release_age` flow to keep the recorded explicit config aligned with the effective config seen by `config_to_record()`.
🧹 Nitpick comments (2)
pacquet/crates/cli/src/cli_args/dispatch.rs (1)
156-217: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
configandconfig_self_updateclosures duplicate the same post-load finalization logic.Both closures are identical except for the
current::<Host>vscurrent_for_self_update::<Host>call — the override-application,recursive/filter/filter_prodassignment, andConfig::leakblock (Lines 162-176 and 188-194) is copy-pasted. This is exactly the kind of duplication that tends to drift silently (e.g., a future field added to one finalization path and forgotten in the other).♻️ Proposed refactor to share the finalization step
+ let finalize_config = |mut cfg: Config| -> &'static mut Config { + config_overrides.apply(&mut cfg); + cfg.recursive = recursive; + cfg.filter.clone_from(&filter); + cfg.filter_prod.clone_from(&filter_prod); + Config::leak(cfg) + }; let config = || -> miette::Result<&'static mut Config> { Config { npmrc_auth_file: npmrc_auth_file.clone(), ..Config::default() } .current::<Host>(&dir) - .map(|mut cfg| { - config_overrides.apply(&mut cfg); - cfg.recursive = recursive; - cfg.filter.clone_from(&filter); - cfg.filter_prod.clone_from(&filter_prod); - Config::leak(cfg) - }) + .map(finalize_config) .map_err(miette::Report::new) .wrap_err("load configuration") }; let config_self_update = || -> miette::Result<&'static mut Config> { Config { npmrc_auth_file: npmrc_auth_file.clone(), ..Config::default() } .current_for_self_update::<Host>(&dir) - .map(|mut cfg| { - config_overrides.apply(&mut cfg); - cfg.recursive = recursive; - cfg.filter.clone_from(&filter); - cfg.filter_prod.clone_from(&filter_prod); - Config::leak(cfg) - }) + .map(finalize_config) .map_err(miette::Report::new) .wrap_err("load configuration") };🤖 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/dispatch.rs` around lines 156 - 217, The config-loading closures duplicate the same post-load finalization logic, so extract that shared step from `config` and `config_self_update` into a single helper and reuse it after `current::<Host>` / `current_for_self_update::<Host>`. Keep the helper responsible for applying `config_overrides`, setting `recursive`, `filter`, and `filter_prod`, and calling `Config::leak` so both paths stay in sync. Make sure the new helper is used by both closures in `dispatch.rs` and preserves the existing behavior.pacquet/crates/config/src/tests.rs (1)
1856-1894: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAdd a
self-updateCLI override regression test
current_for_self_updateis only covered here for trusted env input; add a CLI path test for--config.minimum-release-age*(or the equivalent override) soself-updatecoverage matches the dispatch-layer behavior.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@pacquet/crates/config/src/tests.rs` around lines 1856 - 1894, Add a regression test for the self-update CLI override path, since `current_for_self_update` is only validated here with trusted env vars. Extend the existing `Config::new()`/`current_for_self_update::<HostWithReleaseAgeEnv>()` test coverage to exercise the dispatch-layer override behavior for `--config.minimum-release-age` and `--config.minimum-release-age-strict` (or the equivalent CLI config override), and assert those values win the same way as the env-based test.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/config/src/lib.rs`:
- Around line 2000-2046: `Config::explicit_settings` is still collecting
workspace `minimumReleaseAge*` entries even when `ignore_project_release_age` is
true, so `pnpm config list/get` can report values that are not actually applied.
Update the `workspace_yaml` handling in `Config` so the
`ignore_project_release_age` path filters out `minimumReleaseAge*` before or
during `collect_explicit_settings`, while leaving the normal `settings.apply_to`
path unchanged. Use the existing `collect_explicit_settings` and
`apply_to_skipping_release_age` flow to keep the recorded explicit config
aligned with the effective config seen by `config_to_record()`.
---
Nitpick comments:
In `@pacquet/crates/cli/src/cli_args/dispatch.rs`:
- Around line 156-217: The config-loading closures duplicate the same post-load
finalization logic, so extract that shared step from `config` and
`config_self_update` into a single helper and reuse it after `current::<Host>` /
`current_for_self_update::<Host>`. Keep the helper responsible for applying
`config_overrides`, setting `recursive`, `filter`, and `filter_prod`, and
calling `Config::leak` so both paths stay in sync. Make sure the new helper is
used by both closures in `dispatch.rs` and preserves the existing behavior.
In `@pacquet/crates/config/src/tests.rs`:
- Around line 1856-1894: Add a regression test for the self-update CLI override
path, since `current_for_self_update` is only validated here with trusted env
vars. Extend the existing
`Config::new()`/`current_for_self_update::<HostWithReleaseAgeEnv>()` test
coverage to exercise the dispatch-layer override behavior for
`--config.minimum-release-age` and `--config.minimum-release-age-strict` (or the
equivalent CLI config override), and assert those values win the same way as the
env-based test.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 7ba91fad-f918-41de-a411-0324f755ae56
📒 Files selected for processing (10)
.changeset/self-update-release-age.mdpacquet/crates/cli/src/cli_args/dispatch.rspacquet/crates/cli/src/cli_args/dispatch_query.rspacquet/crates/config/src/lib.rspacquet/crates/config/src/tests.rspacquet/crates/config/src/workspace_yaml.rspnpm11/config/reader/src/index.tspnpm11/config/reader/test/index.tspnpm11/pnpm/src/getConfig.tspnpm11/pnpm/src/main.ts
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.6285896650800002,
"stddev": 0.146228596050474,
"median": 2.57208612008,
"user": 2.3606262,
"system": 1.8117933599999998,
"min": 2.48198002808,
"max": 2.88428675908,
"times": [
2.53538152508,
2.54902389608,
2.52397058308,
2.68705922608,
2.88428675908,
2.64897518808,
2.59514834408,
2.87320546508,
2.50686563608,
2.48198002808
]
},
{
"command": "pacquet@main",
"mean": 2.64326583478,
"stddev": 0.13355583428567896,
"median": 2.6517675030800003,
"user": 1.7571396999999997,
"system": 1.4018302599999999,
"min": 2.40107055108,
"max": 2.82961793908,
"times": [
2.40107055108,
2.59162487408,
2.58794741708,
2.82961793908,
2.70563183108,
2.48576467608,
2.75738570208,
2.77008035108,
2.69345631808,
2.61007868808
]
},
{
"command": "pnpr@HEAD",
"mean": 1.67842826038,
"stddev": 0.12282266479970559,
"median": 1.74198242958,
"user": 1.5539619999999998,
"system": 1.6243337599999996,
"min": 1.42289393308,
"max": 1.7906212260799999,
"times": [
1.7906212260799999,
1.75050862508,
1.54371799408,
1.57568646208,
1.73345623408,
1.42289393308,
1.75395320508,
1.6821093780799998,
1.76868323608,
1.76265231008
]
},
{
"command": "pnpr@main",
"mean": 1.6828384281799997,
"stddev": 0.16552854468009617,
"median": 1.69156704358,
"user": 1.6665830000000004,
"system": 1.7670928599999995,
"min": 1.46889799108,
"max": 1.92537576008,
"times": [
1.7463231750800001,
1.50587884908,
1.46889799108,
1.58322246808,
1.71342864208,
1.87872668408,
1.83699114108,
1.92537576008,
1.49983412608,
1.66970544508
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.31076771564,
"stddev": 0.018664543833782344,
"median": 0.30478621074,
"user": 0.26376887999999993,
"system": 0.60615652,
"min": 0.29103802024000003,
"max": 0.34891498624,
"times": [
0.30864433724,
0.33643655324000005,
0.30679829924,
0.30192667524,
0.31732688024,
0.30277412224,
0.29103802024000003,
0.29230291924,
0.30151436324,
0.34891498624
]
},
{
"command": "pacquet@main",
"mean": 0.31137521994000006,
"stddev": 0.017666304534798647,
"median": 0.31268967074000004,
"user": 0.25863508,
"system": 0.6187818199999999,
"min": 0.28840886524000003,
"max": 0.33942087424,
"times": [
0.32504003724,
0.31026557524000004,
0.28854278724000004,
0.28840886524000003,
0.32993716924,
0.31666878824,
0.33942087424,
0.30878695524,
0.29156738124000003,
0.31511376624000004
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30602367894000004,
"stddev": 0.022302883518664548,
"median": 0.29964979524,
"user": 0.24612157999999998,
"system": 0.56537832,
"min": 0.26569999024,
"max": 0.34258640324,
"times": [
0.29289489724,
0.33078742324000004,
0.29556873624,
0.29427819924000004,
0.34258640324,
0.32355424524000004,
0.26569999024,
0.30048957324000003,
0.29881001724,
0.31556730424
]
},
{
"command": "pnpr@main",
"mean": 0.31669645174000005,
"stddev": 0.01371914775427754,
"median": 0.31493719924,
"user": 0.26099878,
"system": 0.60522652,
"min": 0.29255039324000004,
"max": 0.33837138824,
"times": [
0.31450710824,
0.32878903924,
0.33837138824,
0.32980388124000004,
0.30531727624,
0.29255039324000004,
0.31444475224,
0.32302764724,
0.31536729024000004,
0.30478574124
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.3355801749199996,
"stddev": 0.07083505915730491,
"median": 3.34899241282,
"user": 2.9291196599999996,
"system": 2.1100082999999996,
"min": 3.22952618182,
"max": 3.42479204282,
"times": [
3.39693921782,
3.37745001482,
3.2640125058200002,
3.3205594988200002,
3.42479204282,
3.23806524782,
3.22952618182,
3.35879184082,
3.40647221382,
3.33919298482
]
},
{
"command": "pacquet@main",
"mean": 3.25432296702,
"stddev": 0.06457135798484141,
"median": 3.22878788332,
"user": 2.8139050600000006,
"system": 2.0428287,
"min": 3.18575107482,
"max": 3.36209605082,
"times": [
3.18575107482,
3.36209605082,
3.19986799082,
3.36115669082,
3.28455229482,
3.22819334382,
3.22938242282,
3.19391164182,
3.27046344082,
3.22785471882
]
},
{
"command": "pnpr@HEAD",
"mean": 1.85038036732,
"stddev": 0.1689389183267974,
"median": 1.9252142433200001,
"user": 1.6191995599999998,
"system": 1.7969126000000002,
"min": 1.62616387282,
"max": 2.07819718882,
"times": [
1.62616387282,
1.92136854382,
1.6937897988200001,
1.6797353408200002,
2.07819718882,
1.64830361782,
2.01054395082,
1.92905994282,
1.96218942582,
1.95445199082
]
},
{
"command": "pnpr@main",
"mean": 1.82122832682,
"stddev": 0.17310849406479153,
"median": 1.8001838733200002,
"user": 1.6648873600000003,
"system": 1.7571160000000003,
"min": 1.62287302682,
"max": 2.04839205282,
"times": [
1.66402898682,
2.00086411682,
2.04839205282,
1.62287302682,
1.97608817282,
1.6727324438200002,
1.97975229882,
1.8987502368200002,
1.7016175098200002,
1.64718442282
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.77669489124,
"stddev": 0.1813358756501667,
"median": 0.76257021114,
"user": 0.96114406,
"system": 0.8235182199999999,
"min": 0.60323439514,
"max": 1.11406265214,
"times": [
0.86428123114,
0.87310983114,
0.91755253214,
1.11406265214,
0.90769981414,
0.60846083614,
0.60323439514,
0.60903129514,
0.66085919114,
0.60865713414
]
},
{
"command": "pacquet@main",
"mean": 0.58883305614,
"stddev": 0.02322164999068417,
"median": 0.5829815576399999,
"user": 0.71977196,
"system": 0.67471832,
"min": 0.56330956914,
"max": 0.64124714914,
"times": [
0.64124714914,
0.56330956914,
0.60610966214,
0.57534494514,
0.59718457114,
0.56840160814,
0.57828686714,
0.5721452821399999,
0.58767624814,
0.59862465914
]
},
{
"command": "pnpr@HEAD",
"mean": 0.30708069834,
"stddev": 0.006210042936228424,
"median": 0.30700721564,
"user": 0.18694365999999998,
"system": 0.54264472,
"min": 0.29888998414,
"max": 0.31527882714000005,
"times": [
0.31300503714000005,
0.31527882714000005,
0.31280563314000004,
0.31272887014,
0.30469395714,
0.30932047414,
0.29888998414,
0.30289145014,
0.30116832214,
0.30002442814
]
},
{
"command": "pnpr@main",
"mean": 0.32782524414,
"stddev": 0.029277975513008987,
"median": 0.31700537214,
"user": 0.23320876000000004,
"system": 0.55463542,
"min": 0.29821694314,
"max": 0.39116482514,
"times": [
0.31247241014000005,
0.30751688514000003,
0.30508444914000005,
0.30734925114,
0.32153833414000005,
0.33037023014000005,
0.35283728014000004,
0.39116482514,
0.35170183314000003,
0.29821694314
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9610596137200003,
"stddev": 0.010920114652393216,
"median": 1.9576296401200002,
"user": 1.0156415799999998,
"system": 0.8163982999999998,
"min": 1.94327690562,
"max": 1.9769728626200003,
"times": [
1.9769728626200003,
1.9553009216200001,
1.97483326562,
1.94327690562,
1.95906081662,
1.9561984636200003,
1.95389643162,
1.9534363086200002,
1.97225366262,
1.9653664986200001
]
},
{
"command": "pacquet@main",
"mean": 1.9720226630200002,
"stddev": 0.03625936314218684,
"median": 1.95874576662,
"user": 1.04802108,
"system": 0.8110555999999999,
"min": 1.9274108866200002,
"max": 2.04500587962,
"times": [
1.9798987446200003,
1.95308570162,
2.01588127762,
2.04500587962,
1.9900919416200002,
1.93866344062,
1.9274108866200002,
1.9605250816200002,
1.95269722462,
1.95696645162
]
},
{
"command": "pnpr@HEAD",
"mean": 0.32017072941999997,
"stddev": 0.012912501046719121,
"median": 0.31787454812000004,
"user": 0.21778657999999998,
"system": 0.5373029,
"min": 0.30146086862,
"max": 0.34550617462,
"times": [
0.30824282362,
0.30146086862,
0.31429899962,
0.32421623062,
0.33332620662,
0.32145009662,
0.34550617462,
0.31373657562,
0.31269725062,
0.32677206762
]
},
{
"command": "pnpr@main",
"mean": 0.32809220562,
"stddev": 0.01736054504757659,
"median": 0.32681326162,
"user": 0.22667198000000002,
"system": 0.5526194999999999,
"min": 0.29887289062,
"max": 0.35260694262,
"times": [
0.29887289062,
0.33541530062,
0.31671450562,
0.31821122262,
0.31635234962,
0.31436112962,
0.34396739662,
0.35260694262,
0.34231223462,
0.34210808362
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.42942247402000006,
"stddev": 0.025441824552349505,
"median": 0.42255150442,
"user": 0.41930366,
"system": 0.07233478000000002,
"min": 0.39583951442000004,
"max": 0.47445493942000005,
"times": [
0.41141259042,
0.42037508242000005,
0.41509768542000003,
0.42736692142000005,
0.39583951442000004,
0.42472792642,
0.41599692942000005,
0.43720660542,
0.47174654542000005,
0.47445493942000005
]
},
{
"command": "pacquet@main",
"mean": 0.42296001161999996,
"stddev": 0.023343659514513275,
"median": 0.42502030442000005,
"user": 0.40261515999999997,
"system": 0.08156608000000001,
"min": 0.38497531142,
"max": 0.46414230942,
"times": [
0.38497531142,
0.42696636042,
0.38678822642000005,
0.46414230942,
0.41918054342000005,
0.43938469642000005,
0.42865635642000005,
0.42232950342000003,
0.42307424842,
0.43410256042
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09389723961354839,
"stddev": 0.003097543484380349,
"median": 0.09477714942000001,
"user": 0.02550307935483871,
"system": 0.011225373548387096,
"min": 0.08764249342000001,
"max": 0.09981479742,
"times": [
0.09048412742,
0.09194569542,
0.09640479842,
0.09050847142000001,
0.09369325942000001,
0.09555446542000001,
0.09786975342000001,
0.09705440542,
0.09273612642000001,
0.09261122142,
0.09201174942000001,
0.09806927742,
0.09552800642,
0.09727614142,
0.09083011542000001,
0.09343427442,
0.09170159742,
0.09159033942000001,
0.09050025742000001,
0.09647837642000001,
0.09657277442000001,
0.09981479742,
0.09587148942000001,
0.09483899542,
0.09477714942000001,
0.08829032742000001,
0.08764249342000001,
0.09494221942,
0.08940894242000001,
0.09636042542,
0.09601235442
]
},
{
"command": "pnpr@main",
"mean": 0.09743607331655174,
"stddev": 0.0033671612714739015,
"median": 0.09693829842000001,
"user": 0.02745817724137931,
"system": 0.01229379448275862,
"min": 0.08961300542,
"max": 0.10431917542000001,
"times": [
0.09560591342000001,
0.09647234542000001,
0.09968761942000001,
0.09176539642,
0.09732059442,
0.09596450442000001,
0.09615653442000001,
0.08961300542,
0.09461829242000001,
0.09591075242000001,
0.09763789942000001,
0.09700152642000001,
0.09629102642000001,
0.10172640942000001,
0.10191457242,
0.09587021742,
0.09891426042000001,
0.09934198142,
0.09693829842000001,
0.10345729142000001,
0.09496255842000001,
0.10063039542,
0.09583584342000001,
0.09243562342,
0.09840797242,
0.10431917542000001,
0.09618040942,
0.09870109142000001,
0.10196461542
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.70835057038,
"stddev": 0.164369706553302,
"median": 4.7170027352799995,
"user": 2.2498091,
"system": 1.6525364,
"min": 4.50253732728,
"max": 4.9362034242799995,
"times": [
4.89370965228,
4.9362034242799995,
4.66644109928,
4.822482219279999,
4.76756437128,
4.50253732728,
4.56077873128,
4.58114114128,
4.50865934728,
4.84398839028
]
},
{
"command": "pacquet@main",
"mean": 4.7465782685799995,
"stddev": 0.21410189340722185,
"median": 4.650715400779999,
"user": 2.3682239,
"system": 1.7569886000000001,
"min": 4.51657382528,
"max": 5.080841727279999,
"times": [
4.53454017528,
4.5794045172799995,
4.51657382528,
5.00729923028,
4.615181091279999,
4.99889062028,
4.66655068628,
5.080841727279999,
4.63488011528,
4.83162069728
]
},
{
"command": "pnpr@HEAD",
"mean": 3.67388642298,
"stddev": 0.14376669753968513,
"median": 3.61984470478,
"user": 1.6713948000000003,
"system": 1.5670578,
"min": 3.53296022628,
"max": 3.8874999582800003,
"times": [
3.8388096222800003,
3.5456299112800003,
3.8874999582800003,
3.5629041522800002,
3.8793946632800003,
3.69048886828,
3.53296022628,
3.57754490128,
3.56148741828,
3.6621445082800004
]
},
{
"command": "pnpr@main",
"mean": 3.62246030218,
"stddev": 0.14099781048920093,
"median": 3.57521730478,
"user": 1.5074983000000002,
"system": 1.4857041,
"min": 3.48126848528,
"max": 3.95161427928,
"times": [
3.53848931328,
3.6097189542800003,
3.74656988028,
3.95161427928,
3.55659669628,
3.69146727128,
3.53395520928,
3.52108501928,
3.48126848528,
3.5938379132800002
]
}
]
} |
|
| Branch | pr/12813 |
| 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,553.99 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 272.28 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 282.77 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.28 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,513.59 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,691.21 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 251.92 ms |
09c7c7e to
6ecc1c8
Compare
|
Code review by qodo was updated up to the latest commit 6ecc1c8 |
|
Code review by qodo was updated up to the latest commit 6ecc1c8 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Fixes pnpm#12803. `pnpm self-update` resolved the pnpm download through the project's own registry/auth config and loaded the repo's default `.pnpmfile.(c|m)js`, and its `minimumReleaseAge` policy came from the active workspace with no limit on the direction — a repo could raise the cutoff (the reported cwd-dependent failure) but equally set `minimumReleaseAge: 0`, `minimumReleaseAgeStrict: false`, or list pnpm in `minimumReleaseAgeExclude` and silently disable the cooldown the user configured globally, on the one download that replaces the binary every later install runs through. Route the fetch through the trusted package-manager bootstrap config — the channel `switchCliVersion` already uses, which excludes the project `.npmrc` and workspace manifest — and stop auto-loading the repo pnpmfile, whose `updateConfig` hook and custom resolvers/fetchers reach the same requests. Keep the project's `minimumReleaseAge` applying to self-update, but only in the tightening direction: the manifest may raise the cutoff and turn strict mode on, never lower it, waive strict mode, or exempt pnpm. A trusted source (global config, env, CLI flag) that sets a key explicitly wins outright. When an immature version is refused, the error now names where the cutoff came from — the reported issue's real complaint was that nothing in the message pointed at the workspace setting — and an interactive run offers to update anyway, matching how a strict install prompts. CI still fails closed. Mirrored in pacquet: `Config::current_for_self_update` resolves the same policy, and `self-update` gained the matching prompt and error. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Typecheck fixes on top of the previous commit: `ci` is a required `Config` field, so `self-update`'s option type takes it as optional, and `minimumReleaseAgeSource` has to be split out into the returned `ConfigContext` for callers to read it. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Also adds the trailing comma the `perfectionist` dylint rule wants in the self-update prompt's `format!`. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
`cargo doc -D warnings` rejects a public doc comment linking to a private method, so state the self-update release-age rule inline instead. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…merging them Reworks the previous commits' rule. Comparing the project's `minimumReleaseAge` against the trusted layers rested on "a repository can only make the cooldown stricter, which is the safe direction". That is true for a dependency install, where the worst case is a failed install, but not for `self-update`: raising the cutoff is a denial of update. A repository can pin the machine to the installed pnpm — including past a release that fixes a vulnerability in it — and unlike a blocked dependency upgrade that decision follows the user into every other project, because it is the global binary. There is therefore no direction in which repo-controlled input on this setting is worth honoring. The project `pnpm-workspace.yaml` no longer contributes the release-age settings to `self-update` at all; the policy comes from the built-in defaults, the global config, the environment, and CLI flags — the same trust boundary the fetch already uses. Other commands are unaffected. This removes the trusted-layer snapshot, the env-set-key tracking, the merge function, and the `minimumReleaseAgeSource` reporting field from both stacks. The refusal keeps its interactive "update anyway?" prompt, and there is still no new default: at zero config `self-update` behaves as it did before. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The project `pnpm-workspace.yaml` still contributed `trustPolicy`, `trustPolicyExclude`, `trustPolicyIgnoreAfter`, and `ci` to `self-update`. Both reach the decision the release-age settings were removed from: the trust policy is passed straight into self-update's resolve (the only version selection it makes, so it is what runs the no-downgrade check on the pnpm release), and `ci` gates whether an immature pick may be confirmed at the keyboard — a repo setting `ci: false` re-enables that prompt on a runner with a pseudo-TTY, where self-update has to fail closed. The reasoning is the one already applied to the cooldown: a repository must not get a say in whether the machine's pnpm binary may be replaced, in either direction. Both settings join the skip set; global config, env, and CLI flags still set them. Reported by qodo-code-review on pnpm#12813. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Pacquet's prompt gate tested only `stdin().is_terminal()`, so a CI runner that allocates a pseudo-TTY reached the "update anyway?" confirmation, where the TypeScript CLI refuses. `is_ci::cached()` closes it — the same detection `package_manager::install` already uses for its own prompt gate, so the two prompts in pacquet now agree with each other as well as with pnpm. pnpm's `ci` setting itself is still unported (it is listed in the `pnpm_default_parity` NOT_PORTED bucket), so a trusted `PNPM_CONFIG_CI=false` cannot re-enable the prompt in pacquet the way it can in the TypeScript CLI. Pacquet detects CI at each point of use instead of carrying the setting. The prompt branch has no test on either stack: reaching it needs a pty, and no pty harness exists in the workspace. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
8fa8789 to
8caa581
Compare
|
Code review by qodo was updated up to the latest commit 8caa581 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The doc comment on enforce_resolution_policy links to WorkspaceSettings::clear_self_update_policy, but WorkspaceSettings is not in scope in pacquet-cli, so rustdoc rejected the intra-doc link under -D warnings. Point the link at the public re-export in pacquet_config. Co-Authored-By: Claude Fable 5 <[email protected]>
|
Code review by qodo was updated up to the latest commit 30b4a0d |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
Fixes #12803.
pnpm self-updateresolved the pnpm download through the active project's registry/auth config and loaded the repo's default.pnpmfile.(c|m)js, and itsminimumReleaseAgepolicy came from the workspace manifest with no limit on the direction. That is one reported bug and one unreported hole:minimumReleaseAgemakesself-updatefail inside the repo and succeed outside it, with nothing in the error pointing at the workspace setting;minimumReleaseAge: 0,minimumReleaseAgeStrict: false, or listpnpminminimumReleaseAgeExcludeand silently switch off the cooldown the user configured globally, on the one download that replaces the binary every later install runs through.This PR closes both without giving up the protection.
The fetch goes through the trusted package-manager bootstrap config. That is the channel
switchCliVersion/syncEnvLockfilealready use and that pacquet'sself-updatealready used — it is built from the non-project config sources, so a project.npmrcorpnpm-workspace.yamlcannot redirect the pnpm download or attach its own credentials to it.getPackageManagerBootstrapConfigmoved frompnpm11/pnpm/srcinto@pnpm/config.readerso the command package can use it too. The repo's default pnpmfile is no longer auto-loaded forself-update: itsupdateConfighook can rewrite any setting and itscustomResolvers/customFetchersreach the same requests. Pnpmfiles from trusted sources (thepnpmfilesetting, the global pnpmfile, config-dependency plugins) still load.The project's release-age settings no longer reach
self-update.minimumReleaseAgeis dangerous in both directions for a command that replaces the global binary: lowering it waives the cooldown the user configured, and raising it pins the machine to the installed pnpm — including past a release that fixes a vulnerability in it. Unlike a blocked dependency upgrade, that decision follows the user into every other project. Sopnpm-workspace.yamlgets no say: the cutoff comes from the built-in default, the global config,PNPM_CONFIG_*, or a CLI flag. Every other command is unaffected, and there is no new default — at zero configpnpm self-updatebehaves exactly as before.Nor do its
trustPolicysettings or itsciflag. The same reasoning covers the rest of what decides whether the binary may be replaced. Self-update'sresolveis its only version selection, sotrustPolicy/trustPolicyExclude/trustPolicyIgnoreAfterare what run the no-downgrade check on the pnpm release itself — a repo that turns the policy off waives it, one that turns it on blocks the update. Andcigates the confirmation prompt below:ci: falsein a checkout would re-enable it on a CI runner with a pseudo-TTY, exactly where self-update has to fail closed. Global config, env, and CLI flags still set all of them.The refusal is actionable. An interactive run offers to update anyway when the requested version is younger than the cutoff, the same way a strict install prompts — the cutoff can now only be the user's own policy, so confirming it is theirs to give. CI and other non-interactive runs still fail closed with
ERR_PNPM_NO_MATURE_MATCHING_VERSION. AtrustPolicydowngrade remains non-negotiable.Both stacks: the TypeScript config reader skips the settings under
getConfig({ forSelfUpdate: true }), pacquet underConfig::current_for_self_update, and both commands gained the same prompt and message. Pacquet's gate detects CI withis_ci— the cratepackage_manager::installalready uses for its own prompt — so a runner that attaches a pseudo-TTY fails closed there too. pnpm'scisetting remains unported in pacquet (it sits in thepnpm_default_parityNOT_PORTED bucket), which is why pacquet detects CI at each point of use rather than reading it from config.Squash Commit Body
Checklist
pnpm/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.
Originally written by an agent (opencode, glm-5.2); reworked by an agent (Claude Code, claude-opus-4-8).