Repository navigation
perf(lockfile): apply patchedDependencies changes without resolving - #13680
Conversation
…lving A patch that matches a locked package contributes a `(patch_hash=...)` segment to that package's key, so adding, removing, or editing it rekeys the graph. A patch key that matches nothing contributes nothing, which leaves the recorded map as the only thing the change touches. Detect that case and record the new `patchedDependencies` on the loaded lockfile instead of resolving. Keys that match a locked package, and patch files that cannot be read, stay on the full-resolution path. Fall back whenever the new configuration would leave a patch unused and `allowUnusedPatches` is off, so the resolver still raises ERR_PNPM_UNUSED_PATCH. Removing a key that matched nothing leaves no unused patch behind, so it takes the fast path either way. Implemented in both the TypeScript CLI and pacquet. Matching against the lockfile reuses the same key handling the frozen-install path uses to apply patches, so the two agree on which patches are in play. Related to #13474.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds TypeScript and Rust fast-update paths for ChangesPatched dependency updates
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related 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 |
Confidence Score: 5/5The PR appears safe to merge. Both previously reported failures are fixed at current HEAD, and no blocking failure remains. Reviews (5): Last reviewed commit: "fix(lockfile): leave non-semver package ..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 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 @.changeset/inert-patched-dependencies-updates.md:
- Around line 2-5: Update the changeset bump declarations so
`@pnpm/installing.deps-installer` and pnpm use patch rather than minor, while
preserving `@pnpm/patching.config` at minor because it exports allPatchKeys; leave
pacquet unchanged.
In `@pnpm/crates/cli/tests/lockfile_resolution_reuse.rs`:
- Around line 897-902: Update the fallback install assertion in the test around
pacquet_at to require a successful exit status by chaining success() before
inspecting stdout. Preserve the existing check that patching a locked package
must not emit the lockfile skip message, ensuring resolver or patch-application
failures cannot pass the regression test.
In `@pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs`:
- Around line 36-38: Update the fast-path logic around
patched_dependency_hashes() and resolved_patched_dependencies() so each
configured patch file is read only once. Reuse the metadata produced by
patched_dependency_hashes(), or derive the matching patch groups from that
metadata, before deciding whether to fall back; preserve the existing
drift-detection behavior while eliminating the second filesystem read.
In
`@pnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.ts`:
- Around line 35-37: Ensure tryFastUpdatePatchedDependencies.ts matches affected
patch keys against both recorded and current patch configurations before
accepting the fast path, falling back when a removed patch was previously
applied. Apply the same rule in
pnpm/crates/package-manager/src/fast_update_patched_dependencies.rs:38-46. Add
regression coverage for removing a previously applied patch and expecting
fallback in
pnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.ts:64-73
and
pnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rs:121-131,
preserving TypeScript/pacquet parity.
🪄 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: 8d98941a-8202-4358-af14-f24ec437558b
📒 Files selected for processing (10)
.changeset/inert-patched-dependencies-updates.mdpnpm/crates/cli/tests/lockfile_resolution_reuse.rspnpm/crates/package-manager/src/fast_update_patched_dependencies.rspnpm/crates/package-manager/src/fast_update_patched_dependencies/tests.rspnpm/crates/package-manager/src/install/lockfile_freshness.rspnpm/crates/package-manager/src/lib.rspnpm11/installing/deps-installer/src/install/index.tspnpm11/installing/deps-installer/src/install/tryFastUpdatePatchedDependencies.tspnpm11/installing/deps-installer/test/install/patchedDependenciesFastUpdate.tspnpm11/patching/config/src/index.ts
Micro-Benchmark ResultsLinux |
PR Summary by Qodoperf(lockfile): fast-path patchedDependencies changes that touch no locked package
AI Description
Diagram
High-Level Assessment
Files changed (10)
|
Code Review by Qodo
1.
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #13680 +/- ##
==========================================
- Coverage 88.16% 88.16% -0.01%
==========================================
Files 612 613 +1
Lines 99579 99728 +149
==========================================
+ Hits 87791 87921 +130
- Misses 11788 11807 +19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.98655473914,
"stddev": 0.19689262273970085,
"median": 2.97490988994,
"user": 2.78986716,
"system": 2.1213043999999996,
"min": 2.71371167844,
"max": 3.23834964844,
"times": [
3.22803736944,
2.80906720644,
2.71371167844,
2.89380408844,
2.78848146144,
2.84950750744,
3.1487382244399997,
3.23834964844,
3.13983451544,
3.05601569144
]
},
{
"command": "pacquet@main",
"mean": 2.9594388256400004,
"stddev": 0.11332373373721624,
"median": 2.97573183744,
"user": 2.82785296,
"system": 2.1305707000000003,
"min": 2.7892830694399997,
"max": 3.1220550124399997,
"times": [
3.04369269444,
3.05340012444,
2.85478474944,
2.86907811944,
2.98294967144,
2.7892830694399997,
2.84470501944,
3.1220550124399997,
3.06592579244,
2.96851400344
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6729514143400004,
"stddev": 0.141409320098122,
"median": 1.6430119629400002,
"user": 1.79148496,
"system": 1.9851126999999997,
"min": 1.55796731244,
"max": 2.03828006644,
"times": [
1.7057966244400002,
1.68543398244,
1.5896137594400002,
1.55796731244,
1.61123894544,
1.7169988734400001,
1.5794156454400001,
2.03828006644,
1.6747849804400001,
1.5699839534400002
]
},
{
"command": "pnpr@main",
"mean": 1.72472466394,
"stddev": 0.22261365034165684,
"median": 1.63700275044,
"user": 1.7093665599999999,
"system": 1.8041220999999996,
"min": 1.4793826434400001,
"max": 2.0521790964399997,
"times": [
1.9350811814400002,
2.00180161744,
1.57229066044,
2.0521790964399997,
1.56298258244,
1.70171484044,
1.8904454964400002,
1.5474475754400001,
1.5039209454400002,
1.4793826434400001
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32243324398,
"stddev": 0.019536920730483562,
"median": 0.31892041568,
"user": 0.27133869999999993,
"system": 0.60992252,
"min": 0.29916227918,
"max": 0.35415194318000004,
"times": [
0.35415194318000004,
0.32537424918,
0.34548633118,
0.33597912718,
0.33524884418,
0.30446324518,
0.30167445218,
0.31246658218,
0.29916227918,
0.31032538618
]
},
{
"command": "pacquet@main",
"mean": 0.31774295098,
"stddev": 0.01647502117885753,
"median": 0.32155523918,
"user": 0.27896319999999997,
"system": 0.59765622,
"min": 0.29504299418,
"max": 0.34364324618000003,
"times": [
0.33256228318000003,
0.32753989118000004,
0.32510195718,
0.32847253418,
0.31800852118,
0.29630198118,
0.30715072818,
0.30360537318,
0.29504299418,
0.34364324618000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.32661121888,
"stddev": 0.0113815610859151,
"median": 0.33097018968,
"user": 0.2765383,
"system": 0.5895803199999999,
"min": 0.30139744118,
"max": 0.33705302718,
"times": [
0.33064437718,
0.33705302718,
0.30139744118,
0.33132964518,
0.31921433818,
0.33027020418,
0.33692474518000004,
0.33129600218,
0.33327604518000004,
0.31470636318
]
},
{
"command": "pnpr@main",
"mean": 0.32905240178,
"stddev": 0.010467955090177424,
"median": 0.32805221868,
"user": 0.28887029999999997,
"system": 0.60817162,
"min": 0.31100643718000004,
"max": 0.34487096518000004,
"times": [
0.33731105218,
0.33838423018,
0.32366509518000003,
0.33243934218000004,
0.32197290418,
0.33696698418000004,
0.31100643718000004,
0.32265621018,
0.32125079718,
0.34487096518000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.62547049438,
"stddev": 0.03341081313528463,
"median": 2.6163272073800004,
"user": 1.55875896,
"system": 1.3368941199999995,
"min": 2.57620020988,
"max": 2.67606171688,
"times": [
2.65919372288,
2.67606171688,
2.60448956488,
2.67209201388,
2.59833553588,
2.6137752738800004,
2.6188791408800003,
2.60610273188,
2.62957503288,
2.57620020988
]
},
{
"command": "pacquet@main",
"mean": 2.61131910398,
"stddev": 0.06653287744473943,
"median": 2.58565638488,
"user": 1.5369955599999998,
"system": 1.3229833199999996,
"min": 2.5698363148800003,
"max": 2.78876128588,
"times": [
2.5698363148800003,
2.58171459888,
2.56990270088,
2.78876128588,
2.64226735588,
2.61752345388,
2.5802547828800004,
2.58959817088,
2.57265356188,
2.60067881388
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5517221248800002,
"stddev": 0.08112354205581428,
"median": 1.52559178088,
"user": 1.0197216599999999,
"system": 1.1549502200000001,
"min": 1.45839538188,
"max": 1.66731232688,
"times": [
1.66731232688,
1.5233712558799999,
1.5305828558799999,
1.66467470788,
1.52781230588,
1.51006406588,
1.6578933328799998,
1.51675700288,
1.46035801288,
1.45839538188
]
},
{
"command": "pnpr@main",
"mean": 1.6097731664800001,
"stddev": 0.15195422051086385,
"median": 1.59654539538,
"user": 0.9920238600000001,
"system": 1.2022848199999998,
"min": 1.42111637388,
"max": 1.82511328788,
"times": [
1.81542271788,
1.57492275688,
1.42111637388,
1.7709039928799999,
1.54254180888,
1.4521176568799998,
1.82511328788,
1.63045552888,
1.61816803388,
1.44696950688
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.44228022092,
"stddev": 0.054034396612353625,
"median": 0.41985324972000004,
"user": 0.58428028,
"system": 0.72665288,
"min": 0.39395641872000003,
"max": 0.56443850872,
"times": [
0.41728722972000004,
0.56443850872,
0.5054472737200001,
0.46452400272000005,
0.42241926972000005,
0.40391528572,
0.42575255772000004,
0.39395641872000003,
0.41200482772,
0.41305683472000004
]
},
{
"command": "pacquet@main",
"mean": 0.39821466322,
"stddev": 0.008449578412591313,
"median": 0.39761125172,
"user": 0.5262163799999999,
"system": 0.6703492799999999,
"min": 0.38606201372000004,
"max": 0.41323239572000003,
"times": [
0.38606201372000004,
0.39366658472000005,
0.41323239572000003,
0.39619805472,
0.40532132872000004,
0.40490772172000006,
0.40112386672000006,
0.39824174772000004,
0.38641216272000006,
0.39698075572
]
},
{
"command": "pnpr@HEAD",
"mean": 0.32107623782000005,
"stddev": 0.014242170708658308,
"median": 0.32199038572000005,
"user": 0.21953358,
"system": 0.5336686799999999,
"min": 0.29757932472000004,
"max": 0.34448480372,
"times": [
0.31909163572000004,
0.32182120772000006,
0.32215956372000004,
0.30570933172000003,
0.34448480372,
0.33196190672000003,
0.32841137872000004,
0.33218075772000005,
0.29757932472000004,
0.30736246772000003
]
},
{
"command": "pnpr@main",
"mean": 0.3193141655200001,
"stddev": 0.026238446315244822,
"median": 0.30963091022,
"user": 0.20592908,
"system": 0.5480708799999999,
"min": 0.29374370972,
"max": 0.36498122972,
"times": [
0.30958325572,
0.32477753972,
0.36498122972,
0.36456840272,
0.30671388772,
0.32514001072000004,
0.30967856472000005,
0.29631138972000004,
0.29764366472000003,
0.29374370972
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.7506052355600001,
"stddev": 0.03684619860647993,
"median": 1.73733047756,
"user": 0.7368338999999999,
"system": 0.77909064,
"min": 1.7231678595600002,
"max": 1.84633918656,
"times": [
1.73744359556,
1.7372173595600002,
1.74933894256,
1.7758689305600002,
1.73515309656,
1.7250053165600001,
1.7231678595600002,
1.84633918656,
1.73085367856,
1.7456643895600001
]
},
{
"command": "pacquet@main",
"mean": 1.72390987106,
"stddev": 0.01477589018385558,
"median": 1.72176447506,
"user": 0.7155805999999999,
"system": 0.7238598399999999,
"min": 1.70571434756,
"max": 1.74695680156,
"times": [
1.74675836756,
1.7289375045600002,
1.72388845556,
1.7083968935600002,
1.7196404945600001,
1.71325455056,
1.7322725975600002,
1.70571434756,
1.71327869756,
1.74695680156
]
},
{
"command": "pnpr@HEAD",
"mean": 0.31659637446000005,
"stddev": 0.01811515992059268,
"median": 0.31503839506000003,
"user": 0.21705959999999996,
"system": 0.53446904,
"min": 0.29129653856000004,
"max": 0.34744832756,
"times": [
0.32909004156000005,
0.31623270356,
0.30618306856,
0.31527361856,
0.30373282456,
0.34744832756,
0.34202862256,
0.31480317156000004,
0.29987482756,
0.29129653856000004
]
},
{
"command": "pnpr@main",
"mean": 0.29782897676,
"stddev": 0.009766531726856993,
"median": 0.29396826556,
"user": 0.19865019999999997,
"system": 0.50107814,
"min": 0.28731320556,
"max": 0.31346343156,
"times": [
0.29200338956,
0.29132312856000003,
0.28731320556,
0.29335812756,
0.29499750256,
0.31215266556000004,
0.30897125056,
0.29012866256000003,
0.29457840356000004,
0.31346343156
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.18174033030923076,
"stddev": 0.01039676586042233,
"median": 0.17953966554,
"user": 0.16466606307692308,
"system": 0.07121639692307691,
"min": 0.17450430354000002,
"max": 0.21543377354,
"times": [
0.21543377354,
0.18068944854,
0.17529526054,
0.17450430354000002,
0.17614722354,
0.18045953554,
0.18150614454,
0.18245514954,
0.17953966554,
0.18005207954,
0.17928685054000001,
0.17825370654,
0.17900115254
]
},
{
"command": "pacquet@main",
"mean": 0.18123667197749999,
"stddev": 0.003853363726148486,
"median": 0.18108186704,
"user": 0.1660418275,
"system": 0.070510195,
"min": 0.17613081354000001,
"max": 0.18860502054,
"times": [
0.17835483654,
0.17613081354000001,
0.17634873254,
0.18379420954,
0.18346048254,
0.18171411654,
0.17760480554,
0.18373341454,
0.18699864754,
0.17804569454,
0.18860502054,
0.18044961754,
0.18522511154000001,
0.18214447654000002,
0.18004915454,
0.17712761754
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09065137254,
"stddev": 0.007185842313509198,
"median": 0.08759453954000002,
"user": 0.02272435875,
"system": 0.010595528750000003,
"min": 0.08520510354000001,
"max": 0.10845466354000001,
"times": [
0.08892529354,
0.08893761654000001,
0.08646901254000001,
0.08749141654,
0.08789280954,
0.08520510354000001,
0.08741944054000002,
0.08820903554000001,
0.08665721554000001,
0.08915865254000001,
0.08676791354,
0.08659553054,
0.08768025054,
0.08795385554000001,
0.08538830854000001,
0.08672040454000002,
0.09396614654000002,
0.10799779354000001,
0.10375555254000002,
0.10801892354,
0.10451715654000002,
0.10845466354000001,
0.09089963854000001,
0.08628062754000002,
0.08929502854000002,
0.08651063054000001,
0.08626550854000001,
0.08702877554,
0.08682823854,
0.08750882854000001,
0.08718527054000001,
0.08885927854000002
]
},
{
"command": "pnpr@main",
"mean": 0.08636130542235297,
"stddev": 0.0020775832727040096,
"median": 0.08684656654000002,
"user": 0.02043743411764706,
"system": 0.008430722352941174,
"min": 0.08237061154000001,
"max": 0.08985540254000002,
"times": [
0.08341116954000001,
0.08781308054,
0.08776273654000001,
0.08635713154,
0.08985540254000002,
0.08644648954,
0.08492064854,
0.08684604054000002,
0.08814747954000002,
0.08659988754000002,
0.08290809254,
0.08763735954000001,
0.08834458054000001,
0.08565611354000001,
0.08721117754000002,
0.08791853954,
0.08704745954000001,
0.08789710854,
0.08684938854000002,
0.08887788354000001,
0.08605639554000001,
0.08777479854000002,
0.08671225954000002,
0.08237061154000001,
0.08253377854,
0.08263355554000001,
0.08756648654000002,
0.08766403954000002,
0.08678252254000002,
0.08254655254000001,
0.08858537354000001,
0.08672945154000002,
0.08684709254000002,
0.08297369654000002
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.8643754634266667,
"stddev": 0.21725496526603966,
"median": 0.7899146707600001,
"user": 0.8159385688888887,
"system": 0.16616445555555556,
"min": 0.59861785576,
"max": 1.2683412137599999,
"times": [
0.7078670957600001,
0.8847484627600001,
0.6790406347600001,
0.59861785576,
1.06013648876,
1.03452709076,
0.75618565776,
0.7899146707600001,
1.2683412137599999
]
},
{
"command": "pacquet@main",
"mean": 0.8080175896488889,
"stddev": 0.25197947989142055,
"median": 0.7173593127600001,
"user": 0.74224468,
"system": 0.17792245555555553,
"min": 0.51085656976,
"max": 1.30198311476,
"times": [
0.70874068976,
0.92821992476,
1.30198311476,
0.51085656976,
1.08634879276,
0.6547199407600001,
0.75397983676,
0.6099501247600001,
0.7173593127600001
]
},
{
"command": "pnpm@HEAD",
"mean": 2.9884445406488886,
"stddev": 0.12322563462489618,
"median": 2.96584520476,
"user": 4.609799124444444,
"system": 0.2531579,
"min": 2.84535024776,
"max": 3.27399349276,
"times": [
3.05420230076,
3.27399349276,
2.9589941457599997,
2.98666307876,
2.96584520476,
2.84535024776,
2.8967016547599997,
2.99822540176,
2.91602533876
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.542137179519999,
"stddev": 0.10927244877499483,
"median": 4.5062066208200005,
"user": 1.6346000799999998,
"system": 1.36913126,
"min": 4.40334034182,
"max": 4.73095544382,
"times": [
4.4857249688200005,
4.46106688082,
4.5776840858200005,
4.73095544382,
4.54268931382,
4.50773483882,
4.40334034182,
4.72894868082,
4.50467840282,
4.47854883782
]
},
{
"command": "pacquet@main",
"mean": 4.6012791140200004,
"stddev": 0.14490919861183774,
"median": 4.60141030782,
"user": 1.6572648800000003,
"system": 1.39017906,
"min": 4.44316308082,
"max": 4.87132605582,
"times": [
4.64735297682,
4.45004357682,
4.69072168182,
4.46357082882,
4.87132605582,
4.44316308082,
4.48061591382,
4.725503492820001,
4.68502589382,
4.55546763882
]
},
{
"command": "pnpr@HEAD",
"mean": 3.52387779612,
"stddev": 0.12900626999576142,
"median": 3.48240830732,
"user": 1.17202428,
"system": 1.2547211600000001,
"min": 3.44181455082,
"max": 3.8721232798200003,
"times": [
3.52109995282,
3.44181455082,
3.45452704082,
3.44824453782,
3.44396953082,
3.47681002282,
3.55955061482,
3.53263183882,
3.8721232798200003,
3.48800659182
]
},
{
"command": "pnpr@main",
"mean": 3.558218664020001,
"stddev": 0.07735982026538342,
"median": 3.53098385532,
"user": 1.2962533799999998,
"system": 1.31434426,
"min": 3.4587188808200002,
"max": 3.64951726382,
"times": [
3.4587188808200002,
3.54970009682,
3.51226761382,
3.50927757182,
3.6490153218200003,
3.63410848582,
3.50134357582,
3.47603388382,
3.64951726382,
3.64220394582
]
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13680 |
| 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,458.40 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 291.30 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 297.58 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 85.21 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,557.97 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,441.81 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 301.40 ms |
Applicability was decided from the current configuration alone, so removing a patch key looked inert: the key is gone from the new groups, nothing matches it, and the fast path dropped `patchedDependencies` while the recorded graph kept its `(patch_hash=...)` keys. Decide it from the recorded map as well. Both directions of a change now run through the same matching, since a key the previous install applied owns a patch-hash segment just as a newly added one would. Group the affected keys directly instead of asking the config to resolve and hash the patch files a second time. Only the key decides what a patch matches, so the grouping needs no payload and no filesystem read; `patched_dependency_hashes` had already read every file. Give the fallback install in the integration test a real patch fixture and assert it succeeds. The placeholder diff made it fail with ERR_PNPM_INVALID_PATCH, which an unchecked exit status hid. Reported by CodeRabbit, Greptile, and Qodo on #13680.
|
Code review by qodo was updated up to the latest commit 7a0d8ef |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Resolution never reads a patch. It appends the patch file's hash to an already-resolved package id, so a `patchedDependencies` change leaves the set of packages and versions untouched and moves only the affected keys. Rewrite those keys and the references pointing at them, rather than falling back to the resolver whenever a patch matches a locked package. `packages:` is keyed without the patch hash, so only `snapshots:`, the importers' resolved versions, and dependents' dependency references move. The patched tarball is already in the store, so materialization applies the patch with no network access at all. Two cases still need the resolver. A patched package that some snapshot reaches as a peer is embedded in that dependent's peer suffix, so it would rekey the dependent too; and a peer suffix that pnpm shortened into a hash cannot be inspected to rule that out.
The rekey gives the package a new depPath, so it lands in a fresh virtual-store slot and its install script runs against the patched sources rather than reusing the previous build.
|
Code review by qodo was updated up to the latest commit 8f983b7 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The resolver matches a patch against a package's plain semver version, while this path reads the version out of the lockfile key, where a named registry (`name@registry:version`) or a git / tarball reference occupies the same slot. The two only agree on plain semver, so an exact-version patch key for a named-registry package matched during a resolve but not here, and the rewrite recorded the new configuration while dropping the patch hash from the key. Reproducing the resolver's matching from the key is not possible, so the question is only whether it could matter: any configured patch naming the package, or a patch hash already on its key, now hands the decision back to the resolver. A key nothing could reach is left alone, so one git or tarball dependency does not disable the rewrite for the whole lockfile. Reported by Greptile on #13680.
|
Code review by qodo was updated up to the latest commit 09ed5fc |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
Summary
Related to #13474 — the patched-dependencies stage of the lockfile fast-path roadmap, following #13477 (catalogs), #13482 (ignored optional dependencies), and #13600 (setting-only updates).
Resolution never reads a patch. It appends the patch file's hash to an already-resolved package id, so a
patchedDependencieschange leaves the set of packages and versions untouched and moves only the affected keys. Adding, editing, or removing an entry is therefore a rewrite of the loaded lockfile, not a re-resolve.snapshots:keys and every reference pointing at them — the importers' resolved versions and dependents' dependency references.packages:is keyed without the patch hash, so it does not move.tryFastUpdatePatchedDependencies) and pacquet (fast_update_patched_dependencies).allPatchKeysfrom@pnpm/patching.config, which the unused-patch predicate needs andverifyPatchesalready used internally.The patched tarball is already in the store, so materialization applies the patch with no network access. Because the rekey gives the package a new depPath, it lands in a fresh virtual-store slot — a patched package with an install script is rebuilt against the patched sources rather than reusing the previous build. There is an integration test for exactly that.
When it still resolves
resolve_peerscan emit a peer provider as its full depPath, so a patched provider is embedded in its dependents' peer suffixes and rekeying it would rekey them too.peersSuffixMaxLengthpnpm replaces them with a short hash, which cannot be inspected to rule the above out.allowUnusedPatchesis off, soERR_PNPM_UNUSED_PATCHis still raised. The two stacks disagree today about when they run that check — the TypeScript CLI only verifies on a forced or from-empty resolution, pacquet on every non-filtered fresh resolution — so rather than encode that divergence, both fall back under the same condition.ERR_PNPM_PATCH_KEY_CONFLICTto the resolver, and a patch file that cannot be read or hashed.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).
Summary by CodeRabbit
Performance
Bug Fixes
Tests