Repository navigation
fix: ignore unobservable file modes in the Windows side-effects diff - #15859
Conversation
On Windows the post-build rehash cannot see the mode stored from the tarball. pnpm 12 reports a fixed 0o644 and pnpm 11 reports the mode from fs.stat (0o666, or 0o444 for a read-only file). The side-effects diff treated that difference as an added file, so the row was never empty. Both stacks rebuild only when the row has nothing to restore. A build whose whole effect lies outside the package directory, such as a git hook installer, was treated as a cache hit and skipped. Compare modes only where the rehash can observe them. Closes pnpm#15667 Co-authored-by: Gabriel Mari S. Flores <[email protected]>
The fixed mode reported off Unix is not a reading of the tarball entry, so a mode-only difference is not build output. Closes pnpm#15667 Co-authored-by: Gabriel Mari S. Flores <[email protected]>
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pnpm/pnpm/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe changes ignore file-mode differences when calculating side-effects cache diffs on non-Unix hosts. Regression tests cover repeated package builds and confirm that digest changes still appear in the diff. ChangesWindows side-effects cache
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix · Severity of issue fixed: Medium Assessment against linked issues
Suggested labels: Merge Risk: ⚪ Minimal · up to The change addresses the Windows cache-hit case without an identified regression. It is ready to merge after normal checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The change can cause already-permitted install scripts to run again when a cache entry has nothing to restore. The reviewed paths retain build permission checks and content-change detection; no new permission boundary or confirmed security issue was found. Windows runtime validation remains a limitation. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning Some tools did not complete. Review the errors below. 🔧 ESLint
pnpm11/installing/deps-installer/test/install/sideEffects.tsESLint skipped: missing config or dependency (missing-dependency). The ESLint configuration references a package that is not available in the sandbox. pnpm11/worker/src/start.tsESLint skipped: the matched ESLint configuration already failed (missing-dependency). pnpr/.fixtures/packages/@pnpm.e2e/postinstall-writes-outside-package/1.1.0/bin/tool.jsESLint skipped: the matched ESLint configuration already failed (missing-dependency).
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #15859 +/- ##
==========================================
- Coverage 92.01% 92.01% -0.01%
==========================================
Files 1478 1478
Lines 198923 198925 +2
==========================================
+ Hits 183042 183043 +1
- Misses 15881 15882 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Same-run regression checkHEAD and main are measured on the same runner. The tolerance is 5% of the main median or 2 ms, whichever is larger. A regression requires both the median slowdown and the gap between the fastest retained HEAD sample and slowest retained main sample to exceed this tolerance, after trimming up to 10% from each tail. Suspected regressions are rerun once with target order reversed and only fail if reproduced. This conservative noise guard is not a statistical confidence interval. Inconclusive rows do not fail the check. They remain visible for performance review. Bencher retains absolute minimum timings for historical tracking; historical alerts do not gate this PR. Sequential measurements can still be affected by runner drift.
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; the linked-workspace scenario compares current Rust against main Rust. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ. Bencher tracks absolute minimum latency; PR regression checks compare HEAD and main samples from the same runner. Historical timing alerts do not gate PRs. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.51527020426,
"stddev": 0.1387449116632748,
"median": 2.4802734919600002,
"user": 1.6924363399999998,
"system": 1.9491505999999998,
"min": 2.37325424846,
"max": 2.79590365746
},
{
"command": "pacquet@main",
"mean": 2.37027740346,
"stddev": 0.044739547820478974,
"median": 2.3640343384599998,
"user": 1.58966094,
"system": 1.9099416999999999,
"min": 2.33319084046,
"max": 2.4859130664599998
},
{
"command": "pnpr@HEAD",
"mean": 1.54143615256,
"stddev": 0.13968579960021815,
"median": 1.5305640439600001,
"user": 1.51054314,
"system": 1.6522588999999996,
"min": 1.34951476946,
"max": 1.7451071444600001
},
{
"command": "pnpr@main",
"mean": 1.58858986446,
"stddev": 0.13266927788634308,
"median": 1.62231220296,
"user": 1.49115684,
"system": 1.7457620999999999,
"min": 1.35594383946,
"max": 1.72473703646
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.23621833946,
"stddev": 0.010690605435046715,
"median": 0.23519173716000003,
"user": 0.26283612,
"system": 0.5748625199999999,
"min": 0.21941417166000002,
"max": 0.26005141566
},
{
"command": "pacquet@main",
"mean": 0.25128355716,
"stddev": 0.05598341037558184,
"median": 0.22872013516000003,
"user": 0.29014612,
"system": 0.59412382,
"min": 0.21497212066000002,
"max": 0.37572537966
},
{
"command": "pnpr@HEAD",
"mean": 0.29925098396,
"stddev": 0.07961780754583488,
"median": 0.25457784266,
"user": 0.31694062,
"system": 0.6876623199999999,
"min": 0.24331611866000002,
"max": 0.43339192166
},
{
"command": "pnpr@main",
"mean": 0.25130639775999997,
"stddev": 0.006274086460831898,
"median": 0.24938731516,
"user": 0.2724720199999999,
"system": 0.5828939200000001,
"min": 0.24304232766000003,
"max": 0.26431533766
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.008167364932558142,
"stddev": 0.0009887612445313324,
"median": 0.0078423431,
"user": 0.004652996465116279,
"system": 0.00396284558139535,
"min": 0.006891834100000001,
"max": 0.0128437641
},
{
"command": "pacquet@main",
"mean": 0.007936305482636657,
"stddev": 0.000671166298587768,
"median": 0.007787661099999999,
"user": 0.0047365667524115794,
"system": 0.0036557432797427606,
"min": 0.0068163531,
"max": 0.0111041291
},
{
"command": "pnpr@HEAD",
"mean": 0.008253690010596023,
"stddev": 0.0010895457187221267,
"median": 0.008069913599999999,
"user": 0.004375434834437089,
"system": 0.004346331920529803,
"min": 0.006537721100000001,
"max": 0.014605162100000001
},
{
"command": "pnpr@main",
"mean": 0.01107943831387283,
"stddev": 0.002115909890231435,
"median": 0.0108809606,
"user": 0.006395659999999997,
"system": 0.005277287514450866,
"min": 0.0065898581,
"max": 0.018343760100000002
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.0075357143857761695,
"stddev": 0.000766938792248526,
"median": 0.0073330771800000005,
"user": 0.004224843249097473,
"system": 0.0037097867870036125,
"min": 0.00638376718,
"max": 0.01091339118
},
{
"command": "pacquet@main",
"mean": 0.007125256670740744,
"stddev": 0.0006077580981595785,
"median": 0.007032528180000001,
"user": 0.004081823950617284,
"system": 0.003385157592592591,
"min": 0.0064115681800000004,
"max": 0.01147088718
},
{
"command": "pnpr@HEAD",
"mean": 0.00784101450673267,
"stddev": 0.0007692928235992112,
"median": 0.007796064180000001,
"user": 0.004686394785478549,
"system": 0.003579608580858086,
"min": 0.006542024180000001,
"max": 0.011093109180000001
},
{
"command": "pnpr@main",
"mean": 0.0076280838947239225,
"stddev": 0.0006576993849083856,
"median": 0.00752507218,
"user": 0.004709892760736197,
"system": 0.003310755398773006,
"min": 0.00648660918,
"max": 0.01061317818
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.5798492572000002,
"stddev": 0.10886095249378028,
"median": 2.5248949065,
"user": 2.04733026,
"system": 1.6430480399999996,
"min": 2.4765637445,
"max": 2.7732488325
},
{
"command": "pacquet@main",
"mean": 2.5239059621999997,
"stddev": 0.07002886418584653,
"median": 2.5036192715,
"user": 1.8334035599999996,
"system": 1.5348341399999998,
"min": 2.4635214445,
"max": 2.6954785435
},
{
"command": "pnpr@HEAD",
"mean": 1.5121247395,
"stddev": 0.10949286504065796,
"median": 1.504290165,
"user": 1.1109912599999998,
"system": 1.1620707399999997,
"min": 1.3861814344999999,
"max": 1.6957342675
},
{
"command": "pnpr@main",
"mean": 1.4975696039,
"stddev": 0.08370646052922096,
"median": 1.501498392,
"user": 1.0531168599999998,
"system": 1.2553213399999996,
"min": 1.3805143805,
"max": 1.6456472544999998
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.4346985451800001,
"stddev": 0.011219126511589498,
"median": 0.43697141328,
"user": 0.6233172,
"system": 0.74701798,
"min": 0.41326626028,
"max": 0.45107666128000007
},
{
"command": "pacquet@main",
"mean": 0.43358449288,
"stddev": 0.01576549289790815,
"median": 0.43712311828000006,
"user": 0.6356033999999999,
"system": 0.7291781799999998,
"min": 0.40468349628000005,
"max": 0.45226522228000005
},
{
"command": "pnpr@HEAD",
"mean": 0.27957167948,
"stddev": 0.013223085240464122,
"median": 0.28441303378000005,
"user": 0.2441351,
"system": 0.53596898,
"min": 0.25883824428,
"max": 0.29247736228000004
},
{
"command": "pnpr@main",
"mean": 0.28178821418,
"stddev": 0.009105952385070976,
"median": 0.28253434628000007,
"user": 0.24016659999999995,
"system": 0.5414014799999999,
"min": 0.26775216328,
"max": 0.29306116828000006
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
Confirmation (reversed target order)
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.6537969568400002,
"stddev": 0.020146552733056402,
"median": 1.64534207144,
"user": 0.9806723399999999,
"system": 0.92804182,
"min": 1.6321069379400002,
"max": 1.69477738294
},
{
"command": "pacquet@main",
"mean": 1.64618356634,
"stddev": 0.04040169616600415,
"median": 1.62473619994,
"user": 0.9401064399999999,
"system": 0.90957232,
"min": 1.60564045294,
"max": 1.70778736894
},
{
"command": "pnpr@HEAD",
"mean": 0.40276892174000006,
"stddev": 0.039315844360990886,
"median": 0.39771496044,
"user": 0.37489944,
"system": 0.8447761199999999,
"min": 0.36106750994,
"max": 0.49615127494
},
{
"command": "pnpr@main",
"mean": 0.27119089143999997,
"stddev": 0.007444512367074911,
"median": 0.27070354094000004,
"user": 0.22849234,
"system": 0.48776951999999996,
"min": 0.25921815094,
"max": 0.28541525294
}
],
"confirmation": {
"results": [
{
"command": "pnpr@main",
"mean": 0.2700097463400001,
"stddev": 0.009283425392740989,
"median": 0.2673605305400001,
"user": 0.2021465,
"system": 0.51184414,
"min": 0.25899066054000003,
"max": 0.29156302454000005
},
{
"command": "pnpr@HEAD",
"mean": 0.27000439574000007,
"stddev": 0.00816722766130502,
"median": 0.26848658204000003,
"user": 0.2038954,
"system": 0.5039672399999999,
"min": 0.26050875254000005,
"max": 0.28846680454
},
{
"command": "pacquet@main",
"mean": 1.62860715704,
"stddev": 0.029751403638938644,
"median": 1.6200538725400002,
"user": 0.9118551,
"system": 0.8259236399999998,
"min": 1.59213030154,
"max": 1.68740206154
},
{
"command": "pacquet@HEAD",
"mean": 1.6124281712400002,
"stddev": 0.01736026161101964,
"median": 1.60791875154,
"user": 0.8879778999999999,
"system": 0.81957544,
"min": 1.58471221554,
"max": 1.63595784554
}
]
}
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20488601025333333,
"stddev": 0.00959819084189176,
"median": 0.20270820842,
"user": 0.20487634,
"system": 0.07864292333333334,
"min": 0.19432115042,
"max": 0.22740748642
},
{
"command": "pacquet@main",
"mean": 0.21227868399142855,
"stddev": 0.011418424752995865,
"median": 0.20678838292,
"user": 0.2132427685714286,
"system": 0.07296841142857144,
"min": 0.19919104942000002,
"max": 0.23310114142
},
{
"command": "pnpr@HEAD",
"mean": 0.09179205395333331,
"stddev": 0.0024695825226418847,
"median": 0.09240336392000001,
"user": 0.035488306666666664,
"system": 0.013155739999999999,
"min": 0.08696561942000001,
"max": 0.09516091342
},
{
"command": "pnpr@main",
"mean": 0.08848066780709679,
"stddev": 0.0017061027486193316,
"median": 0.08790813642,
"user": 0.029938888387096775,
"system": 0.012643683870967742,
"min": 0.08554769242000002,
"max": 0.09382122142
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6433571422666667,
"stddev": 0.05790992573114399,
"median": 0.6256228796000001,
"user": 0.6676238866666666,
"system": 0.1472559377777778,
"min": 0.5675283156,
"max": 0.7428450766000001
},
{
"command": "pacquet@main",
"mean": 0.6380886261555556,
"stddev": 0.061817159488535965,
"median": 0.6303510826000001,
"user": 0.6591444422222222,
"system": 0.14448915999999998,
"min": 0.5576143326,
"max": 0.7616980946
},
{
"command": "pnpm@HEAD",
"mean": 3.0616846970444445,
"stddev": 0.1981833565942451,
"median": 2.9729248546,
"user": 4.7132883311111105,
"system": 0.22653671555555555,
"min": 2.8787566545999996,
"max": 3.4997848416
}
]
}Scenario: Isolated linker: linked-workspace resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.3035557011,
"stddev": 0.015631139691353765,
"median": 0.3074396359,
"user": 0.24782566,
"system": 0.13983674,
"min": 0.2743049684,
"max": 0.3219407824
},
{
"command": "pacquet@main",
"mean": 0.29529118470000004,
"stddev": 0.03198788846515215,
"median": 0.3014078834,
"user": 0.24726536000000002,
"system": 0.12751524,
"min": 0.22759896940000002,
"max": 0.33485591540000004
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.4247480027,
"stddev": 0.11335223811123553,
"median": 4.3957296644,
"user": 1.50708186,
"system": 1.5645996,
"min": 4.3000598774,
"max": 4.6338269234
},
{
"command": "pacquet@main",
"mean": 4.3810341427,
"stddev": 0.11475799712378539,
"median": 4.3518449309000005,
"user": 1.4015041600000002,
"system": 1.4125709000000002,
"min": 4.3202874744,
"max": 4.7041575664
},
{
"command": "pnpr@HEAD",
"mean": 3.4364283547999994,
"stddev": 0.12564205761107028,
"median": 3.3901293794000003,
"user": 1.2425359599999999,
"system": 1.2927484000000002,
"min": 3.3639395644,
"max": 3.7786485314
},
{
"command": "pnpr@main",
"mean": 3.4278338962,
"stddev": 0.11255775797068054,
"median": 3.3942062834,
"user": 1.25482886,
"system": 1.3056246,
"min": 3.3634690854,
"max": 3.7402298114
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.11927563375619046,
"stddev": 0.005096104894444315,
"median": 0.11764439228000001,
"user": 0.1518009761904762,
"system": 0.12913763904761902,
"min": 0.11300323728,
"max": 0.13375965228000003
},
{
"command": "pacquet@main",
"mean": 0.11842782959818182,
"stddev": 0.005720870184601199,
"median": 0.11656628828000001,
"user": 0.1494615909090909,
"system": 0.12502820181818183,
"min": 0.11175801028,
"max": 0.13006429328000002
},
{
"command": "pnpr@HEAD",
"mean": 0.13305892185894738,
"stddev": 0.0033233597790403202,
"median": 0.13307401528,
"user": 0.15881813157894734,
"system": 0.13658896736842102,
"min": 0.12750156128,
"max": 0.13947615528
},
{
"command": "pnpr@main",
"mean": 0.14436797164842108,
"stddev": 0.005164901888532714,
"median": 0.14344030028000002,
"user": 0.1722172894736842,
"system": 0.14263670421052635,
"min": 0.13702369128000003,
"max": 0.15479901928000003
}
]
} |
Summary
Closes #15667.
On Windows, a side-effects row is never empty when a tarball entry's mode differs from what the post-build rehash reads. The diff records a file as added when its digest or its mode changed, and Windows has no execute bit, so the rehash cannot observe the tarball's mode:
0o644, so any0o755file in the tarball lands inaddedwith an unchanged digest.stat.mode & 0o777, which is0o666on Windows (or0o444for a read-only file), so every file lands inadded.Both stacks rebuild only when the row has nothing to restore (#14744 for pnpm 12). With those
addedentries, a build whose whole effect lies outside the package directory, such as a git hook installer, counts as a cache hit and never runs again.Modes are compared only where the rehash can observe them:
cfg!(unix)in pacquet, matchingfile_mode_from, andprocess.platform !== 'win32'in the v11 worker. A file whose content changed is still recorded.No open pull request already fixed this. #15672 took the same approach and was closed without merging.
The new fixture version
@pnpm.e2e/[email protected]shipsbin/tool.js. The fixture packer stores that file as mode0o755on every OS. Linux runs prove the install path. The mode-only diff is compiled out here, so the Windows CI jobs are what fail if the ignore regresses.AI-assisted change.
Squash Commit Body
Checklist
already linked to it solves it.
are implemented in every affected version.
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 (Cursor, Grok 4.7).
Summary by CodeRabbit