Repository navigation
test(cli): pass the restart log path through process.argv - #13621
Conversation
The `node -e` helper in the restart tests interpolated the log file's path straight into a single-quoted JavaScript string literal. A Windows temp path such as `C:\Users\...\log.txt` is then parsed as JS text, so `\U` and `\n` become escape sequences and the script appends to a mangled path instead of the log the test reads back. Pass the path as a script argument and read it from `process.argv[1]` instead, so it never reaches the JavaScript parser. The argument that `pnpm restart` forwards to each script follows it at `process.argv[2]`. Both copies of the helper are updated: the unit tests in `cli_args/restart/tests.rs` and the integration tests in `tests/restart.rs`. The sibling shell helpers in the same files interpolate the path into a double-quoted POSIX shell word, which does not eat backslashes, and those tests are gated to Unix; they need no equivalent change. Resolves #12720.
|
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 (2)
📝 WalkthroughWalkthroughThe restart argument-forwarding tests now pass the log path as a Node.js process argument. The helper reads the log path from ChangesRestart test portability
Estimated code review effort: 1 (Trivial) | ~5 minutes Assessment against linked issues
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 |
process.argv
Micro-Benchmark ResultsLinux |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13621 +/- ##
==========================================
+ Coverage 87.99% 88.01% +0.01%
==========================================
Files 568 568
Lines 98002 98017 +15
==========================================
+ Hits 86239 86271 +32
+ Misses 11763 11746 -17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Confidence Score: 5/5The PR appears safe to merge with no actionable defects identified. The updated helpers use the correct Node eval-mode argument positions, and the Unix shell preserves the generated log path as one argument. Reviews (1): Last reviewed commit: "test(cli): pass the restart log path thr..." | Re-trigger Greptile |
There was a problem hiding this comment.
Pull request overview
Updates pacquet restart tests to avoid embedding filesystem paths directly into node -e JavaScript source (which can misparse Windows backslashes as escape sequences). Instead, the log file path is passed as a Node argument and read from process.argv, improving portability and preventing path corruption.
Changes:
- Pass the restart test log file path via
node -e … <logPath>and read it fromprocess.argv[1]. - Shift the forwarded
pnpm restartargument toprocess.argv[2]in the Node helper. - Apply the same fix to both the unit-level and integration-level restart tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| pnpm/crates/cli/src/cli_args/restart/tests.rs | Updates the in-process RestartArgs::run unit test helper to pass the log path via process.argv rather than interpolating it into JS source. |
| pnpm/crates/cli/tests/restart.rs | Updates the CLI integration test helper similarly, ensuring the forwarded restart arg is read from the correct process.argv index. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
process.argvprocess.argv
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.562503892,
"stddev": 0.15059392535967833,
"median": 2.5262361918000003,
"user": 1.9552609199999995,
"system": 1.60741464,
"min": 2.3989426368,
"max": 2.8366152288000004,
"times": [
2.6589849428,
2.8366152288000004,
2.3989426368,
2.4400588428,
2.4246688998000003,
2.5127526908,
2.7498480138000003,
2.6290139358,
2.4344340358000003,
2.5397196928000003
]
},
{
"command": "pacquet@main",
"mean": 2.7761249369,
"stddev": 0.20214788057461233,
"median": 2.8631188338,
"user": 2.3478236200000002,
"system": 1.8286075399999997,
"min": 2.4941141298000002,
"max": 3.0640419138,
"times": [
2.5097609758000003,
2.8866166388,
2.8625011698000002,
2.5729722638,
2.4941141298000002,
2.9138654408,
2.9483997758,
3.0640419138,
2.8637364978,
2.6452405628
]
},
{
"command": "pnpr@HEAD",
"mean": 1.5910466914,
"stddev": 0.18160914583412002,
"median": 1.5425197918,
"user": 1.48734572,
"system": 1.48030414,
"min": 1.4072344008,
"max": 1.8869613638,
"times": [
1.6249182748,
1.4601213088,
1.6299102288,
1.4196317848,
1.4388411518,
1.4573021588,
1.7488352698,
1.8367109717999999,
1.8869613638,
1.4072344008
]
},
{
"command": "pnpr@main",
"mean": 1.6289800011,
"stddev": 0.16799669367091266,
"median": 1.6304511478000001,
"user": 1.5380003199999999,
"system": 1.63107134,
"min": 1.4170486388,
"max": 1.9084065308,
"times": [
1.5302299398,
1.4669568458,
1.6314447698,
1.4655831378,
1.8797298598,
1.6884017758,
1.4170486388,
1.6725409868,
1.9084065308,
1.6294575258000001
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.37533691054000007,
"stddev": 0.03507434887394915,
"median": 0.38327071834000004,
"user": 0.3143328799999999,
"system": 0.72117738,
"min": 0.32084959034000005,
"max": 0.42245077634,
"times": [
0.33023550034000004,
0.34157076334,
0.38201983234000003,
0.42245077634,
0.38452160434000004,
0.40776499034,
0.40656303634,
0.36240586234,
0.32084959034000005,
0.39498714934
]
},
{
"command": "pacquet@main",
"mean": 0.41605271344000005,
"stddev": 0.020704967200524175,
"median": 0.41644973734,
"user": 0.36144258,
"system": 0.7592102799999999,
"min": 0.38475218034,
"max": 0.44897470234000003,
"times": [
0.44174141634,
0.38475218034,
0.40289364534000005,
0.44897470234000003,
0.42875078534000005,
0.39659361734000004,
0.42572865234,
0.41854637134,
0.41435310334000003,
0.39819266034
]
},
{
"command": "pnpr@HEAD",
"mean": 0.40344281144000005,
"stddev": 0.041223014639834216,
"median": 0.40568365134,
"user": 0.34244897999999996,
"system": 0.7343674800000002,
"min": 0.35505216234000003,
"max": 0.48651124334,
"times": [
0.40295812634,
0.42659822034,
0.35849246334,
0.40886327234000003,
0.38208705134000004,
0.40840917634,
0.35505216234000003,
0.36410220134000004,
0.44135419734000003,
0.48651124334
]
},
{
"command": "pnpr@main",
"mean": 0.44674467083999997,
"stddev": 0.03975643884042932,
"median": 0.43121478184,
"user": 0.38608667999999996,
"system": 0.77648308,
"min": 0.39589019334000003,
"max": 0.52156384434,
"times": [
0.42530356134,
0.42734046834,
0.41531550634000003,
0.52156384434,
0.39589019334000003,
0.41939408934,
0.43508909534,
0.45298472734,
0.48922584734,
0.48533937534000005
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.9726611223200003,
"stddev": 0.1443626536559499,
"median": 2.95004381292,
"user": 2.40643428,
"system": 2.04385996,
"min": 2.78475582192,
"max": 3.24935088792,
"times": [
3.1411928819200003,
2.93958816192,
3.24935088792,
3.04476996092,
2.91459773592,
2.99178508092,
2.90938237092,
2.96049946392,
2.78475582192,
2.79068885692
]
},
{
"command": "pacquet@main",
"mean": 2.7660233210200005,
"stddev": 0.06767963671266236,
"median": 2.7759100619200003,
"user": 1.8964045799999998,
"system": 1.6039443599999998,
"min": 2.67078261992,
"max": 2.89190755192,
"times": [
2.68890263392,
2.81161697292,
2.79464087292,
2.75872152792,
2.79309859592,
2.73176934592,
2.81142669292,
2.89190755192,
2.7073663959200003,
2.67078261992
]
},
{
"command": "pnpr@HEAD",
"mean": 1.61229171082,
"stddev": 0.09084122014356674,
"median": 1.61509763292,
"user": 1.30044998,
"system": 1.4224735600000002,
"min": 1.48221317692,
"max": 1.75095971992,
"times": [
1.60584166992,
1.63503823092,
1.75095971992,
1.50935487592,
1.57096105692,
1.73379467892,
1.67678090792,
1.48221317692,
1.62435359592,
1.53361919492
]
},
{
"command": "pnpr@main",
"mean": 1.7360450932200002,
"stddev": 0.10375145089924107,
"median": 1.77813536642,
"user": 1.2820454799999998,
"system": 1.4022160600000002,
"min": 1.51301111292,
"max": 1.83417268792,
"times": [
1.51301111292,
1.67360878292,
1.79762225492,
1.83417268792,
1.76398111292,
1.8193037189199999,
1.79228961992,
1.61356078592,
1.79478886792,
1.75811198792
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.5038192996400002,
"stddev": 0.026488705002129687,
"median": 0.5037523689400001,
"user": 0.6802115400000002,
"system": 0.84583832,
"min": 0.46489125794,
"max": 0.54358636194,
"times": [
0.46489125794,
0.5001720899400001,
0.54358636194,
0.54147035594,
0.51219203194,
0.52136913894,
0.50733264794,
0.47993751194,
0.48590179694,
0.48133980294
]
},
{
"command": "pacquet@main",
"mean": 0.44050884854000005,
"stddev": 0.020829355123072067,
"median": 0.43953235794,
"user": 0.58496704,
"system": 0.76739962,
"min": 0.40519794994,
"max": 0.48636723394000003,
"times": [
0.43339833294,
0.40519794994,
0.42733861794,
0.44434452194,
0.44014660494,
0.48636723394000003,
0.45531407794,
0.44295352294,
0.43110951194,
0.43891811094
]
},
{
"command": "pnpr@HEAD",
"mean": 0.36643293624,
"stddev": 0.011756440931501232,
"median": 0.36823821644,
"user": 0.24295603999999993,
"system": 0.6370391200000001,
"min": 0.35054303194,
"max": 0.38289170994,
"times": [
0.37363052394,
0.38289170994,
0.38210158094,
0.37096451194,
0.37112539394,
0.35345851394,
0.36126159394,
0.35284058094,
0.35054303194,
0.36551192094
]
},
{
"command": "pnpr@main",
"mean": 0.36616252514,
"stddev": 0.030450985512930295,
"median": 0.36710658494000004,
"user": 0.26308654000000004,
"system": 0.62085802,
"min": 0.32368991594,
"max": 0.40992685794,
"times": [
0.36787403094,
0.32368991594,
0.40992685794,
0.39544596894,
0.36982179994000003,
0.32860901494,
0.36633913894000003,
0.40531252594,
0.34030655894,
0.35429943894
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.88778849382,
"stddev": 0.08175546989122622,
"median": 1.89477683152,
"user": 0.99513344,
"system": 0.9226993200000001,
"min": 1.79540012852,
"max": 2.0593365345200003,
"times": [
1.90107152952,
1.90643585452,
1.91526139852,
1.88848213352,
1.79540012852,
1.8032593135200001,
1.81512376252,
1.96127709152,
2.0593365345200003,
1.83223719152
]
},
{
"command": "pacquet@main",
"mean": 1.80782053012,
"stddev": 0.04758705019942494,
"median": 1.79206113802,
"user": 0.89080844,
"system": 0.83189602,
"min": 1.7584390485199999,
"max": 1.91597031452,
"times": [
1.91597031452,
1.8572278975199998,
1.79092166252,
1.82626892752,
1.78291704152,
1.7584390485199999,
1.78016084852,
1.76817915652,
1.79320061352,
1.8049197905199998
]
},
{
"command": "pnpr@HEAD",
"mean": 0.33623745312000003,
"stddev": 0.01469950284055364,
"median": 0.33661072802,
"user": 0.22724434,
"system": 0.5666912199999999,
"min": 0.31376815252,
"max": 0.36564858552,
"times": [
0.33805690852000003,
0.33782654352,
0.32018472952000004,
0.31376815252,
0.33182628052,
0.34233826252000005,
0.33539491252000003,
0.36564858552,
0.34966720952,
0.32766294652
]
},
{
"command": "pnpr@main",
"mean": 0.32692100382,
"stddev": 0.01640664921607473,
"median": 0.31846778052,
"user": 0.21602373999999996,
"system": 0.5759559199999998,
"min": 0.31016630752,
"max": 0.35649027252000004,
"times": [
0.34891166652000005,
0.35649027252000004,
0.31950919652000004,
0.33617269952,
0.33665800152,
0.31742636452,
0.31612435052000004,
0.31016630752,
0.31300007552000003,
0.31475110352
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.17993279757249997,
"stddev": 0.003127699313130196,
"median": 0.18024769176000002,
"user": 0.16611596,
"system": 0.07045348750000001,
"min": 0.17515868476000002,
"max": 0.18458445176000002,
"times": [
0.17844455476,
0.17671141976000002,
0.17826083776,
0.17621236976000001,
0.17569813076000002,
0.18458445176000002,
0.18043561576000003,
0.18308491576000002,
0.17763416776000002,
0.18114789676,
0.18005976776000002,
0.18363727676000002,
0.17515868476000002,
0.18301332176000001,
0.18128289076,
0.18355845876000002
]
},
{
"command": "pacquet@main",
"mean": 0.180299832385,
"stddev": 0.00423660582090804,
"median": 0.18043245876000003,
"user": 0.15919196000000002,
"system": 0.0751713625,
"min": 0.17254584276,
"max": 0.18895975276000002,
"times": [
0.18335383276000003,
0.18895975276000002,
0.17553631576,
0.17254584276,
0.18511670276000003,
0.17722651976,
0.17800488576,
0.17670885476,
0.17670201176000003,
0.17797856676,
0.18168150176000003,
0.18383149276000002,
0.18023536776000001,
0.18062954976,
0.18421345176,
0.18207266876000003
]
},
{
"command": "pnpr@HEAD",
"mean": 0.09326850922874999,
"stddev": 0.007448409687793149,
"median": 0.09259526426,
"user": 0.02395555375,
"system": 0.011612281250000002,
"min": 0.08482635376,
"max": 0.11793054676,
"times": [
0.08785238376,
0.08482635376,
0.08583491375999999,
0.08707549076,
0.08729837176,
0.08642411376,
0.09088665075999999,
0.08672518075999999,
0.08601170776,
0.08713116576,
0.08632330476,
0.08684739176,
0.08662456176,
0.08868900076,
0.10825285576,
0.11793054676,
0.10264264676,
0.10092332776,
0.10130184176,
0.09264974176,
0.09546866276,
0.09254078676,
0.09683491676,
0.09529290175999999,
0.08966375676,
0.09438186476,
0.09410852076,
0.09642001375999999,
0.09566089476,
0.09579746076,
0.09819040876,
0.09798055476
]
},
{
"command": "pnpr@main",
"mean": 0.10782533389793109,
"stddev": 0.006531754417872788,
"median": 0.10938244376,
"user": 0.031255753103448275,
"system": 0.0161254724137931,
"min": 0.09556690776,
"max": 0.11733980376,
"times": [
0.09660381076,
0.10322993376,
0.09556690776,
0.09795985475999999,
0.10557297676,
0.09636260676,
0.09912508975999999,
0.10716550676,
0.10493574676,
0.10938244376,
0.10748008076,
0.10710248776,
0.10824452076,
0.11101652076,
0.10153777576,
0.11152754376,
0.11415380176,
0.11629558676,
0.11698615776,
0.11259749876,
0.11105401276,
0.11624658376,
0.11733980376,
0.11180689076,
0.11378591876,
0.11003010276,
0.11058090176,
0.11187773376,
0.10136588276
]
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7236367941422223,
"stddev": 0.16243294286272808,
"median": 0.73050329292,
"user": 0.6662816488888889,
"system": 0.14191036888888886,
"min": 0.48069622892,
"max": 0.95926775492,
"times": [
0.84497494792,
0.95926775492,
0.7598981979200001,
0.59287178892,
0.73050329292,
0.61673810892,
0.91990501292,
0.48069622892,
0.6078758139200001
]
},
{
"command": "pacquet@main",
"mean": 1.0231519555866668,
"stddev": 0.14274386363076833,
"median": 1.09019331492,
"user": 0.9472992044444442,
"system": 0.2331825911111111,
"min": 0.7957826069200001,
"max": 1.15885910892,
"times": [
1.15630003892,
1.1220845429200001,
1.15637552192,
0.9529228919200001,
0.9164660339200001,
0.85938353992,
1.15885910892,
0.7957826069200001,
1.09019331492
]
},
{
"command": "pnpm@HEAD",
"mean": 2.983654156586667,
"stddev": 0.09410871480079641,
"median": 2.97638870692,
"user": 4.581814426666667,
"system": 0.2601391466666667,
"min": 2.84638740692,
"max": 3.15597297992,
"times": [
3.06185672292,
2.87523315592,
2.84638740692,
2.9591855589200002,
2.97638870692,
2.9554493399200004,
3.0384060869200002,
3.15597297992,
2.98400745092
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.621882632959999,
"stddev": 0.14805341936874955,
"median": 4.61483642046,
"user": 2.11220566,
"system": 1.6487950199999997,
"min": 4.41903660246,
"max": 4.90534899046,
"times": [
4.46568903646,
4.63573274546,
4.50316536546,
4.41903660246,
4.90534899046,
4.59394009546,
4.68190356346,
4.68670874446,
4.77550260446,
4.55179858146
]
},
{
"command": "pacquet@main",
"mean": 4.93911769246,
"stddev": 0.17415179339493966,
"median": 4.94735692346,
"user": 2.99455476,
"system": 2.2096140199999996,
"min": 4.69959838646,
"max": 5.26333034746,
"times": [
5.00171441346,
5.26333034746,
4.75852588346,
5.08541843646,
4.89385301446,
4.69959838646,
5.06146085446,
5.00086083246,
4.81476489646,
4.81164985946
]
},
{
"command": "pnpr@HEAD",
"mean": 3.9732941658599996,
"stddev": 0.2906040752344871,
"median": 3.90593683596,
"user": 2.05487456,
"system": 2.23143382,
"min": 3.56651657346,
"max": 4.57851034846,
"times": [
4.04488412546,
3.56651657346,
3.87781037846,
3.80898608046,
4.30039606346,
4.57851034846,
3.74097945946,
3.93406329346,
3.8345834394600002,
4.04621189646
]
},
{
"command": "pnpr@main",
"mean": 3.808945151059999,
"stddev": 0.17118053220389212,
"median": 3.74889155096,
"user": 1.86599866,
"system": 1.9478834200000001,
"min": 3.60907874146,
"max": 4.06957634946,
"times": [
3.81035124046,
3.67534724446,
4.06419606246,
3.75969626846,
3.6398655674600002,
3.7380868334599997,
4.06957634946,
3.60907874146,
3.73660373746,
3.98664946546
]
}
]
} |
Brings in the restart-test fix from #13621, which touches only the `restart` tests and does not overlap this branch's publish and config changes. Merged cleanly with no conflicts.
Picks up #13609, which normalizes a BOM or CRLF line endings before splitting the combined `pnpm-lock.yaml` into its env and main documents, and #13621, which passes the restart tests' log path through `process.argv` instead of interpolating it into a JS string literal. Neither touches the files this branch edits, so the merge is clean.
Summary
Resolves #12720.
The
node -ehelper in the restart tests interpolated the log file's path into a single-quoted JavaScript string literal, so a Windows path such asC:\Users\...\log.txthas\Uand\nparsed as escape sequences and the script appends to a mangled path instead of the log the test reads back. The helper now passes the path as a script argument and reads it fromprocess.argv[1], never letting it reach the JavaScript parser; the argument thatpnpm restartforwards to each script follows atprocess.argv[2].Both copies of the helper are updated: the unit tests in
pnpm/crates/cli/src/cli_args/restart/tests.rsand the integration tests inpnpm/crates/cli/tests/restart.rs. The sibling shell helpers need no equivalent change — they interpolate into a double-quoted POSIX shell word, which does not eat backslashes.Both tests remain
#[cfg(unix)], so this fixes a latent defect rather than an observed failure; lifting the gates needs a Windows machine to verify and is not part of this change. There is nothing to port to the TypeScript CLI, whose test helpers already pass paths as shell-quoted arguments rather than embedding them in JavaScript source.Squash Commit Body
Checklist
already linked to it solves it.
pnpm/port, or the description notes what still needs porting.Written by an agent (Claude Code).
Generated by Claude Code
Summary by CodeRabbit