Repository navigation
test(pacquet): port the upstream optionalDependencies install suite - #13141
Conversation
Port the "Proper Support Of optionalDependencies" block of plans/TEST_PORTING.md — sixteen tests from `installing/deps-installer/test/install/optionalDependencies.ts`, `hoist.ts:540`, and the three `deps-restorer` headless include-filter tests — plus `updatingPkgJson.ts:112`, whose `installSome` suite was missing from the plan entirely. The new `optional_dependencies.rs` CLI suite holds most ports; `hoist.ts:540` replaces its former `known_failures` stub (the fixture it was waiting on exists now), and the `--force`-dependent cases stay gated because `install --force` is not wired on pacquet's CLI yet. Porting surfaced four behavioral gaps, fixed here so the ports assert pnpm's behavior rather than enshrining divergence: - The recorded skip set is now the reachability closure of the direct skips: dependencies reachable only through a skipped optional package land in `.modules.yaml`'s `skipped` too, and every downstream pass (materialization, hoist, symlinks, bins, prune) observes them (`extend_skipped_with_dependency_closure`, applied in both install paths before their consumers). - `compute_skipped_snapshots` re-evaluates seeded installability skips instead of short-circuiting them, so changing `--os` / `--cpu` / `supportedArchitectures` between installs un-skips the now-compatible platform packages. pnpm recomputes installability fresh on every install. - `PackageManifest::add_dependency` moves an already-declared dependency to the target group (and the re-add specifier lookup scans the manifest in pnpm's `findSpec` field order), matching `updateProjectManifestObject`: a dependency has one home among the three install groups. `Peer` saves stay additive. - `real-hoist` tolerates a missing snapshot behind an *optional* edge instead of failing with `ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY` — a skipped optional's snapshot is legitimately absent from the current lockfile the hoisted-linker differ walks. The TypeScript CLI already behaves this way in all four cases (the ported tests are its own coverage; the group-move semantics were verified against pnpm 11.13.1 directly), so no TS-side changes are needed. Known divergences left for follow-up, recorded in the plan: pacquet drops installability-skipped snapshots from the current lockfile where pnpm keeps them, and a warm dependent's slot does not gain in-parent alias symlinks for newly un-skipped optionals (Node resolution works through the `.pnpm/node_modules` fallback, which is also what upstream's `deepRequireCwd` assertions exercise).
📝 WalkthroughWalkthroughThis PR moves dependencies between manifest groups, re-evaluates skipped optional packages, records skipped dependency closures, tolerates missing optional snapshots during hoisting, and adds Rust integration coverage. ChangesDependency group moves
Optional dependency installation
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Install
participant Installability
participant SkipClosure
participant Hoister
Install->>Installability: evaluate optional dependency constraints
Installability->>SkipClosure: provide directly skipped snapshots
SkipClosure->>Hoister: provide closure-complete skipped set
Hoister->>Install: omit missing optional snapshots
Possibly related PRs
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 QodoPort upstream optionalDependencies install tests; fix skip closure, arch recheck, add-group moves
AI Description
Diagram
High-Level Assessment
Files changed (18)
|
Micro-Benchmark ResultsLinux |
Confidence Score: 5/5Safe to merge. All four behavioral fixes are isolated to their respective code paths, the logic matches pnpm's documented behavior, and every new code path has unit and integration test coverage. The changes are well-scoped: each behavioral fix is surgically applied to one function or module, backed by explicit tests that were verified to fail before the fix, and the resulting behavior matches the TypeScript pnpm reference. The skip-set closure, arch-change un-skip, group-move, and hoist-tolerates-optional-missing changes all have clear correctness invariants documented in code and verified by tests. No pre-existing contracts are broken. No files require special attention. The install-path changes in install_frozen_lockfile.rs and install_with_fresh_lockfile.rs are the most load-bearing additions, but both are exercised by the new integration tests in optional_dependencies.rs. Reviews (3): Last reviewed commit: "fix(pacquet): seed the skip closure from..." | Re-trigger Greptile |
Code Review by Qodo
1.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pnpm/crates/real-hoist/src/lib.rs (1)
373-374: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low valueAvoid string allocations when sorting dependencies.
Sorting the merged dependencies by calling
.to_string()on the alias allocates a newStringfor every entry just to compare them.PkgNamealready implementsOrd, so the string allocation is unnecessary. Switching the underlying map fromHashMaptostd::collections::BTreeMapeliminates the need to collect into aVecand sort entirely, while preserving the deterministic alias-sorted output.
pnpm/crates/real-hoist/src/lib.rs#L373-L374: Change themergedmap (lines 362-363) tostd::collections::BTreeMapand replace these collection/sorting lines by iterating directly overmerged.pnpm/crates/real-hoist/src/lib.rs#L491-L492: Change themergedmap (line 483) tostd::collections::BTreeMapand replace these collection/sorting lines by iterating directly overmergedhere 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/real-hoist/src/lib.rs` around lines 373 - 374, Replace the merged maps in pnpm/crates/real-hoist/src/lib.rs at lines 362-363 and 483 with std::collections::BTreeMap, then update both output paths at lines 373-374 and 491-492 to iterate directly over merged instead of collecting and sorting by alias.to_string(). Preserve the deterministic alias ordering while avoiding per-entry string allocations.
🤖 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/real-hoist/src/lib.rs`:
- Around line 364-368: Update both dependency merge arrays in
pnpm/crates/real-hoist/src/lib.rs: at lines 364-368, move optional_dependencies
before dependencies and dev_dependencies; at lines 484-486, move
snapshot.optional_dependencies before the non-optional groups. Preserve the
existing merge logic so later non-optional entries overwrite optional flags with
false.
---
Nitpick comments:
In `@pnpm/crates/real-hoist/src/lib.rs`:
- Around line 373-374: Replace the merged maps in
pnpm/crates/real-hoist/src/lib.rs at lines 362-363 and 483 with
std::collections::BTreeMap, then update both output paths at lines 373-374 and
491-492 to iterate directly over merged instead of collecting and sorting by
alias.to_string(). Preserve the deterministic alias ordering while avoiding
per-entry string allocations.
🪄 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: 630ff107-36a5-43c1-9a39-17300cf32724
📒 Files selected for processing (18)
.changeset/add-moves-dependency-between-groups.md.changeset/hoist-tolerates-skipped-optional-snapshots.md.changeset/reevaluate-skipped-optionals-on-arch-change.md.changeset/skipped-optional-dependency-closure.mdpnpm/crates/cli/tests/_utils.rspnpm/crates/cli/tests/add.rspnpm/crates/cli/tests/hoist.rspnpm/crates/cli/tests/optional_dependencies.rspnpm/crates/package-manager/src/add.rspnpm/crates/package-manager/src/current_lockfile.rspnpm/crates/package-manager/src/install/tests.rspnpm/crates/package-manager/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manager/src/installability.rspnpm/crates/package-manager/src/installability/tests.rspnpm/crates/package-manifest/src/lib.rspnpm/crates/real-hoist/src/lib.rspnpm/plans/TEST_PORTING.md
PR Code Suggestions ✨Warning
Explore these optional code suggestions:
|
|||||||||
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.49439687586,
"stddev": 0.15485795292170249,
"median": 2.4650060509600005,
"user": 1.476087,
"system": 1.3148597,
"min": 2.34541224546,
"max": 2.76279965646,
"times": [
2.3460255184600003,
2.57692356446,
2.3518400384600002,
2.51767274146,
2.76279965646,
2.6022316354600004,
2.35196667546,
2.67675732246,
2.34541224546,
2.4123393604600003
]
},
{
"command": "pacquet@main",
"mean": 2.50544130836,
"stddev": 0.17056236309921594,
"median": 2.44453574846,
"user": 1.5128137,
"system": 1.2638897000000002,
"min": 2.33669476146,
"max": 2.77874474146,
"times": [
2.74052240946,
2.40931905846,
2.70898610746,
2.4761718734600002,
2.44469184646,
2.44437965046,
2.33669476146,
2.37537643446,
2.77874474146,
2.33952620046
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5527072510600004,
"stddev": 0.1379841632212979,
"median": 1.57157230946,
"user": 1.0518921999999997,
"system": 1.1208788,
"min": 1.3554078714600002,
"max": 1.7381902994600003,
"times": [
1.63661955746,
1.73247164146,
1.3554078714600002,
1.47768312546,
1.37545770946,
1.7381902994600003,
1.52817703846,
1.4433604364600001,
1.61496758046,
1.6247372504600002
]
},
{
"command": "pnpr@main",
"mean": 1.56721073686,
"stddev": 0.16979274118043491,
"median": 1.5748054019600002,
"user": 1.0387667999999999,
"system": 1.1587721000000002,
"min": 1.33880756246,
"max": 1.7951386614600002,
"times": [
1.6640938104600003,
1.7951386614600002,
1.7000023134600002,
1.7178343874600002,
1.7262790574600002,
1.4508942254600001,
1.42865678846,
1.48551699346,
1.36488356846,
1.33880756246
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25331004312000005,
"stddev": 0.004908240326868456,
"median": 0.25306350452000004,
"user": 0.20166028000000003,
"system": 0.53913008,
"min": 0.24550017352000003,
"max": 0.26043186852,
"times": [
0.24550017352000003,
0.25874697352000003,
0.26043186852,
0.25106866252000004,
0.24833002852000002,
0.25505834652000003,
0.25719692152,
0.25627399952,
0.25027106452000003,
0.25022239252
]
},
{
"command": "pacquet@main",
"mean": 0.24675530122000003,
"stddev": 0.006897031164269239,
"median": 0.24777309702000003,
"user": 0.19382768,
"system": 0.50670228,
"min": 0.23361823652000002,
"max": 0.25643721452,
"times": [
0.24082041352000003,
0.25533044552,
0.24918973252,
0.24682299752000003,
0.24872319652000002,
0.24367717852,
0.25056548652000005,
0.25643721452,
0.23361823652000002,
0.24236811052
]
},
{
"command": "pnpr@HEAD",
"mean": 0.27258543492,
"stddev": 0.009196448070704036,
"median": 0.27456247352,
"user": 0.19513788,
"system": 0.55624758,
"min": 0.25757049352,
"max": 0.28483811752000004,
"times": [
0.27501373552,
0.27711291852000003,
0.26560652752,
0.26193418952,
0.28097883952,
0.27411121152,
0.28202799952,
0.26666031652,
0.25757049352,
0.28483811752000004
]
},
{
"command": "pnpr@main",
"mean": 0.26459130972,
"stddev": 0.007315062992073662,
"median": 0.26300469602000004,
"user": 0.20615548,
"system": 0.53548058,
"min": 0.25441691152,
"max": 0.27831713052,
"times": [
0.26281203952000004,
0.26092849952,
0.26802498952000003,
0.27157945652000004,
0.26319735252000004,
0.25887648752000003,
0.27831713052,
0.25768114152000005,
0.25441691152,
0.27007908852
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.69041893088,
"stddev": 0.02015228789260131,
"median": 2.69427676758,
"user": 1.5955610000000002,
"system": 1.26333882,
"min": 2.6523897940800003,
"max": 2.71092044808,
"times": [
2.69300684308,
2.68464939508,
2.68890602008,
2.71023450008,
2.70968484708,
2.66052579708,
2.71092044808,
2.69832497208,
2.6523897940800003,
2.69554669208
]
},
{
"command": "pacquet@main",
"mean": 2.6891518877799996,
"stddev": 0.022248891961497798,
"median": 2.68466063158,
"user": 1.5992824999999997,
"system": 1.23783882,
"min": 2.65900123308,
"max": 2.73508169408,
"times": [
2.69049121808,
2.6788300450799998,
2.67542711308,
2.70236759508,
2.73508169408,
2.7010488610800003,
2.67340241308,
2.70485478908,
2.65900123308,
2.67101391608
]
},
{
"command": "pnpr@HEAD",
"mean": 1.48324289488,
"stddev": 0.12725001965591878,
"median": 1.4192111990799998,
"user": 0.9775922999999999,
"system": 1.12037832,
"min": 1.37929272008,
"max": 1.70459244708,
"times": [
1.5662311950799999,
1.39436411808,
1.70459244708,
1.40028744508,
1.43793557908,
1.70061963508,
1.40048681908,
1.40019017208,
1.44842881808,
1.37929272008
]
},
{
"command": "pnpr@main",
"mean": 1.6045252694800003,
"stddev": 0.12958633834349176,
"median": 1.6020718115800001,
"user": 0.9797625999999999,
"system": 1.09635112,
"min": 1.39142212208,
"max": 1.75509039708,
"times": [
1.6150253540800001,
1.74247764608,
1.73461779408,
1.75509039708,
1.39142212208,
1.65273195808,
1.58885691208,
1.58015725208,
1.58911826908,
1.39575499008
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5359876723799999,
"stddev": 0.012254334193295725,
"median": 0.53399089978,
"user": 0.6556847800000001,
"system": 0.6564261,
"min": 0.51641331828,
"max": 0.55721676028,
"times": [
0.53026080928,
0.54537869428,
0.54933934428,
0.53658394528,
0.53139785428,
0.54013049728,
0.55721676028,
0.5277514652799999,
0.52540403528,
0.51641331828
]
},
{
"command": "pacquet@main",
"mean": 0.53636765518,
"stddev": 0.013048952584831746,
"median": 0.54024735578,
"user": 0.6713897799999999,
"system": 0.6251854,
"min": 0.51610290528,
"max": 0.55033340228,
"times": [
0.51909037728,
0.51610290528,
0.54166345628,
0.55033340228,
0.53883125528,
0.54773276628,
0.53335735528,
0.54800550928,
0.52179438628,
0.54676513828
]
},
{
"command": "pnpr@HEAD",
"mean": 0.2943963796800001,
"stddev": 0.00478274343116407,
"median": 0.29464662878000003,
"user": 0.18910458,
"system": 0.5172286,
"min": 0.28715715128,
"max": 0.30055878428000005,
"times": [
0.29739583228000005,
0.29911756728000005,
0.28715715128,
0.29921278528000006,
0.29075676228,
0.29234670928000006,
0.28913259128,
0.29694654828000006,
0.29133906528000003,
0.30055878428000005
]
},
{
"command": "pnpr@main",
"mean": 0.28730973748000005,
"stddev": 0.006319174511210878,
"median": 0.28685229278,
"user": 0.16717948,
"system": 0.5243922999999999,
"min": 0.27995673628000006,
"max": 0.30046681128,
"times": [
0.28296656028000006,
0.28042028728,
0.28277798528000003,
0.29227835028000004,
0.28576317228000003,
0.27995673628000006,
0.30046681128,
0.29072462128000004,
0.28794141328000006,
0.28980143728
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.8357112146600003,
"stddev": 0.009616703981098833,
"median": 1.83476924386,
"user": 0.8745055,
"system": 0.72970052,
"min": 1.82311373036,
"max": 1.85898637036,
"times": [
1.85898637036,
1.82733607136,
1.8391840053600002,
1.83220782236,
1.8315904433599999,
1.83747451436,
1.83768070136,
1.82311373036,
1.83718574336,
1.83235274436
]
},
{
"command": "pacquet@main",
"mean": 1.8276014540599999,
"stddev": 0.00893627473134073,
"median": 1.82854799836,
"user": 0.8386682999999999,
"system": 0.7321434200000001,
"min": 1.81086822936,
"max": 1.84061354036,
"times": [
1.83500508636,
1.82980496936,
1.84061354036,
1.83616996436,
1.82210446536,
1.83207055436,
1.82109683236,
1.81086822936,
1.82729102736,
1.82098987136
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29272731216,
"stddev": 0.006286246898830491,
"median": 0.29330356686000003,
"user": 0.18100650000000001,
"system": 0.53356702,
"min": 0.28224150336,
"max": 0.30105130436,
"times": [
0.29442012936,
0.29714573836,
0.28440350436,
0.28224150336,
0.29579102336,
0.30105130436,
0.28974736136,
0.28992215036,
0.29218700436,
0.30036340236
]
},
{
"command": "pnpr@main",
"mean": 0.28466508156000003,
"stddev": 0.005925067140014827,
"median": 0.28646278786,
"user": 0.17392039999999998,
"system": 0.50214542,
"min": 0.27269453036,
"max": 0.29107966436,
"times": [
0.28180739836,
0.29107966436,
0.27269453036,
0.28735949736,
0.28556607836,
0.28824539036,
0.28993821036,
0.29007720036,
0.28054861336,
0.27933423236
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32216742629999995,
"stddev": 0.007451470724970854,
"median": 0.3224188759,
"user": 0.31760617999999996,
"system": 0.05210687999999999,
"min": 0.3111658949,
"max": 0.33167039890000005,
"times": [
0.3258866959,
0.31460914390000005,
0.33167039890000005,
0.3305448549,
0.32853281590000005,
0.3271298609,
0.3187795559,
0.3111658949,
0.3189510559,
0.3144039859
]
},
{
"command": "pacquet@main",
"mean": 0.32677688200000005,
"stddev": 0.008635843270643654,
"median": 0.32418448590000004,
"user": 0.31487208,
"system": 0.05564097999999999,
"min": 0.31632787990000005,
"max": 0.3468590429,
"times": [
0.3468590429,
0.32247513590000004,
0.32539634190000005,
0.31954986090000004,
0.32253814290000005,
0.32297262990000003,
0.31632787990000005,
0.32892111290000003,
0.3294991179,
0.3332295549
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08567822893030305,
"stddev": 0.002153818932385733,
"median": 0.0863550219,
"user": 0.018634610303030305,
"system": 0.009594586666666668,
"min": 0.0810957849,
"max": 0.0886246159,
"times": [
0.0865097529,
0.0876740899,
0.0869231999,
0.0863680859,
0.0810957849,
0.0843298489,
0.0874330569,
0.0868981519,
0.0868584479,
0.0880212519,
0.0881079949,
0.0873846759,
0.0856400889,
0.0825115239,
0.0865983499,
0.0854113499,
0.0863550219,
0.0875713169,
0.0862864529,
0.0886246159,
0.0854190739,
0.0862270819,
0.0816108509,
0.0829154219,
0.0825073749,
0.0873994139,
0.0873309449,
0.0862267019,
0.0829756849,
0.0873187719,
0.0863544009,
0.0821454459,
0.0823473249
]
},
{
"command": "pnpr@main",
"mean": 0.08565579690000001,
"stddev": 0.002291605213145073,
"median": 0.0864385149,
"user": 0.020201517499999995,
"system": 0.00826016875,
"min": 0.0809839749,
"max": 0.0889577909,
"times": [
0.0874101939,
0.0863121229,
0.0835003509,
0.0872922429,
0.0877991849,
0.0866021669,
0.0874234289,
0.0873119599,
0.0889577909,
0.0857059429,
0.0870776399,
0.0832320469,
0.0865649069,
0.0823414039,
0.0872046379,
0.0868725949,
0.0809839749,
0.0853137759,
0.0877061299,
0.0857848009,
0.0821988259,
0.0815511599,
0.0817333819,
0.0848472099,
0.0873030629,
0.0884543059,
0.0867181339,
0.0857827979,
0.0814778719,
0.0860327869,
0.0854301349,
0.0880585319
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.50580828918,
"stddev": 0.17150914892101643,
"median": 4.42624406498,
"user": 1.66392192,
"system": 1.3760408400000002,
"min": 4.39712295998,
"max": 4.8548617489799994,
"times": [
4.39712295998,
4.42328531798,
4.41472477898,
4.4130008709799995,
4.43185491298,
4.42920281198,
4.47260027098,
4.41977317098,
4.8548617489799994,
4.80165604798
]
},
{
"command": "pacquet@main",
"mean": 4.475607641080001,
"stddev": 0.09500382434288997,
"median": 4.45360434348,
"user": 1.6801975199999997,
"system": 1.3354908399999996,
"min": 4.40357532898,
"max": 4.74128751298,
"times": [
4.45350754198,
4.40357532898,
4.4660494569799996,
4.454497078979999,
4.74128751298,
4.45370114498,
4.43787965898,
4.43618797198,
4.44763102398,
4.46175969098
]
},
{
"command": "pnpr@HEAD",
"mean": 3.50921812618,
"stddev": 0.10713204428660811,
"median": 3.47250751998,
"user": 1.1771159199999999,
"system": 1.2118324399999998,
"min": 3.4424214459800004,
"max": 3.8012894089800002,
"times": [
3.8012894089800002,
3.4424214459800004,
3.4568918649800002,
3.46629501698,
3.44867533298,
3.47872002298,
3.4520788069800004,
3.49111815998,
3.52019272698,
3.5344984749800004
]
},
{
"command": "pnpr@main",
"mean": 3.54803266018,
"stddev": 0.13205155477036565,
"median": 3.5042186294800004,
"user": 1.1743629199999999,
"system": 1.23807964,
"min": 3.43045159598,
"max": 3.8562422019800002,
"times": [
3.47211089998,
3.8562422019800002,
3.4492265479800004,
3.5363263589800003,
3.5950906589800002,
3.6346462819800003,
3.60523409998,
3.43562831898,
3.43045159598,
3.4653696369800002
]
}
]
} |
|
| Branch | pr/13141 |
| 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,379.29 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 282.24 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 287.16 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 81.10 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,355.41 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,442.42 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 257.57 ms |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13141 +/- ##
==========================================
+ Coverage 85.64% 85.84% +0.20%
==========================================
Files 505 505
Lines 83660 83943 +283
==========================================
+ Hits 71653 72065 +412
+ Misses 12007 11878 -129 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… breakage Cargo's freshness check is mtime-based, so reverting a deliberately broken implementation by moving a backup copy into place leaves the broken artifact looking fresh, and later test runs fail in impossible-looking ways. Prescribe git restore (or a follow-up touch) in the test-the-tests workflow that plans/TEST_PORTING.md mandates, and cross-reference it from the AGENTS.md Tests section.
Code Review by Qodo
1. Unsafe store/cache cleanup
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The closure extension computed its roots from the whole skip-set union but persisted its additions into the installability subset, so a transient exclusion (`--no-optional`, `--no-runtime`, a failed optional fetch) could leak its dependency subtree into `.modules.yaml`'s `skipped` — and the frozen path's constraint-free fast path reuses that seed verbatim, keeping the subtree skipped after the transient condition is gone. Seed and extend the closure from the persisted installability subset only; transient subtrees are already cut from materialization by the reachability walks that consume the full union. Also narrow `extend_skipped_with_dependency_closure` to `pub(crate)` (it has no callers outside the crate, matching its peers), and reference the new tracking issue #13142 from the `install --force` known-failure stubs and the porting plan.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm/crates/package-manager/src/current_lockfile/tests.rs (1)
1268-1271: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePrefer
contains_installabilityover stringifying the iterator.You can avoid string allocations and simplify this assertion by using the available
contains_installabilitymethod, making it consistent with howcontainsis used in the second test.♻️ Proposed fix
- assert!( - skipped.iter_installability().any(|key| key.to_string() == "[email protected]"), - "a snapshot only reachable through an installability skip joins the persisted set", - ); + assert!( + skipped.contains_installability(&key("child", "1.0.0")), + "a snapshot only reachable through an installability skip joins the persisted set", + );🤖 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/current_lockfile/tests.rs` around lines 1268 - 1271, Update the assertion for skipped installability snapshots to use the available contains_installability method with the [email protected] key instead of iterating, converting keys to strings, and comparing them. Keep the existing assertion message and expected membership unchanged.
🤖 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/package-manager/src/current_lockfile/tests.rs`:
- Around line 1268-1271: Update the assertion for skipped installability
snapshots to use the available contains_installability method with the
[email protected] key instead of iterating, converting keys to strings, and comparing
them. Keep the existing assertion message and expected membership unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 2a77b16b-0c3b-475a-92c3-0fcca6957827
📒 Files selected for processing (4)
pnpm/crates/cli/tests/optional_dependencies.rspnpm/crates/package-manager/src/current_lockfile.rspnpm/crates/package-manager/src/current_lockfile/tests.rspnpm/plans/TEST_PORTING.md
🚧 Files skipped from review as they are similar to previous changes (3)
- pnpm/crates/package-manager/src/current_lockfile.rs
- pnpm/plans/TEST_PORTING.md
- pnpm/crates/cli/tests/optional_dependencies.rs
Summary
Follow-up to #13138: port the TypeScript test coverage whose absence let that bug ship. This lands the "Proper Support Of
optionalDependencies" block ofpnpm/plans/TEST_PORTING.md— sixteen tests frominstalling/deps-installer/test/install/optionalDependencies.ts,hoist.ts:540, and the threedeps-restorerheadless include-filter tests — plusupdatingPkgJson.ts:112, whoseinstallSomesuite was missing from the plan entirely (a new plan section now enumerates it).Most ports live in the new
crates/cli/tests/optional_dependencies.rssuite.hoist.ts:540replaces its formerknown_failuresstub (the@pnpm.e2e/not-compatible-with-any-osfixture it was waiting on exists now). The--force-dependent cases (optionalDependencies.ts:199and the forced-headless tail of:283) are gated asknown_failuresbecauseinstall --forceis not wired on pacquet's CLI — a parity gap in its own right.Porting surfaced four behavioral gaps, fixed here so the ports assert pnpm's behavior instead of enshrining divergence (each has a changeset):
.modules.yaml'sskippednow records the dependencies reachable only through a skipped optional package, and every downstream pass (materialization, hoist, symlinks, bins, prune) observes the closure.--os/--cpu/supportedArchitecturesinstalls the newly compatible platform packages instead of leaving them skipped.addmoves a dependency between groups. Saving an existing dependency with--save-dev/--save-optional/--save-prodremoves it from its old group, and the re-add specifier lookup follows pnpm'sfindSpecfield order (verified against pnpm 11.13.1; the previous pacquet-only test asserting the old behavior is updated).ERR_PNPM_LOCKFILE_MISSING_DEPENDENCY.Every ported test was verified to fail with its subject behavior broken (the skip-family via a temporarily neutered
compute_skipped_snapshots; the rest failed naturally against the pre-fix code during development). Full runs:pacquet-cliintegration suite 1735/1735,pacquet-package-manager+pacquet-real-hoist+pacquet-package-manifest845/845, clippy and fmt clean.Known divergences left for follow-up (recorded in the plan / noted here):
lock.yamlwhere pnpm keeps them (withoptional: truemarkers)..pnpm/node_modulesfallback, which is also what upstream'sdeepRequireCwdassertions exercise.install --forceis missing from pacquet's CLI surface (TypeScript pnpm accepts it), as are--global-dir/--global-bin-diron global commands.npm-resolver/package-requesterunit-level items in the plan section remain open; they test TS-internal API shapes and need a pacquet-native design.Also hardens the workflow itself:
plans/TEST_PORTING.md's "test the tests" instructions (and theAGENTS.mdTests section) now prescribegit restorefor reverting the temporary breakage — an mtime-preserving restore leaves cargo serving the binary compiled from the broken source, which surfaced during this work as an hour of impossible-looking flaky failures.Squash Commit Body
Checklist
pnpm/port, or the description notes what still needs porting. (Rust-only:every behavioral fix brings pacquet to already-verified TypeScript behavior;
the ported tests are the TS suite's own coverage.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
(Four changesets, one per behavioral fix; test-only changes need none.)
plans/TEST_PORTING.mdcheckboxesand a new "Manifest Group Mutations" section.)
Written by an agent (Claude Code, claude-fable-5).
Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
addnow movesname@versionbetween dependency groups (non-peer) instead of leaving duplicates in prior groups.optionalDependenciesno longer break installs/hoisting; their skipped dependency closure is tracked and respected across fresh, frozen, and headless installs.