Repository navigation
Conversation
|
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:
📝 WalkthroughWalkthroughAdds deferred build persistence in ChangesLifecycle build bookkeeping
Current lockfile validation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant User
participant RebuildCommand
participant ModulesYaml
participant InstallPipeline
participant BuildModules
User->>RebuildCommand: run rebuild --pending
RebuildCommand->>ModulesYaml: read pendingBuilds
RebuildCommand->>InstallPipeline: pass dependency names and pending projects
InstallPipeline->>BuildModules: execute selected pending builds
InstallPipeline->>ModulesYaml: persist settled pendingBuilds
Assessment against linked issues
Possibly related issues
Possibly related PRs
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 |
PR Summary by QodoRecord pendingBuilds + allowBuilds policy in .modules.yaml (and port suites)
AI Description
Diagram
High-Level Assessment
Files changed (14)
|
Micro-Benchmark ResultsLinux |
Code Review by Qodo
1.
|
PR Code Suggestions ✨Latest suggestions up to ecf2cf2 Warning
Previous suggestionsSuggestions up to commit a9a48e2
Suggestions up to commit 07ffbbb
Suggestions up to commit 0b11105
Suggestions up to commit d296ab0
Suggestions
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
pnpm/crates/cli/tests/current_lockfile.rs (1)
87-96: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winLog the captured output before asserting on it.
This test captures raw process
outputvia.output()(bypassingassert_cmd's automatic failure-output printing) but never prints it before the plainassert!calls. The duplicate-keys test later in this file (lines 248-262) follows the correct pattern byeprintln!-ing the combined stdout/stderr before asserting — this test should do the same so a CI failure here is debuggable.As per path instructions ("Test logging: log before non-
assert_eq!assertions... prefereprintln!for multiline strings").🪵 Proposed fix
let output = rerun(&workspace) .with_args(["install", "--frozen-lockfile"]) .output() .expect("run the frozen install"); + eprintln!( + "frozen install output:\n{}{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr), + ); assert!(!output.status.success(), "a failing postinstall must fail the install");🤖 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/cli/tests/current_lockfile.rs` around lines 87 - 96, Log the captured `output` before the plain assertions in the frozen-install test, following the duplicate-keys test’s `eprintln!` pattern. Combine and print stdout and stderr in a readable multiline message, then retain the existing success-status and `CURRENT_LOCKFILE` assertions unchanged.pnpm/crates/cli/tests/lifecycle_scripts.rs (1)
914-956: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winGood coverage for the basic deferred-project + deferred-dependency case.
Consider also covering the case where a project entry (
".") recorded by an earlier--ignore-scriptsinstall survives (or correctly doesn't survive) a later partial install (e.g.pacquet add) that neither re-defers it nor actually runs the project's own scripts — this is the scenario flagged in theinstall.rsreview formerge_pending_builds.🤖 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/cli/tests/lifecycle_scripts.rs` around lines 914 - 956, The pending-builds tests only cover a single deferred install and should also exercise merge behavior across a later partial install. Extend the pending_builds test module with a scenario that performs an initial --ignore-scripts install recording "." and its dependency, then runs a partial pacquet add that neither defers nor executes the project’s own scripts, and assert read_pending_builds reflects the intended preservation or removal of "." while retaining correct dependency entries.
🤖 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/package-manager/src/install.rs`:
- Around line 2027-2044: Prevent root-project entries such as "." from being
persisted in pending_builds by filtering them out in the deferred_projects
construction within install.rs, or alternatively update rebuild --pending in
rebuild.rs to detect and execute root lifecycle scripts and drain those entries.
Ensure non-root package rebuild keys retain their existing behavior and no root
entry remains indefinitely in .modules.yaml.
---
Nitpick comments:
In `@pnpm/crates/cli/tests/current_lockfile.rs`:
- Around line 87-96: Log the captured `output` before the plain assertions in
the frozen-install test, following the duplicate-keys test’s `eprintln!`
pattern. Combine and print stdout and stderr in a readable multiline message,
then retain the existing success-status and `CURRENT_LOCKFILE` assertions
unchanged.
In `@pnpm/crates/cli/tests/lifecycle_scripts.rs`:
- Around line 914-956: The pending-builds tests only cover a single deferred
install and should also exercise merge behavior across a later partial install.
Extend the pending_builds test module with a scenario that performs an initial
--ignore-scripts install recording "." and its dependency, then runs a partial
pacquet add that neither defers nor executes the project’s own scripts, and
assert read_pending_builds reflects the intended preservation or removal of "."
while retaining correct dependency entries.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 597ae04c-0277-4bf7-9aed-b54ca3d18211
📒 Files selected for processing (14)
.changeset/record-pending-builds.md.changeset/revoked-build-approval-is-re-evaluated.mdpnpm/crates/cli/src/cli_args/rebuild.rspnpm/crates/cli/tests/current_lockfile.rspnpm/crates/cli/tests/install_filters.rspnpm/crates/cli/tests/lifecycle_scripts.rspnpm/crates/package-manager/src/build_modules.rspnpm/crates/package-manager/src/build_modules/tests.rspnpm/crates/package-manager/src/install.rspnpm/crates/package-manager/src/install/tests.rspnpm/crates/package-manager/src/install_frozen_lockfile.rspnpm/crates/package-manager/src/install_with_fresh_lockfile.rspnpm/crates/package-manifest/src/lib.rspnpm/plans/TEST_PORTING.md
Confidence Score: 5/5Safe to merge — both behavioral fixes are well-motivated, the logic paths are consistent, and the test suite directly exercises the corrected flows including failure cases. The two new install-path checks are additive and defensively coded. The BuildModulesOutput refactor is mechanical with all call sites updated. drain_settled_projects correctly re-reads .modules.yaml after the main write. Tests cover the key invariants thoroughly. No files require special attention. Reviews (9): Last reviewed commit: "fix(package-manager): settle a pending d..." | Re-trigger Greptile |
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. The tables below show mean ± σ; Bencher thresholds on the minimum latency, which is far less perturbed by shared-runner contention (noise only adds time). Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.46625191854,
"stddev": 0.1284014908332067,
"median": 2.4272075629399996,
"user": 1.5331661799999998,
"system": 1.2386556199999998,
"min": 2.33084827894,
"max": 2.71027882294,
"times": [
2.4422334379399997,
2.6658738889399998,
2.39219341394,
2.43732264794,
2.71027882294,
2.41709247794,
2.3747138239399996,
2.36808976894,
2.33084827894,
2.52387262394
]
},
{
"command": "pacquet@main",
"mean": 2.56235140274,
"stddev": 0.1640661907475546,
"median": 2.62033789794,
"user": 1.5181469800000003,
"system": 1.2908118199999998,
"min": 2.33994626294,
"max": 2.7470792719399997,
"times": [
2.72619416694,
2.33994626294,
2.66192221994,
2.7470792719399997,
2.72062734394,
2.5883820689399997,
2.43912434194,
2.40508051494,
2.65229372694,
2.3428641089399997
]
},
{
"command": "pnpr@HEAD",
"mean": 1.58791313394,
"stddev": 0.1567054992863085,
"median": 1.58867506594,
"user": 1.0634155799999998,
"system": 1.10998632,
"min": 1.33870178994,
"max": 1.78743810994,
"times": [
1.59118555294,
1.58616457894,
1.78743810994,
1.62640169594,
1.74326720294,
1.5411535099400002,
1.33870178994,
1.78284019894,
1.51207651294,
1.36990218694
]
},
{
"command": "pnpr@main",
"mean": 1.4173920920400003,
"stddev": 0.08960926016297056,
"median": 1.37768272094,
"user": 1.02262948,
"system": 1.1774286200000001,
"min": 1.3384972539400002,
"max": 1.63674789194,
"times": [
1.63674789194,
1.3384972539400002,
1.4495027849400002,
1.44157886894,
1.38037925994,
1.36323012994,
1.35405141194,
1.4731383339400002,
1.37498618194,
1.36180880294
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.25530748902,
"stddev": 0.007611752687348957,
"median": 0.25298950742000004,
"user": 0.21812518,
"system": 0.4964351599999999,
"min": 0.24677505242000003,
"max": 0.27048044042,
"times": [
0.25205846342,
0.25611924242,
0.25663336942,
0.26603113142,
0.24704976942,
0.25264377642,
0.25194840642,
0.24677505242000003,
0.25333523842,
0.27048044042
]
},
{
"command": "pacquet@main",
"mean": 0.25007669172,
"stddev": 0.010740461875829197,
"median": 0.24984401241999998,
"user": 0.20694697999999997,
"system": 0.51370326,
"min": 0.23333185142,
"max": 0.27150095342,
"times": [
0.25130496442,
0.23959853542,
0.25214255242,
0.26174167142,
0.24947023842000002,
0.24360789642000003,
0.27150095342,
0.24785046742000003,
0.25021778642,
0.23333185142
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26781540912,
"stddev": 0.007807011948960901,
"median": 0.26860520641999996,
"user": 0.20718308,
"system": 0.5425306599999999,
"min": 0.25632851742,
"max": 0.28211218242,
"times": [
0.27299930242,
0.27082221142,
0.28211218242,
0.26464268341999997,
0.25632851742,
0.25762509942,
0.27358088642,
0.26736795642,
0.26283279542,
0.26984245642
]
},
{
"command": "pnpr@main",
"mean": 0.27218015481999996,
"stddev": 0.005677905076349908,
"median": 0.27175354042,
"user": 0.21485728,
"system": 0.53731346,
"min": 0.26299780742,
"max": 0.28069523342,
"times": [
0.26299780742,
0.27175657142,
0.27760835042,
0.27172647442,
0.27175050942,
0.27319069242,
0.28069523342,
0.27865107442,
0.26726193742,
0.26616289742
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.7200600064600002,
"stddev": 0.018903404484983073,
"median": 2.7160854638600003,
"user": 1.5952532,
"system": 1.2922803999999999,
"min": 2.69695248886,
"max": 2.75448226586,
"times": [
2.6969815928600003,
2.69695248886,
2.71048881886,
2.7244868898600005,
2.7371726888600003,
2.72035099186,
2.7118199358600004,
2.75448226586,
2.7087242068600004,
2.73914018486
]
},
{
"command": "pacquet@main",
"mean": 2.7064891117600003,
"stddev": 0.014485399914996281,
"median": 2.7065220773600003,
"user": 1.5832882,
"system": 1.2641196,
"min": 2.68740158186,
"max": 2.73376693486,
"times": [
2.73376693486,
2.69972708386,
2.7132390758600002,
2.68740158186,
2.72136972486,
2.6874453448600004,
2.7110758928600003,
2.7044639418600003,
2.7085802128600003,
2.6978213238600004
]
},
{
"command": "pnpr@HEAD",
"mean": 1.53395574296,
"stddev": 0.14625141667825015,
"median": 1.50115407586,
"user": 0.9827842,
"system": 1.1316280000000003,
"min": 1.38785610686,
"max": 1.82028490386,
"times": [
1.69056273186,
1.40868488786,
1.67327496986,
1.82028490386,
1.51523636786,
1.48783505086,
1.39803508386,
1.44331422586,
1.38785610686,
1.5144731008599999
]
},
{
"command": "pnpr@main",
"mean": 1.5671575240599998,
"stddev": 0.1483919989287952,
"median": 1.51478218436,
"user": 0.9243781999999999,
"system": 1.1768041000000002,
"min": 1.38683908186,
"max": 1.81875514986,
"times": [
1.38683908186,
1.47472025486,
1.40376252886,
1.60733055486,
1.52540706186,
1.49500301586,
1.50415730686,
1.6892086078600002,
1.76639167786,
1.81875514986
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5499447081000001,
"stddev": 0.008837165653266537,
"median": 0.5502844839000001,
"user": 0.6844366799999999,
"system": 0.63983146,
"min": 0.5341684659,
"max": 0.5639256499,
"times": [
0.5447886179,
0.5521000779,
0.5541225389000001,
0.5639256499,
0.5453459979,
0.5588946459,
0.5484688899,
0.5341684659,
0.5416104519,
0.5560217449
]
},
{
"command": "pacquet@main",
"mean": 0.5382072004,
"stddev": 0.008310770287626784,
"median": 0.5364339473999999,
"user": 0.6544378799999999,
"system": 0.6509169600000001,
"min": 0.5244984639,
"max": 0.5522714909,
"times": [
0.5342988219,
0.5427676409000001,
0.5379015159,
0.5320329129,
0.5451358419000001,
0.5462232599,
0.5349663789,
0.5522714909,
0.5244984639,
0.5319756769
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29023429250000005,
"stddev": 0.008554506499117402,
"median": 0.2922958404,
"user": 0.18097987999999998,
"system": 0.50526066,
"min": 0.2716265149,
"max": 0.2999353339,
"times": [
0.2926798779,
0.2716265149,
0.2842526669,
0.29265608390000003,
0.28259305090000003,
0.29193559690000004,
0.29179231790000004,
0.29870038790000003,
0.2961710939,
0.2999353339
]
},
{
"command": "pnpr@main",
"mean": 0.29709114970000006,
"stddev": 0.005380348035308452,
"median": 0.2969612224,
"user": 0.18863977999999998,
"system": 0.5275148599999999,
"min": 0.2872213369,
"max": 0.3090019699,
"times": [
0.2967051499,
0.29825409690000004,
0.29559859590000004,
0.29952457990000003,
0.2939074799,
0.29721729490000004,
0.2959645649,
0.2872213369,
0.2975164279,
0.3090019699
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.85391693964,
"stddev": 0.010750996200563653,
"median": 1.85252596894,
"user": 0.91433716,
"system": 0.7241507399999998,
"min": 1.83903027144,
"max": 1.87789161344,
"times": [
1.85678247344,
1.84714556544,
1.85221897044,
1.8459374994400002,
1.86119224144,
1.85888682944,
1.8472509644400001,
1.83903027144,
1.85283296744,
1.87789161344
]
},
{
"command": "pacquet@main",
"mean": 1.85308127984,
"stddev": 0.012791508002017336,
"median": 1.8536895959400002,
"user": 0.8737668599999999,
"system": 0.7605459399999999,
"min": 1.83030903444,
"max": 1.8731179124400001,
"times": [
1.8462296504400002,
1.86682146444,
1.8591435124400002,
1.8614785604400002,
1.8512730894400002,
1.84368843344,
1.8731179124400001,
1.85610610244,
1.8426450384400002,
1.83030903444
]
},
{
"command": "pnpr@HEAD",
"mean": 0.29669708354,
"stddev": 0.007822575712919963,
"median": 0.29839837094,
"user": 0.19846336,
"system": 0.50629224,
"min": 0.28037770044,
"max": 0.30800886144,
"times": [
0.28037770044,
0.28727669344,
0.29480347944,
0.29854668944,
0.29993843144,
0.29825005243999997,
0.29666195944,
0.30099824844,
0.30210871944,
0.30800886144
]
},
{
"command": "pnpr@main",
"mean": 0.29651476013999994,
"stddev": 0.009598458192713669,
"median": 0.30142246693999997,
"user": 0.18687256000000002,
"system": 0.5227540399999999,
"min": 0.27996333944,
"max": 0.30521044144,
"times": [
0.30521044144,
0.28902576743999997,
0.28157553644,
0.27996333944,
0.30366366744,
0.30107229743999997,
0.30289338643999997,
0.30177263644,
0.29573998344,
0.30423054544
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.32307042072000003,
"stddev": 0.0038300689677797685,
"median": 0.32412532442,
"user": 0.32164682,
"system": 0.04574908,
"min": 0.31380072442,
"max": 0.32769306842,
"times": [
0.32576373542000003,
0.32168409142,
0.32769306842,
0.32179261742000004,
0.32475228042000004,
0.32361212242000004,
0.32148380442,
0.32548323642,
0.31380072442,
0.32463852642
]
},
{
"command": "pacquet@main",
"mean": 0.32653666002000004,
"stddev": 0.0066932536578384865,
"median": 0.32501597742,
"user": 0.31907922,
"system": 0.05118737999999999,
"min": 0.31623765342,
"max": 0.34043660042,
"times": [
0.32458113842,
0.34043660042,
0.32994999042,
0.32449429442,
0.31623765342,
0.33229894342,
0.32173526742,
0.32845667742,
0.32545081642,
0.32172521842
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08308556257151516,
"stddev": 0.0016152051901263801,
"median": 0.08245671442000001,
"user": 0.01941452606060606,
"system": 0.007971715757575756,
"min": 0.08141356942000001,
"max": 0.08737911542000001,
"times": [
0.08560079542000001,
0.08583118942000001,
0.08274512842000001,
0.08273606142,
0.08614724442,
0.08737911542000001,
0.08659420742000001,
0.08206993642000002,
0.08239028942000001,
0.08236790742000001,
0.08249396442000001,
0.08197498742,
0.08268416342000001,
0.08141356942000001,
0.08283171042000001,
0.08219366842,
0.08233185942000001,
0.08245671442000001,
0.08213668142000001,
0.08203770542000001,
0.08238199442000001,
0.08233361342,
0.08208159842000001,
0.08299856542000002,
0.08221273542000002,
0.08256724242,
0.08296157542000002,
0.08165433342000002,
0.08256826442000001,
0.08651245342000001,
0.08216331242000001,
0.08272890642000001,
0.08224207042000001
]
},
{
"command": "pnpr@main",
"mean": 0.08345382402606065,
"stddev": 0.0018622575503063146,
"median": 0.08265330442000002,
"user": 0.018746980606060604,
"system": 0.008754453333333332,
"min": 0.08158602542000001,
"max": 0.08800426242,
"times": [
0.08475532342000001,
0.08236746742,
0.08187898742000001,
0.08304718642000002,
0.08179026942,
0.08181242142000002,
0.08208071542,
0.08237661442000001,
0.08249184042000002,
0.08265330442000002,
0.08202483142000001,
0.08267127842000001,
0.08211121342000001,
0.08158602542000001,
0.08289296742,
0.08218862942,
0.08188341442000001,
0.08324658342,
0.08665057342000002,
0.08693614142000002,
0.08219842742000001,
0.08193925942000001,
0.08428147142000002,
0.08800426242,
0.08564235442000001,
0.08762247342000001,
0.08548557842000001,
0.08309434442000001,
0.08261835842000001,
0.08297617342000001,
0.08604426142000002,
0.08250419442000001,
0.08411924542000002
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.54893593184,
"stddev": 0.12515817556679867,
"median": 4.50972025384,
"user": 1.6884031400000001,
"system": 1.38816428,
"min": 4.41353495334,
"max": 4.8034753103400005,
"times": [
4.67067478634,
4.8034753103400005,
4.4463346473400005,
4.45638507634,
4.62701467734,
4.41353495334,
4.454303003340001,
4.46854770834,
4.550892799340001,
4.59819635634
]
},
{
"command": "pacquet@main",
"mean": 4.58546826174,
"stddev": 0.16539377730040566,
"median": 4.521131732840001,
"user": 1.6678097399999998,
"system": 1.3874235799999999,
"min": 4.42240213334,
"max": 4.858441103340001,
"times": [
4.44546554434,
4.45746400634,
4.42240213334,
4.464002289340001,
4.53733961834,
4.58608084134,
4.858441103340001,
4.75415730034,
4.8244059333400005,
4.504923847340001
]
},
{
"command": "pnpr@HEAD",
"mean": 3.54418998604,
"stddev": 0.10034673378737687,
"median": 3.5257864003400003,
"user": 1.1607775400000002,
"system": 1.23539158,
"min": 3.4430702833400004,
"max": 3.7771123553400003,
"times": [
3.7771123553400003,
3.4612302563400004,
3.61153707334,
3.52168855234,
3.4463382693400004,
3.4430702833400004,
3.49685877934,
3.52988424834,
3.57271757134,
3.58146247134
]
},
{
"command": "pnpr@main",
"mean": 3.5554162549400004,
"stddev": 0.13057150180212065,
"median": 3.5025348723400005,
"user": 1.17808384,
"system": 1.2549211799999997,
"min": 3.44875252434,
"max": 3.8623859313400004,
"times": [
3.5021853293400005,
3.8623859313400004,
3.4962875333400003,
3.6648561613400004,
3.5028844153400005,
3.44875252434,
3.64169606634,
3.5059927893400005,
3.47816272934,
3.45095906934
]
}
]
} |
|
| Branch | pr/13150 |
| 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,387.86 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 280.38 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 271.63 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 81.41 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,338.70 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,443.07 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 256.33 ms |
|
Code review by qodo was updated up to the latest commit 38e1354 |
PR Code Suggestions ✨Warning
|
|||||||||
There was a problem hiding this comment.
🧹 Nitpick comments (2)
pnpm/crates/cli/tests/lifecycle_scripts.rs (1)
26-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDocument the same ordering hazard as
set_strict_dep_builds.
append_workspace_yaml_keyshares the exact truncation hazard thatset_strict_dep_builds's doc comment (lines 10-15) explicitly warns about: sinceallow_buildstruncates the file at the first"allowBuilds:"occurrence, any key appended after anallowBuilds:block already exists will be silently dropped by a laterallow_buildscall — with no assertion to catch it (the "key already exists" check only fires if the key is still present). Current call sites happen to call it beforeallow_builds, but nothing documents or enforces that ordering for future callers.📝 Suggested doc addition
/// Append a top-level `key: value` line. Only valid for keys the /// harness never writes; the assert fails loudly if that changes. + /// Must be called before [`allow_builds`], like + /// [`set_strict_dep_builds`] — a later `allow_builds` truncates the + /// file at `allowBuilds:`, silently dropping anything appended after + /// that point. pub fn append_workspace_yaml_key(workspace: &Path, key: &str, value: impl std::fmt::Display) {🤖 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/cli/tests/lifecycle_scripts.rs` around lines 26 - 41, Update the documentation comment for append_workspace_yaml_key to explicitly warn that callers must invoke it before allow_builds, because later allow_builds calls truncate content after the allowBuilds: block and can silently remove appended keys. Keep the existing duplicate-key assertion and implementation unchanged.pnpm/crates/cli/src/cli_args/rebuild.rs (1)
36-46: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueDuplicated
RebuildSelection { names: Some(...), projects: Vec::new() }construction. Both call sites build the identical "names-only" literal for the same reason (an approve-builds rebuild never has pending-project entries); a small constructor onRebuildSelectionremoves the duplication at its source.
pnpm/crates/cli/src/cli_args/rebuild.rs#L36-L46: add a convenience constructor, e.g.RebuildSelection::names_only(names: Vec<String>) -> Self { Self { names: Some(names), projects: Vec::new() } }.pnpm/crates/cli/src/cli_args/dispatch_install.rs#L556-L580: replace the inline struct literal withsuper::rebuild::RebuildSelection::names_only(build_packages).pnpm/crates/cli/src/cli_args/global.rs#L380-L425: replace the inline struct literal withcrate::cli_args::rebuild::RebuildSelection::names_only(build_packages).🤖 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/cli/src/cli_args/rebuild.rs` around lines 36 - 46, Remove duplicated names-only RebuildSelection construction by adding RebuildSelection::names_only(names: Vec<String>) in pnpm/crates/cli/src/cli_args/rebuild.rs lines 36-46, initializing names and an empty projects vector. Update pnpm/crates/cli/src/cli_args/dispatch_install.rs lines 556-580 and pnpm/crates/cli/src/cli_args/global.rs lines 380-425 to use this constructor instead of inline struct literals.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@pnpm/crates/cli/src/cli_args/rebuild.rs`:
- Around line 36-46: Remove duplicated names-only RebuildSelection construction
by adding RebuildSelection::names_only(names: Vec<String>) in
pnpm/crates/cli/src/cli_args/rebuild.rs lines 36-46, initializing names and an
empty projects vector. Update pnpm/crates/cli/src/cli_args/dispatch_install.rs
lines 556-580 and pnpm/crates/cli/src/cli_args/global.rs lines 380-425 to use
this constructor instead of inline struct literals.
In `@pnpm/crates/cli/tests/lifecycle_scripts.rs`:
- Around line 26-41: Update the documentation comment for
append_workspace_yaml_key to explicitly warn that callers must invoke it before
allow_builds, because later allow_builds calls truncate content after the
allowBuilds: block and can silently remove appended keys. Keep the existing
duplicate-key assertion and implementation unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 76694e1b-56fa-46b8-b924-e19560077328
📒 Files selected for processing (10)
.changeset/record-pending-builds.mdpnpm/crates/cli/src/cli_args/dispatch_install.rspnpm/crates/cli/src/cli_args/global.rspnpm/crates/cli/src/cli_args/rebuild.rspnpm/crates/cli/tests/current_lockfile.rspnpm/crates/cli/tests/lifecycle_scripts.rspnpm/crates/napi/src/install.rspnpm/crates/package-manager/src/build_modules.rspnpm/crates/package-manager/src/build_modules/tests.rspnpm/crates/package-manager/src/install.rs
🚧 Files skipped from review as they are similar to previous changes (4)
- .changeset/record-pending-builds.md
- pnpm/crates/package-manager/src/build_modules/tests.rs
- pnpm/crates/cli/tests/current_lockfile.rs
- pnpm/crates/package-manager/src/install.rs
|
Code review by qodo was updated up to the latest commit 9baf4aa |
…scripts succeed A workspace project's lifecycle scripts run after `.modules.yaml` is written, so clearing its `pendingBuilds` entry in `merge_pending_builds` dropped the debt before the work happened: a failing project script left `pnpm rebuild --pending` reporting an error while the record said the project was already built, and a rerun would skip it. `merge_pending_builds` now settles only dependencies — their build phase has already run by the time the file is written — and a new `drain_settled_projects` rewrites the manifest to drop the project entries after `run_projects_lifecycle_scripts` returns Ok. A script that fails propagates before the drain, so the entry survives. Regression test: `pending_builds::a_failed_project_script_keeps_its_pending_entry`.
Rust's `Path::join` replaces the base when the joined component is
absolute, so `lockfile_dir.join("/[email protected]")` escapes the workspace
and stats the host root. An importer id is always relative, so an
absolute `pendingBuilds` entry is a dependency by construction and is
classified without touching the filesystem.
…ld built it merge_pending_builds dropped a dependency from pendingBuilds whenever the rebuild selected it, but BuildModules still refuses to run a package's scripts when allowBuilds leaves it undecided or denied. A `pnpm rebuild --pending` could therefore erase deferred build debt without running anything, so a later --pending reported nothing owed while the build was still unapproved. A dependency is now settled only when the rebuild both selected it and the allowBuilds policy approves it — on a rebuild a selected, approved package always runs (force-rebuild bypasses the side-effects cache gate), so policy approval is a faithful stand-in for "was rebuilt". This mirrors pnpm, which drops only the packages after-install actually rebuilt. Regression test: pending_builds::rebuild_pending_keeps_a_dependency_the_policy_still_blocks.
|
Code review by qodo was updated up to the latest commit ecf2cf2 |
Summary
Stage 3 of #13146 — the current lockfile (
node_modules/.pnpm/lock.yaml) andpendingBuilds. Related to #13146.Porting the tests turned up two behavior gaps, both fixed here:
pendingBuildswas never written.--ignore-scriptssuppressed every dependency build and the project's own install scripts without leaving a trace, sopnpm rebuild --pendinghad nothing to drain (its own--helptext said as much).BuildModules::runnow returns aBuildModulesOutputcarrying therequires_buildsnapshots whose scripts were deferred alongside theallowBuilds-blocked ones it already reported; the install tail adds the workspace projects whose install scripts were skipped and carries forward the previous file's entries that still resolve against the current lockfile. A build stays owed until something runs it — onlypnpm rebuildclears the record.A withdrawn
allowBuildsapproval was not re-evaluated. Removing anallowBuilds: trueentry left the frozen no-op fast path untouched: the lockfile and layout were unchanged and the package was absent fromignoredBuilds(its build had succeeded), so astrictDepBuildsinstall exited 0 on a package the user had just un-approved..modules.yamlnow records theallowBuildspolicy the install ran under, as pnpm's does, and the fast path steps aside when an approval it recorded is gone. Upstream fails that install (strictDepBuilds and allowBuilds checks are bypassed when package side-effects are cached in the store #11035) — a build already cached in the store is an optimization, never an approval.Ported tests (16
TEST_PORTING.mditems, 221 → 205 unchecked):deps-restorer/test/index.ts:54,:165,:189current_lockfile.rsdeps-installer/test/lockfile.ts:368,:547,:614,:1007,:1324current_lockfile.rs,lifecycle_scripts.rsdeps-installer/test/install/lifecycleScripts.ts:547current_lockfile.rsdeps-installer/test/packageImportMethods.ts:31current_lockfile.rsdeps-installer/test/install/globalVirtualStore.ts:21(current-lockfile half)current_lockfile.rsdeps-restorer/test/index.ts:362(ignoreScriptstail)lifecycle_scripts.rspnpm/test/install/lifecycleScripts.ts:245,:303lifecycle_scripts.rsA follow-up commit fixes what the automated reviewers caught in the first round:
pendingBuildswas recorded but never drained, sopnpm rebuild --pendingreselected the same work forever and the project entries it wrote were unreachable (rebuildgates project lifecycle scripts onis_full_install).RebuildOptionsnow carries the importer ids to run, and the install drops the entries the rebuild settled.Every port was checked against a deliberately broken implementation and confirmed to fail for the expected reason before being reverted with
git restore.Two items stay unchecked, with the reason recorded in
TEST_PORTING.md:lockfile.ts:1351(a broken private lockfile is ignored) — aknown_failuresstub. pacquet raisesERR_PNPM_BROKEN_LOCKFILEon an unparseable current lockfile; upstream warns and continues with an empty one. Demoting that error to a warning plus a reporter emission is a behavior change worth its own PR.deps-restorer/test/index.ts:213(installing only dev package…) — the on-disk half is covered byheadless_install_include_filtering_excludes_production_group; the current-lockfile assertion is unreachable because a dev-only importer reads as empty toLockfile::is_empty, exactly as it does to upstream'sisEmptyLockfile, so the file is deleted rather than written.Rebased onto main after #13152 (stage 2) landed, which ported
multipleImporters.ts:208,:730anddeps-restorer/test/index.ts:789incrates/cli/tests/multiple_importers.rs. Those entries now defer to stage 2's ports and the duplicateinstall_filters.rstest this PR had added for:730is dropped.One observation not acted on:
a_repeat_install_without_a_current_lockfile_keeps_node_modulesshows that deletingnode_modules/.pnpm/lock.yamlin a workspace lets the freshness fast path report "up to date" without rewriting the file (current_lockfile_unusable_with_non_empty_wantedreturns early for workspace installs). Upstream only asserts thatnode_modulessurvives, so the port does too — but the carve-out looks incidental rather than intended and may deserve a follow-up.Squash Commit Body
Checklist
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.
Both behaviors already exist in the TypeScript CLI (
installing/deps-installerwritespendingBuildsand runs arevokedBuildsscan), so nothing needs porting the other way — pacquet was the side that diverged.rebuild --pending's help text no longer says the flag has no effect.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
New Features
pnpm install --ignore-scriptsnow records deferred dependency and workspace builds.pnpm rebuild --pendingsupport to run recorded builds and clear completed entries.Bug Fixes
Tests