Repository navigation
test(pacquet): speed up the yaml scalar-budget lockfile test - #13876
Conversation
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? |
|
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)
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe PR verifies preservation of existing ChangesallowBuilds preservation
Windows Rust maintenance
Lockfile parser test coverage
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains; the PR is merge-ready after normal checks and review. Assessment against linked issues
Out-of-scope changes
Suggested labels: Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Reviews (6): Last reviewed commit: "chore: drop changeset superseded by pnpm..." | Re-trigger Greptile |
| use std::{ | ||
| collections::{BTreeMap, HashMap}, | ||
| fs::{self, File}, | ||
| fs::File, |
There was a problem hiding this comment.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
pnpm11/pnpm/test/install/lifecycleScripts.ts (1)
186-200: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winCover string-valued
allowBuildsentries.
add.tsnow preserves both boolean and string values fromopts.allowBuilds, but this test only preservestrue. Add a valid string-valued entry and assert that its exact value remains afterpnpm add --allow-build. This protects the full configuration contract.🤖 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 `@pnpm11/pnpm/test/install/lifecycleScripts.ts` around lines 186 - 200, Update the test “pnpm add --allow-build should merge with existing allowBuilds in pnpm-workspace.yaml” to include an existing string-valued allowBuilds entry alongside the boolean entry, then assert that the exact string value is preserved after execPnpmSync. Keep the existing boolean and newly added package assertions 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.
Inline comments:
In `@pnpm/crates/lockfile/src/env_lockfile.rs`:
- Line 26: Update the imports used by the Unix-only function so the `fs` module
is available for its `fs::OpenOptions` reference, while retaining `File`; use
the existing `fs::{self, File}` form or qualify the call with
`std::fs::OpenOptions`.
---
Nitpick comments:
In `@pnpm11/pnpm/test/install/lifecycleScripts.ts`:
- Around line 186-200: Update the test “pnpm add --allow-build should merge with
existing allowBuilds in pnpm-workspace.yaml” to include an existing
string-valued allowBuilds entry alongside the boolean entry, then assert that
the exact string value is preserved after execPnpmSync. Keep the existing
boolean and newly added package assertions unchanged.
🪄 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: 1c4f3742-b969-4bbe-a3c7-d0bd328ccae8
📒 Files selected for processing (7)
.changeset/fix-allow-build.mdpnpm/crates/fs/src/symlink_dir.rspnpm/crates/injected-deps-syncer/src/dir_patcher.rspnpm/crates/lockfile/src/env_lockfile.rspnpm/crates/patching/src/commit/tests.rspnpm11/installing/commands/src/add.tspnpm11/pnpm/test/install/lifecycleScripts.ts
| use std::{ | ||
| collections::{BTreeMap, HashMap}, | ||
| fs::{self, File}, | ||
| fs::File, |
There was a problem hiding this comment.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 2 'fs::OpenOptions|fs::File' pnpm/crates/lockfile/src/env_lockfile.rsRepository: pnpm/pnpm
Length of output: 664
🏁 Script executed:
#!/bin/bash
set -euo pipefail
python3 - <<'PY'
from pathlib import Path
path = Path("pnpm/crates/lockfile/src/env_lockfile.rs")
text = path.read_text()
print("module_import_present:", "fs::{self, File}" in text or "use std::fs;" in text)
print("file_import_present:", "fs::File" in text)
for number, line in enumerate(text.splitlines(), 1):
if "fs::OpenOptions" in line or "use std::fs" in line:
print(f"{number}:{line}")
PY
cat > /tmp/rust_fs_resolution.rs <<'RS'
use std::fs::File;
#[cfg(unix)]
fn open_lockfile_no_follow() -> std::io::Result<File> {
fs::OpenOptions::new().read(true).open("/dev/null")
}
fn main() {}
RS
if command -v rustc >/dev/null 2>&1; then
if rustc --edition=2021 --emit=metadata /tmp/rust_fs_resolution.rs -o /tmp/rust_fs_resolution.rmeta 2>&1; then
echo "standalone_resolution: unexpectedly succeeded"
else
echo "standalone_resolution: fs::OpenOptions is unresolved without a module import"
fi
else
echo "rustc: unavailable"
fiRepository: pnpm/pnpm
Length of output: 1169
Restore the fs module import.
The Unix-only function uses fs::OpenOptions, but the import binds only File. Restore fs::{self, File} or qualify the call as std::fs::OpenOptions.
🤖 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/lockfile/src/env_lockfile.rs` at line 26, Update the imports used
by the Unix-only function so the `fs` module is available for its
`fs::OpenOptions` reference, while retaining `File`; use the existing
`fs::{self, File}` form or qualify the call with `std::fs::OpenOptions`.
fecee76 to
c7081b2
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13876 +/- ##
==========================================
- Coverage 88.19% 88.17% -0.03%
==========================================
Files 646 646
Lines 107162 107281 +119
==========================================
+ Hits 94509 94591 +82
- Misses 12653 12690 +37 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
c7081b2 to
9acf1cc
Compare
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
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.4246534548800005,
"stddev": 0.09881068079939773,
"median": 2.38270914478,
"user": 1.68763094,
"system": 1.6862468999999998,
"min": 2.32277023578,
"max": 2.59831136878
},
{
"command": "pacquet@main",
"mean": 2.48664130138,
"stddev": 0.11446203632188928,
"median": 2.48552996028,
"user": 1.76219404,
"system": 1.7321703,
"min": 2.33780810378,
"max": 2.6833608247800003
},
{
"command": "pnpr@HEAD",
"mean": 1.52091421948,
"stddev": 0.1381425074913566,
"median": 1.4750501912799998,
"user": 1.6927894399999999,
"system": 1.7495987,
"min": 1.38177637378,
"max": 1.75633938678
},
{
"command": "pnpr@main",
"mean": 1.56966059218,
"stddev": 0.15067681075554973,
"median": 1.6093233517799999,
"user": 1.84657944,
"system": 1.7724992999999998,
"min": 1.38539571678,
"max": 1.8032888067800001
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.3738849133,
"stddev": 0.0230285293553418,
"median": 0.37706693150000004,
"user": 0.30851182,
"system": 0.67522474,
"min": 0.323665785,
"max": 0.399103665
},
{
"command": "pacquet@main",
"mean": 0.38999906939999995,
"stddev": 0.032729576016680466,
"median": 0.3927364425,
"user": 0.3266808200000001,
"system": 0.70801894,
"min": 0.340171008,
"max": 0.449472663
},
{
"command": "pnpr@HEAD",
"mean": 0.3900372296,
"stddev": 0.02191183832592219,
"median": 0.387020028,
"user": 0.33784242,
"system": 0.6665780399999999,
"min": 0.362803132,
"max": 0.427177965
},
{
"command": "pnpr@main",
"mean": 0.4260223596,
"stddev": 0.05245168622377878,
"median": 0.4111764005,
"user": 0.35439782000000003,
"system": 0.7038766399999999,
"min": 0.376952985,
"max": 0.538473707
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.01270963190169884,
"stddev": 0.0024054580400776505,
"median": 0.012288099060000002,
"user": 0.008003023088803091,
"system": 0.0047212581467181445,
"min": 0.00897298706,
"max": 0.02222981706
},
{
"command": "pacquet@main",
"mean": 0.0143804914032836,
"stddev": 0.003369336668000201,
"median": 0.014021087060000001,
"user": 0.008643067014925369,
"system": 0.005739020373134328,
"min": 0.00938974406,
"max": 0.02688617606
},
{
"command": "pnpr@HEAD",
"mean": 0.01252898371020576,
"stddev": 0.0014665833690493514,
"median": 0.012445576060000001,
"user": 0.007810553333333338,
"system": 0.004727826337448558,
"min": 0.00856668206,
"max": 0.01593717006
},
{
"command": "pnpr@main",
"mean": 0.012930639789411764,
"stddev": 0.001652431866702788,
"median": 0.01302083606,
"user": 0.008157137647058825,
"system": 0.0047863275294117635,
"min": 0.008587270059999999,
"max": 0.01649346906
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.013130518139999993,
"stddev": 0.001478050903251225,
"median": 0.013003738220000002,
"user": 0.00844502,
"system": 0.004706678133333332,
"min": 0.009930568720000001,
"max": 0.01651172872
},
{
"command": "pacquet@main",
"mean": 0.012768372908679248,
"stddev": 0.006449834626990089,
"median": 0.012143260720000002,
"user": 0.007377247547169813,
"system": 0.005411890566037736,
"min": 0.008671324720000002,
"max": 0.07208174872
},
{
"command": "pnpr@HEAD",
"mean": 0.012422450598453044,
"stddev": 0.0018355808889643195,
"median": 0.012206910720000002,
"user": 0.007557570165745855,
"system": 0.0048812355801104955,
"min": 0.00930494972,
"max": 0.01681340772
},
{
"command": "pnpr@main",
"mean": 0.013103719105620918,
"stddev": 0.0016565202126757991,
"median": 0.013341770720000002,
"user": 0.008273249150326801,
"system": 0.004862917647058825,
"min": 0.009429594720000002,
"max": 0.01719103672
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.9356945900799998,
"stddev": 0.04650375038132855,
"median": 2.92652441058,
"user": 2.2976751399999995,
"system": 1.7220682,
"min": 2.88357728558,
"max": 3.01997675658
},
{
"command": "pacquet@main",
"mean": 2.90736099068,
"stddev": 0.03664242351874607,
"median": 2.91524060308,
"user": 2.2983770399999996,
"system": 1.6535753,
"min": 2.84116225358,
"max": 2.95661217858
},
{
"command": "pnpr@HEAD",
"mean": 1.57696708238,
"stddev": 0.09451527037427784,
"median": 1.5677148655800002,
"user": 1.5588056399999999,
"system": 1.6587908000000002,
"min": 1.47283090158,
"max": 1.78337910658
},
{
"command": "pnpr@main",
"mean": 1.5781656171799998,
"stddev": 0.11854938648221097,
"median": 1.61407569958,
"user": 1.3872926399999999,
"system": 1.503199,
"min": 1.43670619658,
"max": 1.78820716558
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.42951915752000003,
"stddev": 0.01950660519338924,
"median": 0.42984218262,
"user": 0.49102527999999995,
"system": 0.6426904200000001,
"min": 0.39978484562,
"max": 0.45904519862
},
{
"command": "pacquet@main",
"mean": 0.46540452302,
"stddev": 0.027025992114418456,
"median": 0.46346965362000003,
"user": 0.56815818,
"system": 0.7080127200000002,
"min": 0.42125391962000003,
"max": 0.50513197462
},
{
"command": "pnpr@HEAD",
"mean": 0.41933990462,
"stddev": 0.022276159713456773,
"median": 0.41880712661999997,
"user": 0.29119547999999995,
"system": 0.62616952,
"min": 0.39000923362,
"max": 0.45518431262000003
},
{
"command": "pnpr@main",
"mean": 0.39749221432,
"stddev": 0.02383301620622691,
"median": 0.39673498411999997,
"user": 0.26051578000000003,
"system": 0.5943089200000001,
"min": 0.36115519362,
"max": 0.43140019662
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.9832573193200003,
"stddev": 0.035632505398948314,
"median": 1.9851954117200001,
"user": 0.8657133400000001,
"system": 0.8287999199999998,
"min": 1.94117917922,
"max": 2.0575036562199998
},
{
"command": "pacquet@main",
"mean": 1.8926837337200002,
"stddev": 0.01557644228234686,
"median": 1.89542554972,
"user": 0.75798054,
"system": 0.71396502,
"min": 1.8681403972200001,
"max": 1.91126987822
},
{
"command": "pnpr@HEAD",
"mean": 0.33953090162,
"stddev": 0.01298008849030967,
"median": 0.34170364822,
"user": 0.21403363999999997,
"system": 0.5145385200000001,
"min": 0.31789407422,
"max": 0.35817742622000004
},
{
"command": "pnpr@main",
"mean": 0.34487786402,
"stddev": 0.024397473293353462,
"median": 0.34008336822,
"user": 0.22606234,
"system": 0.5085229200000001,
"min": 0.31857212322,
"max": 0.38694161022
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.21798320186461537,
"stddev": 0.01716147910062146,
"median": 0.21947294948,
"user": 0.1685837092307692,
"system": 0.06349840769230769,
"min": 0.18941445348,
"max": 0.24930713248
},
{
"command": "pacquet@main",
"mean": 0.22951387123,
"stddev": 0.01357462766178058,
"median": 0.22448726248,
"user": 0.18714819000000002,
"system": 0.0594341,
"min": 0.20752748848,
"max": 0.25250755948000003
},
{
"command": "pnpr@HEAD",
"mean": 0.10021040660000002,
"stddev": 0.0036878325049728667,
"median": 0.10021812448,
"user": 0.031058140000000005,
"system": 0.011028979999999999,
"min": 0.09625180148,
"max": 0.11229155648
},
{
"command": "pnpr@main",
"mean": 0.09920811799724141,
"stddev": 0.0027599014502812614,
"median": 0.09860575248,
"user": 0.029227112413793107,
"system": 0.012388786206896553,
"min": 0.09569212648,
"max": 0.10782535148
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6419902837733333,
"stddev": 0.08667931479976743,
"median": 0.63427286644,
"user": 0.6318872577777778,
"system": 0.11625511333333333,
"min": 0.54652606244,
"max": 0.81365714144
},
{
"command": "pacquet@main",
"mean": 0.6737545822177777,
"stddev": 0.12320863085044238,
"median": 0.60336090844,
"user": 0.66049348,
"system": 0.12836411333333334,
"min": 0.57269012544,
"max": 0.8889049624400001
},
{
"command": "pnpm@HEAD",
"mean": 3.3743671775511115,
"stddev": 0.24100199686499302,
"median": 3.36425402644,
"user": 5.104176813333333,
"system": 0.3183558911111111,
"min": 3.06628894744,
"max": 3.67584370144
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.42119778158,
"stddev": 0.05614160651635056,
"median": 4.408354510780001,
"user": 1.6981297999999998,
"system": 1.6356189799999998,
"min": 4.35099625428,
"max": 4.51110029228
},
{
"command": "pacquet@main",
"mean": 4.50411183058,
"stddev": 0.16446967467488513,
"median": 4.42827888028,
"user": 1.5953136999999997,
"system": 1.52734898,
"min": 4.32069574628,
"max": 4.72787434428
},
{
"command": "pnpr@HEAD",
"mean": 3.5726556644800005,
"stddev": 0.12284288415513109,
"median": 3.5611040887799996,
"user": 1.6271744,
"system": 1.63042578,
"min": 3.3992698992799997,
"max": 3.80194286428
},
{
"command": "pnpr@main",
"mean": 3.56098172188,
"stddev": 0.15666974155973515,
"median": 3.52730458828,
"user": 1.6288542,
"system": 1.61661958,
"min": 3.4093689812799997,
"max": 3.90608300328
}
]
}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. Comparable to that scenario head-to-head.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.18281259832,
"stddev": 0.014749753831543684,
"median": 0.17725236212,
"user": 0.21035198,
"system": 0.20157590666666664,
"min": 0.17086965412,
"max": 0.22025638212
},
{
"command": "pacquet@main",
"mean": 0.2208168137866667,
"stddev": 0.00849513758901698,
"median": 0.22155096862,
"user": 0.26325603000000003,
"system": 0.22293420666666666,
"min": 0.21018145312,
"max": 0.23752601012000002
},
{
"command": "pnpr@HEAD",
"mean": 0.20943417539272727,
"stddev": 0.021436835438971794,
"median": 0.20569001112000002,
"user": 0.25082423454545455,
"system": 0.19432549454545453,
"min": 0.18356910412,
"max": 0.25203138612000003
},
{
"command": "pnpr@main",
"mean": 0.19591723797714286,
"stddev": 0.010218946129836579,
"median": 0.19233028212000003,
"user": 0.22330185142857142,
"system": 0.18914082571428573,
"min": 0.18393695912,
"max": 0.22405090712
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/13876 |
| 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,489.04 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 358.15 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 322.95 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 90.55 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,420.96 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,496.57 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 282.45 ms |
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? |
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
@zkochan what do you think of this PR? Can you review it? btea mentioned in #13872 (comment) that it's "basically reasonable" edit: oh, maybe the PR #13873 is better, if the Rust port doesn't need to be changed after all: |
7c86f92 to
88f26b0
Compare
Code Review by Qodo
1. Unrelated Rust refactors included
|
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
The allowBuilds merge fix already landed on main with its own changeset, so this one would duplicate the release note. The remaining PR content is internal/test-only and needs no changeset. Co-Authored-By: Claude Fable 5 <[email protected]>
Dismissed because a newer commit was pushed; Greptile will re-review the current head.
|
Note GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer. |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
|
Congrats on merging your first pull request! 🎉🎉🎉 |
Summary
This PR started as a fix for
pnpm add --allow-buildreplacing the existingallowBuildsconfig (pnpm/pnpm#13872). That fix landed on main via pnpm/pnpm#13873 while this PR was open, so after rebasing, the production TypeScript change is gone and what remains is the still-useful rest:returninpnpm-fs'sis_symlink_or_junction, and use.cast()instead ofas _for the raw handle passed toGetFileInformationByHandlein the injected-deps syncer.--allow-buildmerge test (added by fix(add): add to the existing allowBuilds instead of replacing it #13873) to also cover a string-valuedallowBuildsentry surviving the merge.No changeset: nothing here is user-visible (the original changeset was dropped as a duplicate of the one that landed with #13873).
Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting. (Test-onlyand internal changes; nothing user-visible to mirror.)
pnpm changeset) if this PR changes any publishedpackage. Keep it short and written for pnpm users — it becomes a release note.
(Not needed: no user-visible change.)
Written by an agent (Claude Code, claude-fable-5).