Repository navigation
fix(cli): gate unix-only tests so Windows builds without warnings - #12595
Conversation
Several test modules and helpers run only on Unix (they shell out to `/bin/sh`-style lifecycle scripts or assert POSIX file modes) but their imports and helpers were not gated, so `cargo` on Windows reported unused-import and dead-code warnings: - `cli_args/restart` and `cli_args/stop`: every test is Unix-only, so add an inner `#![cfg(unix)]` to each `tests.rs`. This drops the unused `RestartArgs`/`StopArgs`/`TempDir` imports and the dead `setup_project` helper on Windows while leaving `#[cfg(test)] mod tests;` intact (the perfectionist dylint recognizes that as the external test module). - `cli/tests/create.rs`: only the `#[cfg(unix)]` tests use `.assert()`, so gate the `assert_cmd::prelude` import with `#[cfg(unix)]`. The Windows-active test uses `output.status.success()`. - `package-manager/src/link_file/tests.rs`: `import_into_fresh_target` is used only by `#[cfg(unix)]` tests, so move it under the existing `#[cfg(unix)]` import alongside `LINK_STATE_COPY`. No behavior change; Unix test coverage is unchanged.
|
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)
📝 WalkthroughWalkthroughUnix-only compilation guards ( ChangesUnix Platform Gating and StopArgs Tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
✨ 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 |
PR Summary by Qodofix(cli): Gate unix-only tests to avoid Windows build warnings Description
Diagram
High-Level Assessment
Files changed (4)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require review
Previous review resultsReview updated until commit 18b3ce5 Results up to commit 18b3ce5
Great, no issues found!Qodo reviewed your code and found no material issues that require review
|
|
Code review by qodo was updated up to the latest commit 18b3ce5 |
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12595 +/- ##
==========================================
- Coverage 88.15% 88.14% -0.01%
==========================================
Files 326 326
Lines 46556 46556
==========================================
- Hits 41043 41039 -4
- Misses 5513 5517 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Integrated-Benchmark Report (Linux)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.75613728748,
"stddev": 0.13602763590227399,
"median": 4.70592009758,
"user": 3.9851206399999994,
"system": 3.38243792,
"min": 4.56918392958,
"max": 5.00577429458,
"times": [
5.00577429458,
4.70732623658,
4.86707985858,
4.81345512258,
4.66256854258,
4.90532996158,
4.56918392958,
4.65115478758,
4.70451395858,
4.67498618258
]
},
{
"command": "pacquet@main",
"mean": 4.66840442308,
"stddev": 0.05017935909225185,
"median": 4.65641350708,
"user": 3.953304539999999,
"system": 3.3590721199999996,
"min": 4.59835707558,
"max": 4.76068646758,
"times": [
4.63355964258,
4.63290283158,
4.64580925158,
4.66195776958,
4.65086924458,
4.74405993558,
4.67815920458,
4.76068646758,
4.59835707558,
4.67768280758
]
},
{
"command": "pnpr@HEAD",
"mean": 2.93736778088,
"stddev": 0.18886355132841937,
"median": 2.84087311108,
"user": 2.7466094399999994,
"system": 2.90867042,
"min": 2.75544992958,
"max": 3.23745908758,
"times": [
3.23745908758,
3.14410709158,
2.83999972158,
2.8417465005800002,
2.77653637358,
2.9347781785800002,
3.21901925058,
2.80901365058,
2.75544992958,
2.81556802458
]
},
{
"command": "pnpr@main",
"mean": 2.8660000802799996,
"stddev": 0.1325917498242122,
"median": 2.82429075308,
"user": 2.7731680399999994,
"system": 2.88126382,
"min": 2.70867179358,
"max": 3.06281048058,
"times": [
3.06281048058,
2.82944982358,
2.9975233345800003,
2.94495519958,
2.8008562455800003,
2.73368980558,
3.03219816358,
2.81913168258,
2.7307142735800003,
2.70867179358
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.62440637908,
"stddev": 0.007896232898684056,
"median": 0.62304780698,
"user": 0.3807232199999999,
"system": 1.2984084399999998,
"min": 0.61376503498,
"max": 0.63917752398,
"times": [
0.61376503498,
0.62597371998,
0.63917752398,
0.63121238098,
0.62954360298,
0.61807583798,
0.62012189398,
0.62934962798,
0.61823717498,
0.61860699298
]
},
{
"command": "pacquet@main",
"mean": 0.6269246767799999,
"stddev": 0.015412078514186231,
"median": 0.62480416748,
"user": 0.38258062,
"system": 1.2881650400000002,
"min": 0.60684828098,
"max": 0.66229445098,
"times": [
0.62485195498,
0.60961823498,
0.62598335098,
0.62475637998,
0.63385717698,
0.66229445098,
0.60684828098,
0.62368705698,
0.63607904698,
0.62127083398
]
},
{
"command": "pnpr@HEAD",
"mean": 0.7064632903800001,
"stddev": 0.10777955469469556,
"median": 0.67261400948,
"user": 0.40311902,
"system": 1.3231813399999999,
"min": 0.66268743698,
"max": 1.01244499698,
"times": [
0.68519945898,
0.67683555998,
0.66268743698,
0.6682750629800001,
0.67020847398,
0.66543187998,
0.68316305698,
0.67501954498,
0.66536743198,
1.01244499698
]
},
{
"command": "pnpr@main",
"mean": 0.7180835183800001,
"stddev": 0.0709551510520493,
"median": 0.69775514248,
"user": 0.39904762,
"system": 1.35216244,
"min": 0.67411035098,
"max": 0.9134924439800001,
"times": [
0.74069121998,
0.70025576098,
0.69963053098,
0.68923481198,
0.69587975398,
0.68352627298,
0.67411035098,
0.9134924439800001,
0.70050812998,
0.68350590798
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.67811498808,
"stddev": 0.015851075791593585,
"median": 4.67597713738,
"user": 3.8602512000000004,
"system": 3.28917808,
"min": 4.66011250888,
"max": 4.71316639288,
"times": [
4.71316639288,
4.67551913888,
4.66342400888,
4.67643513588,
4.68306063888,
4.68839809088,
4.68706335588,
4.66343429488,
4.6705363148800005,
4.66011250888
]
},
{
"command": "pacquet@main",
"mean": 4.67019406988,
"stddev": 0.029605664713539544,
"median": 4.67057759338,
"user": 3.8625308999999994,
"system": 3.2746952800000004,
"min": 4.61688259988,
"max": 4.71350224988,
"times": [
4.67302279388,
4.70671003988,
4.68503430388,
4.66647227288,
4.63033537688,
4.61688259988,
4.6688258748800004,
4.67205467688,
4.71350224988,
4.66910050988
]
},
{
"command": "pnpr@HEAD",
"mean": 3.18483066428,
"stddev": 0.12190744665115871,
"median": 3.16246760738,
"user": 2.8987011000000003,
"system": 3.08799478,
"min": 3.05524456988,
"max": 3.4238818668800004,
"times": [
3.22969692188,
3.07589980488,
3.2086964948800003,
3.25734733188,
3.4238818668800004,
3.11623871988,
3.30780474888,
3.10954914588,
3.0639470378800002,
3.05524456988
]
},
{
"command": "pnpr@main",
"mean": 3.1970442930800003,
"stddev": 0.17627653131702647,
"median": 3.19676945188,
"user": 2.8974853,
"system": 3.1051365799999995,
"min": 2.98517848688,
"max": 3.51316997288,
"times": [
3.19631297488,
3.4713416618800004,
3.1467855518800003,
3.19985826188,
3.02251193688,
3.20397143788,
2.98517848688,
3.03408671688,
3.19722592888,
3.51316997288
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.34320687172,
"stddev": 0.015420031846083124,
"median": 1.3413796154200002,
"user": 1.3338504800000002,
"system": 1.7052919599999998,
"min": 1.32410459092,
"max": 1.36617719992,
"times": [
1.32410459092,
1.36617719992,
1.3389846119200002,
1.3296010229200002,
1.32764800192,
1.36061976492,
1.35421008092,
1.3297322629200001,
1.3437746189200002,
1.35721656192
]
},
{
"command": "pacquet@main",
"mean": 1.3711115332200001,
"stddev": 0.0816741655177635,
"median": 1.34726817142,
"user": 1.3401038799999998,
"system": 1.7035081600000002,
"min": 1.33056456392,
"max": 1.60266677392,
"times": [
1.3491522819200001,
1.34961728492,
1.60266677392,
1.35596007992,
1.34469525292,
1.35065909192,
1.33709163092,
1.3453243109200002,
1.34538406092,
1.33056456392
]
},
{
"command": "pnpr@HEAD",
"mean": 1.4322304163200001,
"stddev": 0.04156874392393813,
"median": 1.42433260042,
"user": 0.5981306799999999,
"system": 1.54358166,
"min": 1.39099311992,
"max": 1.52840964092,
"times": [
1.52840964092,
1.4255387719200001,
1.45357835192,
1.46552795892,
1.4315642049200001,
1.39099311992,
1.42312642892,
1.39801746992,
1.40383411892,
1.4017140969200002
]
},
{
"command": "pnpr@main",
"mean": 1.4379192439200001,
"stddev": 0.06261856994877608,
"median": 1.4219814314199999,
"user": 0.58076008,
"system": 1.5711214599999996,
"min": 1.39885855092,
"max": 1.61316007392,
"times": [
1.42935924992,
1.61316007392,
1.43019284592,
1.43460712492,
1.42337926292,
1.40760683292,
1.4101605539200002,
1.39885855092,
1.42058359992,
1.41128434392
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.0051435738200003,
"stddev": 0.04938391620489216,
"median": 2.99500150322,
"user": 1.7872427799999997,
"system": 1.94666966,
"min": 2.9692408082200004,
"max": 3.14078026122,
"times": [
2.9927808602200003,
2.9782669632200003,
3.0063613522200003,
2.9943888652200004,
3.00060930922,
2.97123157522,
3.00216160222,
2.9956141412200004,
3.14078026122,
2.9692408082200004
]
},
{
"command": "pacquet@main",
"mean": 3.0020194797200004,
"stddev": 0.048976418651614805,
"median": 2.98520285672,
"user": 1.7796607799999997,
"system": 1.9623304599999998,
"min": 2.9691900462200005,
"max": 3.13529805722,
"times": [
3.0129723092200003,
2.97548321522,
2.9850248232200003,
2.96983408122,
2.98436986022,
2.9691900462200005,
3.0034504452200004,
2.98538089022,
3.13529805722,
2.99919106922
]
},
{
"command": "pnpr@HEAD",
"mean": 1.43419418662,
"stddev": 0.01329518535620495,
"median": 1.4355301537199998,
"user": 0.5902998800000001,
"system": 1.58402266,
"min": 1.4130688382199998,
"max": 1.46086144422,
"times": [
1.42738727322,
1.4130688382199998,
1.42010142522,
1.44447813022,
1.43555357022,
1.42849649922,
1.46086144422,
1.4355067372199999,
1.43560776422,
1.4408801842199999
]
},
{
"command": "pnpr@main",
"mean": 1.4338691836200002,
"stddev": 0.041957403149636224,
"median": 1.42182410522,
"user": 0.58774998,
"system": 1.5721528599999997,
"min": 1.40142358822,
"max": 1.54804540822,
"times": [
1.44136254422,
1.41427617122,
1.54804540822,
1.40753305822,
1.40142358822,
1.43701028922,
1.42770757022,
1.41768499622,
1.42508986122,
1.41855834922
]
}
]
} |
|
| Branch | pr/12595 |
| 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,678.11 ms(+5.39%)Baseline: 4,439.01 ms | 5,326.81 ms (87.82%) |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot 🚷 view threshold | 3,005.14 ms(-0.79%)Baseline: 3,028.98 ms | 3,634.78 ms (82.68%) |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 1,343.21 ms(+0.31%)Baseline: 1,339.10 ms | 1,606.92 ms (83.59%) |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot 🚷 view threshold | 4,756.14 ms(+16.22%)Baseline: 4,092.46 ms | 4,910.95 ms (96.85%) |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot 🚷 view threshold | 624.41 ms(+0.17%)Baseline: 623.33 ms | 747.99 ms (83.48%) |
|
| Branch | pr/12595 |
| 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,184.83 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 1,434.19 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 1,432.23 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 2,937.37 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 706.46 ms |
Summary
On Windows,
cargoreportsunused_imports/dead_codewarnings in several pacquet test modules whose tests run only on Unix (they shell out to/bin/sh-style lifecycle scripts or assert POSIX file modes). The test bodies are#[cfg(unix)], but their imports/helpers were not gated, so on Windows the imports and a helper are left unused.This gates the Unix-only test code so Windows builds cleanly. No behavior change; Unix test coverage is unchanged.
cli_args/restartandcli_args/stop: every test is Unix-only — added an inner#![cfg(unix)]to eachtests.rs, dropping the unusedRestartArgs/StopArgs/TempDirimports and the deadsetup_projecthelper on Windows.#[cfg(test)] mod tests;is left intact so theperfectionistdylint still recognizes it as the external test module.cli/tests/create.rs: only the#[cfg(unix)]tests use.assert(), so theassert_cmd::preludeimport is gated with#[cfg(unix)]. The Windows-active test usesoutput.status.success().package-manager/src/link_file/tests.rs:import_into_fresh_targetis used only by#[cfg(unix)]tests, so it moves under the existing#[cfg(unix)]import alongsideLINK_STATE_COPY.Squash Commit Body
```text
fix(cli): gate unix-only tests so Windows builds without warnings
Several test modules and helpers run only on Unix (they shell out to
/bin/sh-style lifecycle scripts or assert POSIX file modes) but theirimports and helpers were not gated, so
cargoon Windows reportedunused-import and dead-code warnings.
inner
#![cfg(unix)]to each tests.rs. This drops the unusedRestartArgs/StopArgs/TempDir imports and the dead setup_project helper on
Windows while leaving
#[cfg(test)] mod tests;intact (the perfectionistdylint recognizes that as the external test module).
.assert(), so gatethe assert_cmd::prelude import with #[cfg(unix)]. The Windows-active test
uses output.status.success().
only by #[cfg(unix)] tests, so move it under the existing #[cfg(unix)]
import alongside LINK_STATE_COPY.
No behavior change; Unix test coverage is unchanged.
```
Checklist
pacquet/port, or the description notes what still needs porting. — N/A: pacquet-only test-gating, no user-visible behavior.pnpm changeset) if this PR changes any published package. — N/A: pacquet is not a published npm package; no runtime change.Written by an agent (Claude Code, claude-opus-4-8).
Summary by CodeRabbit
Tests
--if-presentflag, and error handling when scripts are missing.Chores