Repository navigation
test(git-fetcher): cover bundleDependencies closure depth cap - #12644
Conversation
The MAX_BUNDLE_DEPTH belt-and-braces guard in collect_bundled_files (added in #12620) had no coverage: the existing closure tests all terminate through the visited-set, never the depth counter, leaving packlist.rs lines 143-150 uncovered in the CodeCov report. Add a test that builds a linear `dependencies` chain longer than the cap, with every package resolving to a fresh canonical path so the visited-set can't short-circuit the walk. It asserts packages created past depth 32 are refused while everything within the cap still ships, exercising the warn-and-continue branch. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jh1Qonse2eyQfCnt3cd1EY
|
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 (1)
📝 WalkthroughWalkthroughAdds a unit test that builds a linear ChangesPacklist bundle-depth coverage
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Possibly related PRs
Suggested labels
Suggested reviewers
✨ Finishing Touches📝 Generate docstrings
🧪 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 |
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12644 +/- ##
=======================================
Coverage 88.58% 88.58%
=======================================
Files 339 339
Lines 49171 49171
=======================================
+ Hits 43557 43559 +2
+ Misses 5614 5612 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
KSXGitHub
left a comment
There was a problem hiding this comment.
Please use complete JSON syntax.
Address review feedback on #12644: the per-package manifest in the depth-cap test was assembled by splicing a `,"dependencies":{...}` fragment into a format string, which is an incomplete, hard-to-read JSON shape. Build each manifest as a complete `serde_json::json!` value instead, using the parenthesized-key form for the dynamic dependency name. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jh1Qonse2eyQfCnt3cd1EY
Address review feedback on #12644: bind the chain's next-package name to a `next` local instead of inlining `format!(...)` as the json! computed key, so the manifest reads more clearly. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Jh1Qonse2eyQfCnt3cd1EY
Integrated-Benchmark Report (Linux)Commit: Each scenario reports direct installs and pnpr installs. Bencher consumes pacquet@HEAD and pnpr@HEAD. Scenario: Isolated linker: fresh restore, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.60795967956,
"stddev": 0.21938776010424038,
"median": 4.5470023602600005,
"user": 3.74983254,
"system": 3.4383900400000003,
"min": 4.393202904260001,
"max": 5.10778041026,
"times": [
5.10778041026,
4.44631265626,
4.45310430326,
4.57545585426,
4.74934129026,
4.518548866260001,
4.393202904260001,
4.4289305712600004,
4.765894479260001,
4.641025460260001
]
},
{
"command": "pacquet@main",
"mean": 4.60480438946,
"stddev": 0.1675169269858298,
"median": 4.53830528076,
"user": 3.77045344,
"system": 3.4320758400000004,
"min": 4.46469195726,
"max": 4.95471893626,
"times": [
4.95471893626,
4.597074824260001,
4.52571849226,
4.466674348260001,
4.76906299226,
4.758736234260001,
4.46482807026,
4.49564597026,
4.550892069260001,
4.46469195726
]
},
{
"command": "pnpr@HEAD",
"mean": 2.97427873996,
"stddev": 0.10199814153275505,
"median": 2.94743161026,
"user": 2.7762670399999996,
"system": 3.05650284,
"min": 2.88093104626,
"max": 3.2418298872599998,
"times": [
2.91751055726,
2.97142649126,
3.2418298872599998,
2.91687968526,
2.88093104626,
2.94045379726,
2.97164065126,
2.95440942326,
3.02515364926,
2.9225522112599998
]
},
{
"command": "pnpr@main",
"mean": 2.9837704254600004,
"stddev": 0.1450796036930399,
"median": 2.9139622902599998,
"user": 2.76192114,
"system": 3.0456147400000004,
"min": 2.84854056626,
"max": 3.21685070326,
"times": [
3.19641788026,
2.86361590726,
3.10008794226,
2.88192215326,
2.84854056626,
3.0500605842599997,
3.21685070326,
2.87752049126,
2.94600242726,
2.85668559926
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6442655933200001,
"stddev": 0.011154163802856613,
"median": 0.6453067413200001,
"user": 0.38832484,
"system": 1.3185901800000002,
"min": 0.6303747523200001,
"max": 0.6651924443200001,
"times": [
0.6316035023200001,
0.6487016773200001,
0.6478001983200001,
0.65493321132,
0.64948845732,
0.6383573963200001,
0.6428132843200001,
0.6333910093200001,
0.6651924443200001,
0.6303747523200001
]
},
{
"command": "pacquet@main",
"mean": 0.6615025013200001,
"stddev": 0.029212737337732643,
"median": 0.6525573413200001,
"user": 0.39398264,
"system": 1.32550148,
"min": 0.6274155413200001,
"max": 0.7319938133200001,
"times": [
0.6502078593200001,
0.6274155413200001,
0.6678485983200001,
0.6654921823200001,
0.65490682332,
0.6826197303200001,
0.6430034253200001,
0.6413538643200001,
0.6501831753200001,
0.7319938133200001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.70394828192,
"stddev": 0.05380369212213111,
"median": 0.6934441738200001,
"user": 0.38576074,
"system": 1.3363321799999999,
"min": 0.6595231433200001,
"max": 0.8354577643200001,
"times": [
0.6946022313200001,
0.6650856383200001,
0.6926856523200001,
0.6972711253200001,
0.6942026953200001,
0.6595231433200001,
0.6758436883200001,
0.8354577643200001,
0.7570609103200001,
0.66774997032
]
},
{
"command": "pnpr@main",
"mean": 0.66736824622,
"stddev": 0.02315269500984204,
"median": 0.6613118633200001,
"user": 0.37620914,
"system": 1.3299124800000002,
"min": 0.6418300143200001,
"max": 0.7199385123200001,
"times": [
0.6545589793200001,
0.6582297353200001,
0.6505090503200001,
0.6480877803200001,
0.68522501832,
0.6418300143200001,
0.7199385123200001,
0.6706307293200001,
0.6643939913200001,
0.6802786513200001
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.710394011820001,
"stddev": 0.04655861259238138,
"median": 4.72756619502,
"user": 3.8333156799999997,
"system": 3.37727954,
"min": 4.63254655252,
"max": 4.76594723952,
"times": [
4.76101753952,
4.70243183152,
4.73777597652,
4.73110162952,
4.64636816052,
4.63254655252,
4.72403076052,
4.66888139952,
4.76594723952,
4.73383902852
]
},
{
"command": "pacquet@main",
"mean": 4.75015096892,
"stddev": 0.04241852422559887,
"median": 4.73373973452,
"user": 3.83645468,
"system": 3.40318664,
"min": 4.70428506852,
"max": 4.82632237652,
"times": [
4.80391391952,
4.70428506852,
4.78882701552,
4.72329031752,
4.74418915152,
4.71360966252,
4.72146028852,
4.82632237652,
4.71934428352,
4.75626760552
]
},
{
"command": "pnpr@HEAD",
"mean": 3.2001587861200003,
"stddev": 0.11341467078394665,
"median": 3.13934043902,
"user": 2.84717388,
"system": 3.1863889399999996,
"min": 3.10340737752,
"max": 3.41898469452,
"times": [
3.14619834952,
3.22789913152,
3.41898469452,
3.13228952352,
3.13248252852,
3.13061344852,
3.20604233952,
3.10340737752,
3.38495308752,
3.11871738052
]
},
{
"command": "pnpr@main",
"mean": 3.3174185969200005,
"stddev": 0.3004353318036021,
"median": 3.20186184352,
"user": 2.9107818799999996,
"system": 3.21304134,
"min": 3.12091683552,
"max": 4.14599197952,
"times": [
3.19222718752,
3.37956071652,
3.12091683552,
3.28201652752,
3.29492255752,
3.20086994052,
4.14599197952,
3.17763652952,
3.20285374652,
3.17718994852
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.3617520214599999,
"stddev": 0.009036228662259779,
"median": 1.35884874506,
"user": 1.3232351599999999,
"system": 1.7058223199999998,
"min": 1.35167989056,
"max": 1.3804707525600002,
"times": [
1.3678413505600002,
1.35167989056,
1.3570088265600002,
1.3544951275600001,
1.3804707525600002,
1.3534839595600001,
1.35927192456,
1.3641856035600002,
1.3706572135600001,
1.3584255655600002
]
},
{
"command": "pacquet@main",
"mean": 1.3691905425600004,
"stddev": 0.023937837355732555,
"median": 1.3659003980600002,
"user": 1.3552643599999998,
"system": 1.6883687199999997,
"min": 1.3444340245600002,
"max": 1.43121181556,
"times": [
1.3548624105600002,
1.43121181556,
1.3677828705600001,
1.3444340245600002,
1.3494886215600002,
1.3645021625600002,
1.3672986335600001,
1.3739682105600002,
1.37436619856,
1.36399047756
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4733817144599999,
"stddev": 0.08849784772787431,
"median": 1.44694370306,
"user": 0.6005348599999999,
"system": 1.59166972,
"min": 1.41685320556,
"max": 1.7166780455600001,
"times": [
1.4662442285600001,
1.4410156115600001,
1.7166780455600001,
1.45287179456,
1.48800788256,
1.46811465956,
1.4370015475600002,
1.41685320556,
1.42801700256,
1.41901316656
]
},
{
"command": "pnpr@main",
"mean": 1.4408535609600004,
"stddev": 0.03555459293145301,
"median": 1.43408333406,
"user": 0.59256446,
"system": 1.5731564199999999,
"min": 1.4016163895600002,
"max": 1.5205060645600001,
"times": [
1.4767810925600002,
1.4498544005600003,
1.41777432456,
1.5205060645600001,
1.43156691156,
1.4389239665600002,
1.43436711456,
1.40334579156,
1.43379955356,
1.4016163895600002
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.07479989108,
"stddev": 0.036865267732043634,
"median": 3.0659979120800003,
"user": 1.84605986,
"system": 1.9677631800000004,
"min": 3.0394649575800003,
"max": 3.16388028858,
"times": [
3.0426933425800002,
3.0394649575800003,
3.06675259058,
3.05955696658,
3.08950067458,
3.0454676695800003,
3.0772802135800004,
3.16388028858,
3.0981589735800004,
3.06524323358
]
},
{
"command": "pacquet@main",
"mean": 3.1071237142799997,
"stddev": 0.03909368186934476,
"median": 3.09808669308,
"user": 1.8577930599999999,
"system": 1.99374858,
"min": 3.06536084258,
"max": 3.2007391805800003,
"times": [
3.06885879858,
3.1091867575800003,
3.0862792325800004,
3.09097118758,
3.09993769258,
3.09623569358,
3.1185929695800003,
3.2007391805800003,
3.1350747875800002,
3.06536084258
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4481262928799998,
"stddev": 0.02163149830614852,
"median": 1.4370051905799999,
"user": 0.59439566,
"system": 1.61934368,
"min": 1.4253947595799998,
"max": 1.49232850858,
"times": [
1.46808739158,
1.49232850858,
1.4569760595799999,
1.46579201458,
1.43235674058,
1.43513166158,
1.43695558058,
1.43118541158,
1.43705480058,
1.4253947595799998
]
},
{
"command": "pnpr@main",
"mean": 1.4293400898799997,
"stddev": 0.03389909619555212,
"median": 1.42115531608,
"user": 0.59199486,
"system": 1.5464996799999997,
"min": 1.39238135558,
"max": 1.4838343355799999,
"times": [
1.46496251058,
1.47140736858,
1.4838343355799999,
1.39238135558,
1.4192695015799999,
1.44044383858,
1.40006076958,
1.39734888858,
1.40065119958,
1.42304113058
]
}
]
} |
|
| Branch | pr/12644 |
| Testbed | pacquet |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result milliseconds (ms) (Result Δ%) | Upper Boundary milliseconds (ms) (Limit %) |
|---|---|---|---|
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,710.39 ms(-1.19%)Baseline: 4,767.28 ms | 5,720.74 ms (82.34%) |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot 🚷 view threshold | 3,074.80 ms(+1.11%)Baseline: 3,041.08 ms | 3,649.30 ms (84.26%) |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 1,361.75 ms(+0.95%)Baseline: 1,348.95 ms | 1,618.74 ms (84.12%) |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,607.96 ms(-1.39%)Baseline: 4,672.86 ms | 5,607.43 ms (82.18%) |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 644.27 ms(+2.65%)Baseline: 627.61 ms | 753.14 ms (85.54%) |
|
| Branch | pr/12644 |
| 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 | 3,200.16 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 1,448.13 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 1,473.38 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,974.28 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 703.95 ms |
Bring the latest `main` (20 commits) into the pack port branch. The notable incoming changes for this branch: - #12644 (`test(git-fetcher): cover bundleDependencies closure depth cap`) added `bundle_dependencies_closure_stops_past_max_depth` to `git-fetcher/src/packlist/tests.rs`. This branch had already relocated that file to the standalone `fs-packlist` crate, so the change is a modify-vs-rename: git's rename detection carried the new test into `fs-packlist/src/tests.rs`, where it compiles and passes (the `MAX_BUNDLE_DEPTH` guard it covers lives there). fs-packlist now has 26 tests. - New pacquet CLI commands landed on `main` — audit (#12637, #12653), global (#12638), link (#12589), fetch (#12588), and list. Their dispatch arms auto-merged into `cli_args.rs` alongside this branch's `Pack` arm; the cli crate compiles with all of them. All four textual overlaps (`Cargo.toml`, `Cargo.lock`, `cli/Cargo.toml`, `cli_args.rs`) auto-merged with no conflict markers. The merged tree passes `cargo check --workspace --all-targets`; pack (23), exportable-manifest (28), fs-packlist (26), and git-fetcher (61) test suites all pass. No documentation in this PR went stale: `main` did not touch `cli/README.md` or the pack / exportable-manifest / fs-packlist crates.
Summary
Adds a regression test that closes a coverage hole left by #12620 (the
bundleDependencies-closure rewrite in the pacquet git-fetcher).#12620 replaced the per-dependency recursion in
pacquet/crates/git-fetcher/src/packlist.rswithnpm-bundled's reachability walk, and added aMAX_BUNDLE_DEPTH(32) belt-and-braces cap on top of the visited-set. CodeCov flagged the cap'swarn-and-continuebranch (packlist.rs:143-150) as uncovered: every existing closure test terminates through the visited-set (a cycle / diamond resolving back to an already-seen canonical path), so the depth counter was never the thing that stopped the walk.This test builds a linear
dependencieschain longer than the cap, with every package resolving to a fresh, never-repeating canonical path so the visited-set can't short-circuit it — the only way to make the depth counter, rather than the visited-set, terminate the walk. It asserts that packages within the cap (depth ≤ 32) still ship while the first package created past it (depth 33) and everything beyond is refused. A mutation check (raising the cap so the over-limit package ships) confirms the assertion actually exercises the branch.Coverage on
packlist.rsafter this change: lines143-150move from uncovered to covered.Remaining uncovered lines in the #12620 diff (intentionally not chased)
For reviewers comparing against the CodeCov report, the other uncovered added lines are deliberate:
192(Some(_), None) => trueand195lexical fallback — fail-closed arms that fire only whenfs::canonicalizereturnsErron a path that exists. No portable fixture can produce that (a resolved dependency with a readablepackage.json, and the package root, always canonicalize), so reaching them would need a filesystem-error dependency-injection seam thatpacklist.rsdoes not currently thread. Left for a follow-up if we decide to add that seam.168/201— field-formatting closures insidetracing::debug!/tracing::warn!; their enclosing branches (resolve-miss skip, symlink escape refusal) are already covered, only the log-arg closures stay uncovered without an active subscriber. Cosmetic, no behavioral value.244—parent == current → Noneinresolve_bundled_dependency's walk-up is dead code given the call contract (current == rootalways returns first); unreachable without violating the function's contract.Squash Commit Body
Checklist
pacquet/port, or the description notes what still needs porting. (Test-only change to the Rust port; no behavior change, nothing to port.)Written by an agent (Claude Code, Claude Opus 4.8).
Summary by CodeRabbit