Repository navigation
fix(deps-restorer): react to removed packages in the headless install - #13700
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughHeadless installation now detects removed lockfile packages, recomputes hoisting, marks unchanged graph nodes as built, and reconciles ChangesHeadless removal reconciliation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant headlessInstall
participant WantedLockfile
participant Hoisting
participant ModulesManifest
User->>headlessInstall: run install
headlessInstall->>WantedLockfile: compare installed and wanted packages
WantedLockfile-->>headlessInstall: return removed packages
headlessInstall->>Hoisting: recompute hoisted dependencies
Hoisting-->>headlessInstall: return updated hoist map
headlessInstall->>ModulesManifest: reconcile pendingBuilds
ModulesManifest-->>User: updated install state
Assessment against linked issues
Possibly related PRs
Suggested labels: Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed. For unrecoverable errors, disable the tool in CodeRabbit configuration. 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 QodoFix headless install to handle lockfile-only package removals
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@pnpm/crates/cli/tests/hoist.rs`:
- Around line 1546-1587: Extend
rehoists_when_an_up_to_date_lockfile_removes_a_direct_dependency to create
pending builds using --ignore-scripts, remove the dependency through
--lockfile-only, and run the headless install. Then read the resulting wanted
lockfile and assert every remaining pendingBuilds entry references a package
present in that lockfile, covering stale-entry cleanup alongside the existing
rehoisting assertions.
In `@pnpm11/installing/deps-restorer/src/index.ts`:
- Around line 608-618: Reconcile opts.pendingBuilds against wantedLockfile for
every install mode in the deps-restorer flow: always remove entries absent from
wantedLockfile.packages or wantedLockfile.importers, while adding requiresBuild
depNodes only when opts.ignoreScripts is true. In
pnpm11/installing/deps-restorer/src/index.ts lines 608-618, update the logic
around opts.pendingBuilds and depNodes; in
pnpm11/installing/deps-installer/test/lockfile.ts lines 637-667, run the final
install without ignoreScripts and assert every remaining pending entry exists in
the resulting wanted lockfile rather than checking only the count.
🪄 Autofix
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: 5c5a399a-3529-42ed-8a59-7cc2c6e1c97c
📒 Files selected for processing (5)
.changeset/headless-removal-bookkeeping.mdpnpm/crates/cli/tests/hoist.rspnpm11/installing/deps-installer/test/install/hoist.tspnpm11/installing/deps-installer/test/lockfile.tspnpm11/installing/deps-restorer/src/index.ts
Micro-Benchmark ResultsLinux |
Code Review by Qodo
1. Prototype-chain key lookups
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Confidence Score: 5/5The PR appears safe to merge because no blocking failure remains. No blocking failure remains. Reviews (3): Last reviewed commit: "style(deps-installer): widen the test he..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13700 +/- ##
==========================================
- Coverage 88.19% 88.19% -0.01%
==========================================
Files 615 615
Lines 99955 99955
==========================================
- Hits 88160 88155 -5
- Misses 11795 11800 +5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
Integrated-Benchmark Report (Linux)Commit: Regular scenarios report direct and pnpr installs. The peer-heavy resolver scenario compares current Rust, main Rust, and TypeScript pnpm. 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.55217677416,
"stddev": 0.1564329216914678,
"median": 2.48249640426,
"user": 1.7876368,
"system": 1.4849071199999997,
"min": 2.38555849776,
"max": 2.8181828377600002,
"times": [
2.38555849776,
2.8181828377600002,
2.49171933976,
2.74097810276,
2.40945437976,
2.4187945757600002,
2.6358562667600003,
2.47327346876,
2.69661402276,
2.45133624976
]
},
{
"command": "pacquet@main",
"mean": 2.6308361083600005,
"stddev": 0.11550065813340968,
"median": 2.68106674576,
"user": 1.6328615,
"system": 1.34186212,
"min": 2.38459505276,
"max": 2.72633988676,
"times": [
2.4879068867600003,
2.70741066676,
2.58046651076,
2.72633988676,
2.62054740476,
2.38459505276,
2.7253579497600002,
2.69752275576,
2.7136032337600002,
2.66461073576
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5337482412600003,
"stddev": 0.1490271082381341,
"median": 1.5843440047600001,
"user": 1.1607403999999997,
"system": 1.21170332,
"min": 1.3437029387600001,
"max": 1.8133981227600002,
"times": [
1.38727879976,
1.6213252857600002,
1.6070693117600001,
1.3437029387600001,
1.57508155976,
1.61041585076,
1.5936064497600002,
1.8133981227600002,
1.3838468217600002,
1.4017572717600002
]
},
{
"command": "pnpr@main",
"mean": 1.5708690040600004,
"stddev": 0.1775875502176949,
"median": 1.5756028292600002,
"user": 1.1940938,
"system": 1.1900625200000001,
"min": 1.3716204547600002,
"max": 1.78197209876,
"times": [
1.65922013876,
1.7748484687600001,
1.4197341567600001,
1.38247710076,
1.71535092476,
1.3764790797600002,
1.7350020977600003,
1.78197209876,
1.3716204547600002,
1.49198551976
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.29035669878000003,
"stddev": 0.013108150424655008,
"median": 0.29264344158,
"user": 0.24247297999999998,
"system": 0.5602486999999998,
"min": 0.27122101808000004,
"max": 0.30708242808,
"times": [
0.27184751808,
0.27122101808000004,
0.30664845108000005,
0.28315953308,
0.30095214808000004,
0.30708242808,
0.29457644508,
0.28144259108,
0.29592641708000006,
0.29071043808
]
},
{
"command": "pacquet@main",
"mean": 0.27648349188,
"stddev": 0.012687221836831195,
"median": 0.27474325008,
"user": 0.22643597999999998,
"system": 0.5326668999999999,
"min": 0.26248639608,
"max": 0.29803244208,
"times": [
0.28745146308,
0.28636860508000006,
0.26437171508,
0.26483030908000005,
0.26248639608,
0.28748574708,
0.27220395008000003,
0.27728255008,
0.29803244208,
0.26432174108000006
]
},
{
"command": "pnpr@HEAD",
"mean": 0.28692100928000003,
"stddev": 0.01969735438811248,
"median": 0.28591601758000007,
"user": 0.22086557999999998,
"system": 0.5407442999999998,
"min": 0.26180123708,
"max": 0.32917324408000004,
"times": [
0.27451721408,
0.26180123708,
0.28316737808000003,
0.26666651508000005,
0.29821084708000006,
0.29475393008000006,
0.28866465708000005,
0.32917324408000004,
0.27379232908,
0.29846274108000004
]
},
{
"command": "pnpr@main",
"mean": 0.2954216586800001,
"stddev": 0.01609514440066525,
"median": 0.29100328508000006,
"user": 0.25041287999999995,
"system": 0.5433071999999999,
"min": 0.27798988108000006,
"max": 0.33231932708000006,
"times": [
0.28741790908000003,
0.29012781208000005,
0.27818596008,
0.27798988108000006,
0.31005302008,
0.29752867208000006,
0.29187875808,
0.28968368508000003,
0.29903156208000004,
0.33231932708000006
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.63595257802,
"stddev": 0.023395860455443156,
"median": 2.63163468552,
"user": 1.62816966,
"system": 1.3603291,
"min": 2.59680411702,
"max": 2.6766725590199996,
"times": [
2.6766725590199996,
2.59680411702,
2.6424860630199998,
2.6260532290199996,
2.63107988102,
2.65642506302,
2.6303818470199998,
2.61029843102,
2.6321894900199996,
2.65713510002
]
},
{
"command": "pacquet@main",
"mean": 2.63255731612,
"stddev": 0.019313979494628392,
"median": 2.6284332090199998,
"user": 1.59174716,
"system": 1.3985545000000001,
"min": 2.61701640602,
"max": 2.6834491950199997,
"times": [
2.61701640602,
2.61838480202,
2.62322566502,
2.62885161702,
2.63142040202,
2.6343100920199998,
2.62801480102,
2.62069783702,
2.6834491950199997,
2.64020234402
]
},
{
"command": "pnpr@HEAD",
"mean": 1.64782960472,
"stddev": 0.1310793543556141,
"median": 1.65395022352,
"user": 1.1436302600000001,
"system": 1.2507723,
"min": 1.43747909302,
"max": 1.86188793102,
"times": [
1.72426993602,
1.6521061570200002,
1.53289016302,
1.7456930840200002,
1.43747909302,
1.49013524802,
1.6274008190200002,
1.86188793102,
1.7506393260200002,
1.65579429002
]
},
{
"command": "pnpr@main",
"mean": 1.6620693501200001,
"stddev": 0.1723871498256451,
"median": 1.6970798505200002,
"user": 1.16713826,
"system": 1.2276462000000001,
"min": 1.46478960502,
"max": 1.87547064002,
"times": [
1.74341857302,
1.87547064002,
1.46741926502,
1.49186631602,
1.47620486402,
1.7932258950200002,
1.46478960502,
1.79667561802,
1.6507411280200002,
1.8608815970200001
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.44636417930000005,
"stddev": 0.02095910857906849,
"median": 0.4417059249,
"user": 0.5642953199999999,
"system": 0.72380114,
"min": 0.4193276984,
"max": 0.4797721444,
"times": [
0.4797721444,
0.4467652284,
0.4366466214,
0.42166176240000003,
0.4354529044,
0.4304136974,
0.4610562024,
0.4193276984,
0.46940808440000004,
0.4631374494
]
},
{
"command": "pacquet@main",
"mean": 0.4512809738,
"stddev": 0.01756614115654061,
"median": 0.4499789689,
"user": 0.56622402,
"system": 0.7278123400000001,
"min": 0.4180437214,
"max": 0.4780813814,
"times": [
0.4485809174,
0.4488610944,
0.4518568834,
0.4180437214,
0.4754014364,
0.4376347004,
0.4609102164,
0.4423425434,
0.4780813814,
0.4510968434
]
},
{
"command": "pnpr@HEAD",
"mean": 0.3247303015,
"stddev": 0.009412765881970132,
"median": 0.32525513640000003,
"user": 0.22300782000000002,
"system": 0.5610740399999999,
"min": 0.3122350764,
"max": 0.3389535334,
"times": [
0.3270126554,
0.3389535334,
0.3307254944,
0.3147634064,
0.3179114214,
0.3368706324,
0.3122350764,
0.3157906194,
0.3234976174,
0.3295425584
]
},
{
"command": "pnpr@main",
"mean": 0.31819183399999995,
"stddev": 0.009804878680489326,
"median": 0.3183694589,
"user": 0.20532282,
"system": 0.5506215400000001,
"min": 0.3045445284,
"max": 0.33688098240000003,
"times": [
0.3257878894,
0.3196561964,
0.3046242184,
0.3045445284,
0.3201038004,
0.31556271140000003,
0.3127907124,
0.33688098240000003,
0.3248845794,
0.3170827214
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.7578828702200002,
"stddev": 0.03511355505417958,
"median": 1.7503714169200002,
"user": 0.8232300599999999,
"system": 0.7778808,
"min": 1.7232265664200002,
"max": 1.85027992342,
"times": [
1.85027992342,
1.7525683624200001,
1.7232265664200002,
1.7484880814200001,
1.7465374094200001,
1.74198973842,
1.75225475242,
1.75734664842,
1.77284544342,
1.7332917764200002
]
},
{
"command": "pacquet@main",
"mean": 1.78705744162,
"stddev": 0.019641272818576673,
"median": 1.78628202792,
"user": 0.87727886,
"system": 0.8335649999999999,
"min": 1.76172486142,
"max": 1.8129080584200001,
"times": [
1.7671237344200001,
1.76638418242,
1.76172486142,
1.7741104444200002,
1.8123438464200001,
1.78203686242,
1.7960614494200002,
1.79052719342,
1.8129080584200001,
1.80735378342
]
},
{
"command": "pnpr@HEAD",
"mean": 0.34401347872,
"stddev": 0.009706605789119072,
"median": 0.34629775392,
"user": 0.24331355999999996,
"system": 0.5786871,
"min": 0.32312501842,
"max": 0.35546185242,
"times": [
0.34696846642,
0.34390457042,
0.35190582942000004,
0.34389031342000004,
0.34970535842,
0.35546185242,
0.33144967742000003,
0.32312501842,
0.34809665942,
0.34562704142
]
},
{
"command": "pnpr@main",
"mean": 0.36606077672000004,
"stddev": 0.04410913540374565,
"median": 0.34805351392,
"user": 0.24827726,
"system": 0.6332335,
"min": 0.34003830242,
"max": 0.47654113542000004,
"times": [
0.34775027842,
0.35048757942000003,
0.34674925542,
0.34835674942,
0.34018983842,
0.34092244642,
0.35870179042,
0.34003830242,
0.41087039142000004,
0.47654113542000004
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.24325687656000003,
"stddev": 0.01371495573368855,
"median": 0.24418289956000003,
"user": 0.22169466666666662,
"system": 0.07104431000000001,
"min": 0.22562867656000002,
"max": 0.26799730256000004,
"times": [
0.24191856856000002,
0.22810892456000004,
0.22759784356000004,
0.26430814856,
0.22562867656000002,
0.23233873656000004,
0.24479799756000004,
0.26799730256000004,
0.25330770456,
0.24450720056000003,
0.24385859856000003,
0.24471281656000002
]
},
{
"command": "pacquet@main",
"mean": 0.26813008456,
"stddev": 0.026310832248971912,
"median": 0.26314099206,
"user": 0.21071459999999997,
"system": 0.08728455999999998,
"min": 0.23896467756000003,
"max": 0.32860403556,
"times": [
0.28286414556000006,
0.25216770856000004,
0.27158455456,
0.32860403556,
0.24267916856000002,
0.27886093056000005,
0.25358631856,
0.27729187656000004,
0.23896467756000003,
0.25469742956
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09053977659333334,
"stddev": 0.0025710049103421836,
"median": 0.09138843756000001,
"user": 0.02275493333333333,
"system": 0.010337522666666665,
"min": 0.08680844256,
"max": 0.09454227956000001,
"times": [
0.09454227956000001,
0.08736375756,
0.08750649656000001,
0.08754955756,
0.09107285956000001,
0.08727588156,
0.09175857956000001,
0.09079823156000001,
0.08715176856000001,
0.09151495056,
0.08684309856000001,
0.09380359856,
0.08919360156,
0.09208863156000001,
0.09199331056,
0.09126192456,
0.09238681156,
0.09266614756000001,
0.09380987056000001,
0.09243907156,
0.09322238456000001,
0.08983024056000001,
0.09368198956000001,
0.09301057556,
0.09215799156,
0.08836570356000001,
0.08729434756,
0.08680844256,
0.09175132656,
0.08704986656000001
]
},
{
"command": "pnpr@main",
"mean": 0.08750515124750001,
"stddev": 0.0015872229009880534,
"median": 0.08707518006000001,
"user": 0.02047615625,
"system": 0.01061746625,
"min": 0.08568598056,
"max": 0.09301692856,
"times": [
0.08913059256,
0.09079335256000001,
0.09123634656,
0.08609442856,
0.08663438456,
0.08770947856000001,
0.08770768556000001,
0.08615399056,
0.08701787656,
0.08817523556000001,
0.08598440156,
0.08841659956,
0.08568598056,
0.08668697356,
0.08710935956,
0.08704100056000001,
0.08749617756,
0.08746579056,
0.08761790656,
0.08722518756,
0.08617401856000001,
0.08662442556000001,
0.09301692856,
0.08638799156,
0.08801419256000001,
0.08672479556000001,
0.08751845856000001,
0.08674862056,
0.08747068956000001,
0.08630999456,
0.08685411856,
0.08693785656
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.9382036119755556,
"stddev": 0.16804294534532072,
"median": 0.89354091142,
"user": 0.8954741666666668,
"system": 0.16644072222222223,
"min": 0.75442629242,
"max": 1.2982216144199998,
"times": [
0.96001095142,
1.10853050142,
0.75442629242,
0.8960923744200001,
0.88366809942,
0.8086711914200001,
0.84067057142,
1.2982216144199998,
0.89354091142
]
},
{
"command": "pacquet@main",
"mean": 0.9426239706422221,
"stddev": 0.15109902187863047,
"median": 0.9043771084200001,
"user": 0.9038899444444445,
"system": 0.16993672222222223,
"min": 0.76038481842,
"max": 1.18940098342,
"times": [
0.76038481842,
0.82239401042,
0.80344488542,
0.9043771084200001,
1.18940098342,
1.0609462084199999,
0.8356913984200001,
1.09368744342,
1.01328887942
]
},
{
"command": "pnpm@HEAD",
"mean": 3.4275513228644443,
"stddev": 0.06324415288169535,
"median": 3.44425350142,
"user": 5.2731065,
"system": 0.30826705555555556,
"min": 3.31855585542,
"max": 3.50927165842,
"times": [
3.40226843842,
3.45857068842,
3.3569050054200003,
3.50466897442,
3.31855585542,
3.40911857142,
3.50927165842,
3.44425350142,
3.44434921242
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.627861273080001,
"stddev": 0.166110188661757,
"median": 4.522816884980001,
"user": 2.0025151599999997,
"system": 1.5204162999999997,
"min": 4.46882168548,
"max": 4.89215864148,
"times": [
4.49323465548,
4.78014205748,
4.503000296480001,
4.733179505480001,
4.8505141194800006,
4.51192799948,
4.515494121480001,
4.46882168548,
4.89215864148,
4.5301396484800005
]
},
{
"command": "pacquet@main",
"mean": 4.51529682358,
"stddev": 0.07342841346125989,
"median": 4.480013876480001,
"user": 1.86421886,
"system": 1.4878067,
"min": 4.44844855048,
"max": 4.64679351148,
"times": [
4.47403600048,
4.46349859648,
4.63225219148,
4.4816060784800005,
4.64679351148,
4.51890066348,
4.44844855048,
4.55909811248,
4.44991285648,
4.478421674480001
]
},
{
"command": "pnpr@HEAD",
"mean": 3.53425329418,
"stddev": 0.06161986416259646,
"median": 3.5193424699799998,
"user": 1.3170470599999997,
"system": 1.3322827,
"min": 3.4817546084799997,
"max": 3.6730388594799996,
"times": [
3.6730388594799996,
3.48337815448,
3.4817546084799997,
3.55348610948,
3.4970138284799996,
3.57316129148,
3.48601409548,
3.48294890648,
3.57006597648,
3.54167111148
]
},
{
"command": "pnpr@main",
"mean": 3.5158107047800002,
"stddev": 0.06382755558881448,
"median": 3.47950278448,
"user": 1.2274140599999999,
"system": 1.2668011,
"min": 3.47313922248,
"max": 3.64202373348,
"times": [
3.47912349548,
3.47313922248,
3.49013883848,
3.64202373348,
3.4748407054799997,
3.61302894948,
3.47661719848,
3.47624781348,
3.55306501748,
3.47988207348
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13700 |
| 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,437.48 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 323.13 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 312.24 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 86.81 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,343.70 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,481.75 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 261.80 ms |
A filtered install computes its hoist map from the filtered lockfile, so replacing the recorded map there would forget the unselected importers entries; the recomputed map now only replaces it when the graph covers every importer, with a workspace regression test that fails without the guard. Reconcile pendingBuilds in every mode rather than only under ignore-scripts: a normal headless install that removes a package now drops the entry a previous ignore-scripts install recorded. The test runs its final install with scripts enabled and asserts every surviving entry is something the lockfile still records. Trim the test narration to the one non-obvious why. No pacquet changes: removing_a_package_shrinks_the_list already pins the removal reconciliation there, which an earlier probe of mine missed. Reported by CodeRabbit and Greptile on #13700.
The headless installer derives its work from the incremental graph -- the packages the wanted lockfile records that are not materialized yet. An install whose lockfile only removes packages has an empty graph, so every graph-driven stage silently did nothing: the hoist layer was never recomputed (a package that became hoistable when a direct dependency was removed stayed unhoisted), and `pendingBuilds` only ever appended, so entries for removed packages stayed pending forever. Reachable with no unusual flags: pull a lockfile in which a dependency was removed and run `pnpm install` -- `allProjectsAreUpToDate` sends it down the headless path. Include the unchanged packages in the graph whenever the transition from the installed state removes a package, the same mechanism a hoist-pattern change already uses. Unfetched nodes are marked built so the build step does not re-run their scripts or re-apply their patches, and with the graph complete the recomputed hoist map replaces the recorded one instead of merging over it. `pendingBuilds` is reconciled against the wanted lockfile rather than appended. pacquet already behaves this way -- its hoist pass reads the lockfile and its pending-builds merge retains only entries the current lockfile still records -- so the Rust side only gains a pinning test. Fixes #13699.
A filtered install computes its hoist map from the filtered lockfile, so replacing the recorded map there would forget the unselected importers entries; the recomputed map now only replaces it when the graph covers every importer, with a workspace regression test that fails without the guard. Reconcile pendingBuilds in every mode rather than only under ignore-scripts: a normal headless install that removes a package now drops the entry a previous ignore-scripts install recorded. The test runs its final install with scripts enabled and asserts every surviving entry is something the lockfile still records. Trim the test narration to the one non-obvious why. No pacquet changes: removing_a_package_shrinks_the_list already pins the removal reconciliation there, which an earlier probe of mine missed. Reported by CodeRabbit and Greptile on #13700.
f6f3ad2 to
53c66cf
Compare
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Code review by qodo was updated up to the latest commit 53c66cf |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
… v10 (#16862) * test(core): reproduce public hoist handover after lockfile removal Amp-Thread-ID: https://ampcode.com/threads/T-01a12dba-9c30-727a-a3bf-e62366285e11 Co-authored-by: Amp <[email protected]> * fix(headless): backport hoist reconciliation after package removal to v10 Backport the hoisting portion of #13700 from main (commit 2d7efe3) to release/10. Include retained packages when the installed lockfile removes packages, skip rebuilding already-materialized nodes, and only replace the hoist map when it covers the full workspace. Keep pendingBuilds reconciliation outside this focused backport. Cover public hoist handover between two transitive runtime versions after a frozen/offline install, plus the main fix filtered-importer regression. Fixes #16861. Amp-Thread-ID: https://ampcode.com/threads/T-01a12dba-9c30-727a-a3bf-e62366285e11 Co-authored-by: Amp <[email protected]> * docs(headless): use spellcheck-compatible wording Amp-Thread-ID: https://ampcode.com/threads/T-01a12dba-9c30-727a-a3bf-e62366285e11 Co-authored-by: Amp <[email protected]> --------- Co-authored-by: Amp <[email protected]>
Summary
Fixes #13699.
The headless installer derives its work from the incremental dependency graph — the packages the wanted lockfile records that are not materialized yet. An install whose lockfile only removes packages has an empty graph, so every graph-driven stage silently did nothing:
pendingBuildsonly ever appended, so entries for removed packages stayed pending forever.Reachable with no unusual flags: pull a lockfile in which a teammate removed a dependency and run
pnpm install—allProjectsAreUpToDatesends it down the headless path. Both symptoms reproduce onmain; the regression tests in this PR fail without the fix.The fix
Desired state is computed from the wanted lockfile; incrementality stays at the I/O layer.
includeUnchangedDepsmechanism a hoist-pattern change already uses. Unchanged nodes carry no fetch, so they are not re-imported (linkAllPkgsskips them) and are markedisBuiltso the build step does not re-run their scripts or re-apply their patches..modules.yaml.pendingBuildsis reconciled against the wanted lockfile rather than appended: entries whose package the lockfile no longer records are dropped.The removal check compares the current lockfile against the full wanted lockfile, not the importer-filtered one, so a
--filterinstall is not mistaken for a removal.pacquet
pacquet already behaves this way —
real_hoist::hoistreads the lockfile, andmerge_pending_buildsretains only entries the current lockfile still records (covered by existing unit tests). The Rust side gains a pinning test for the rehoist scenario, which passes unchanged.pacquet's own
pending_buildstest module already pins the removal scenario (removing_a_package_shrinks_the_list), so no Rust test was added either. An earlier revision of this description claimed a pendingBuilds population divergence; that was my misreading of a probe (#13701, closed as incorrect).Why this PR exists
Surfaced by #13698, whose removal fast path routed three existing tests into the headless path and made them fail. Those failures were symptoms of this pre-existing bug — any fast lockfile update that removes packages (the merged
ignoredOptionalDependencieshandler included) inherits it. Fixing headless fixes them all at once; 13698 will be rebased on top of this.Squash Commit Body
Checklist
already linked to it solves it.
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.
Written by an agent (Claude Code, claude-opus-5).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.Summary by CodeRabbit
Bug Fixes
Tests