Repository navigation
feat(exec): restore --sequential flag and sort regex-matched scripts lexicographically - #13074
Conversation
…lexicographically
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 (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
Changespnpm run execution
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CLI
participant run.handler
participant runRecursive
participant Scripts
CLI->>run.handler: pass --sequential and RegExp selector
run.handler->>runRecursive: set workspaceConcurrency to 1
runRecursive->>Scripts: select matching scripts
Scripts-->>runRecursive: lexicographically ordered names
runRecursive-->>CLI: execute scripts sequentially
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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 `@pnpm11/exec/commands/src/runRecursive.ts`:
- Around line 249-251: Update the sorting in the script key selection flow to
use the default Array.prototype.sort() instead of localeCompare, ensuring
deterministic UTF-16 lexicographical ordering while preserving the existing
filter behavior.
In `@pnpm11/exec/commands/test/index.ts`:
- Line 855: Strengthen the sequential-execution assertion in the test around
outputsA and outputsB by requiring outputsB[0] to be at least 30ms later than
outputsA[outputsA.length - 1], while preserving the existing timestamp ordering
check.
🪄 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: 5ed86922-1e4a-4d05-92d8-ddb9844599ac
📒 Files selected for processing (9)
.changeset/run-regex-and-sequential.mdpnpm/crates/cli/src/cli_args/clean.rspnpm/crates/cli/src/cli_args/dispatch_script.rspnpm/crates/cli/src/cli_args/restart.rspnpm/crates/cli/src/cli_args/run.rspnpm/crates/cli/src/cli_args/stop.rspnpm11/exec/commands/src/run.tspnpm11/exec/commands/src/runRecursive.tspnpm11/exec/commands/test/index.ts
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? |
1 similar comment
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? |
Confidence Score: 4/5Safe to merge for TypeScript users; the Rust port advertises The TypeScript changes achieve their goal — sequential execution and deterministic sort order work correctly through the existing shorthand mechanism. The only real gap is the Rust implementation, where
Reviews (3): Last reviewed commit: "fix(exec): remove dead code allowance on..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #13074 +/- ##
==========================================
- Coverage 85.55% 85.54% -0.01%
==========================================
Files 498 499 +1
Lines 79648 79852 +204
==========================================
+ Hits 68142 68311 +169
- Misses 11506 11541 +35 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…d assert file order in tests
There was a problem hiding this comment.
🧹 Nitpick comments (1)
pnpm11/exec/commands/test/index.ts (1)
831-832: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winIncrease timeout to prevent false passes on slow CI nodes.
If Node.js process startup is delayed due to high system load,
test:bcould take longer than 50ms to spawn. In a broken concurrency scenario (where both spawn at once),test:awould still finish and writeA_endbeforetest:bmanages to writeB_start. The output would inadvertently match the expected sequential['A_start', 'A_end', 'B_start', 'B_end']array, leading to a false pass.Consider increasing the timeout (e.g., to 250ms) to ensure the test reliably fails if scripts are executed concurrently.
— CodeRabbit (gpt-4o)
🔧 Proposed fix
- 'test:a': 'node -e "require(\'fs\').appendFileSync(\'./seq.log\', \'A_start\\n\'); setTimeout(() => { require(\'fs\').appendFileSync(\'./seq.log\', \'A_end\\n\') }, 50)"', - 'test:b': 'node -e "require(\'fs\').appendFileSync(\'./seq.log\', \'B_start\\n\'); setTimeout(() => { require(\'fs\').appendFileSync(\'./seq.log\', \'B_end\\n\') }, 50)"', + 'test:a': 'node -e "require(\'fs\').appendFileSync(\'./seq.log\', \'A_start\\n\'); setTimeout(() => { require(\'fs\').appendFileSync(\'./seq.log\', \'A_end\\n\') }, 250)"', + 'test:b': 'node -e "require(\'fs\').appendFileSync(\'./seq.log\', \'B_start\\n\'); setTimeout(() => { require(\'fs\').appendFileSync(\'./seq.log\', \'B_end\\n\') }, 250)"',🤖 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/exec/commands/test/index.ts` around lines 831 - 832, Increase the delay used by both test:a and test:b in the concurrency-ordering test from 50ms to a substantially larger value such as 250ms, keeping the existing start/end logging behavior unchanged so delayed process startup cannot produce a false sequential pass.
🤖 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 `@pnpm11/exec/commands/test/index.ts`:
- Around line 831-832: Increase the delay used by both test:a and test:b in the
concurrency-ordering test from 50ms to a substantially larger value such as
250ms, keeping the existing start/end logging behavior unchanged so delayed
process startup cannot produce a false sequential pass.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c8a982d3-a2b9-4425-ad5e-670539fed937
📒 Files selected for processing (4)
pnpm/crates/cli/src/cli_args/run.rspnpm/crates/cli/src/cli_args/run/recursive.rspnpm11/exec/commands/src/run.tspnpm11/exec/commands/test/index.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- pnpm/crates/cli/src/cli_args/run.rs
- pnpm11/exec/commands/src/run.ts
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": 2.56671921126,
"stddev": 0.11959829798290414,
"median": 2.54253390786,
"user": 2.07272538,
"system": 1.65495886,
"min": 2.4072689938600003,
"max": 2.82478793286,
"times": [
2.82478793286,
2.66070385086,
2.61955035086,
2.48936758286,
2.55039307986,
2.4072689938600003,
2.6184583628599998,
2.46625700586,
2.49573021686,
2.53467473586
]
},
{
"command": "pacquet@main",
"mean": 2.6953508454599997,
"stddev": 0.15553925838883215,
"median": 2.66633920736,
"user": 2.05821598,
"system": 1.6608444599999999,
"min": 2.46241041886,
"max": 2.94154844186,
"times": [
2.94154844186,
2.79994565786,
2.46241041886,
2.7010867378600003,
2.63159167686,
2.52682263786,
2.61984755686,
2.84188324386,
2.58861600886,
2.83975607386
]
},
{
"command": "pnpr@HEAD",
"mean": 1.6781914922600003,
"stddev": 0.14542035758794603,
"median": 1.67324128936,
"user": 1.67359838,
"system": 1.88452296,
"min": 1.46312437986,
"max": 1.9607604248600001,
"times": [
1.66764374686,
1.9607604248600001,
1.70135937786,
1.67883883186,
1.61528406886,
1.50916043686,
1.7355702108600002,
1.83315325286,
1.61702019186,
1.46312437986
]
},
{
"command": "pnpr@main",
"mean": 1.6306553485600002,
"stddev": 0.1790077434536828,
"median": 1.56195864286,
"user": 1.47927928,
"system": 1.5683408599999997,
"min": 1.42729910286,
"max": 1.95608021986,
"times": [
1.95608021986,
1.54057193986,
1.42729910286,
1.74085936486,
1.48109210486,
1.5308393898600001,
1.74872647486,
1.83821594586,
1.45952359686,
1.5833453458600002
]
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.28092609900000004,
"stddev": 0.02818860364441899,
"median": 0.27831131680000004,
"user": 0.27307322,
"system": 0.70432758,
"min": 0.24106014180000002,
"max": 0.3364024768,
"times": [
0.28693633080000003,
0.2511889648,
0.27673099380000005,
0.26617983380000004,
0.24106014180000002,
0.30989171280000005,
0.3364024768,
0.26486056680000003,
0.27989163980000004,
0.29611832880000005
]
},
{
"command": "pacquet@main",
"mean": 0.29560665910000006,
"stddev": 0.035587088200801476,
"median": 0.29806751880000004,
"user": 0.27345342,
"system": 0.73464378,
"min": 0.2454085088,
"max": 0.35253680880000005,
"times": [
0.25308582980000005,
0.27457822480000005,
0.3038928128,
0.2957000308,
0.3004350068,
0.3067385188,
0.34820171780000003,
0.35253680880000005,
0.2454085088,
0.2754891318
]
},
{
"command": "pnpr@HEAD",
"mean": 0.36466384190000006,
"stddev": 0.06820309791785181,
"median": 0.3426425503,
"user": 0.37540651999999997,
"system": 0.86242418,
"min": 0.28813185480000003,
"max": 0.46590407080000007,
"times": [
0.29259705080000004,
0.28813185480000003,
0.30938060780000004,
0.32502893680000006,
0.45055690080000005,
0.44670067180000006,
0.46590407080000007,
0.38305322480000004,
0.32649097080000006,
0.35879412980000003
]
},
{
"command": "pnpr@main",
"mean": 0.29088079330000005,
"stddev": 0.03389933535377712,
"median": 0.29108211730000005,
"user": 0.28384592000000003,
"system": 0.68435318,
"min": 0.2395982488,
"max": 0.3361641758,
"times": [
0.25815136180000003,
0.2494564408,
0.2395982488,
0.29125833380000005,
0.3253036858,
0.30679776080000004,
0.3361641758,
0.2831818588,
0.29090590080000006,
0.3279901658
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 3.1969459805,
"stddev": 0.10126897704876034,
"median": 3.2088837819,
"user": 2.74727022,
"system": 1.94609084,
"min": 3.0698394324000002,
"max": 3.3569482844,
"times": [
3.2292670384,
3.3569482844,
3.2125521684000002,
3.3360018834000003,
3.1064439244,
3.0734263294,
3.0698394324000002,
3.1337524624,
3.2052153954000002,
3.2460128864
]
},
{
"command": "pacquet@main",
"mean": 3.1846317759000002,
"stddev": 0.0685234538310822,
"median": 3.1898075454,
"user": 2.63613282,
"system": 1.98633204,
"min": 3.0938706964000002,
"max": 3.3171033984,
"times": [
3.2146558814,
3.3171033984,
3.0938706964000002,
3.2419013894,
3.1895188414,
3.2092016374,
3.1156973444,
3.1027082004,
3.1715641204000002,
3.1900962494000003
]
},
{
"command": "pnpr@HEAD",
"mean": 1.7192892153,
"stddev": 0.19388370619853348,
"median": 1.6625374044,
"user": 1.48303832,
"system": 1.68066784,
"min": 1.4949359683999999,
"max": 1.9893240964,
"times": [
1.5307445724,
1.5720259993999999,
1.9893240964,
1.8183254383999998,
1.4949359683999999,
1.6540992734,
1.6709755354,
1.9538943944,
1.9591594674,
1.5494074074
]
},
{
"command": "pnpr@main",
"mean": 1.6411058180999998,
"stddev": 0.13717835436308393,
"median": 1.6013195868999999,
"user": 1.4797231199999998,
"system": 1.54399884,
"min": 1.4676806914,
"max": 1.8771607274,
"times": [
1.6215533214,
1.7544623914,
1.8771607274,
1.7820757803999998,
1.4990506414,
1.4676806914,
1.5810858524,
1.5801309553999998,
1.7296839914,
1.5181738284
]
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.87427681772,
"stddev": 0.04738079310984601,
"median": 0.87477399802,
"user": 1.11337924,
"system": 0.9228625000000001,
"min": 0.81002059752,
"max": 0.94495012552,
"times": [
0.94251704552,
0.84937835352,
0.8206949495200001,
0.8311219485200001,
0.8958993635200001,
0.8769384825200001,
0.87260951352,
0.94495012552,
0.8986377975200001,
0.81002059752
]
},
{
"command": "pacquet@main",
"mean": 0.84920455512,
"stddev": 0.05265268705508107,
"median": 0.84282243252,
"user": 1.06875864,
"system": 0.9082522000000001,
"min": 0.77470562152,
"max": 0.95136568152,
"times": [
0.8981650685200001,
0.8567668715200001,
0.88424240052,
0.8340623125200001,
0.8220338405200001,
0.85158255252,
0.7854223035200001,
0.83369889852,
0.77470562152,
0.95136568152
]
},
{
"command": "pnpr@HEAD",
"mean": 0.37170015112000004,
"stddev": 0.030631986197144738,
"median": 0.36424523502000006,
"user": 0.30662574,
"system": 0.7403079000000001,
"min": 0.33831784052,
"max": 0.43860636352000004,
"times": [
0.36655367552,
0.40827614252000005,
0.37127854052000003,
0.34180947752,
0.37726095152,
0.35830139552,
0.43860636352000004,
0.36193679452000005,
0.35466032952000004,
0.33831784052
]
},
{
"command": "pnpr@main",
"mean": 0.35536756002000003,
"stddev": 0.041944292516059814,
"median": 0.35151705502,
"user": 0.28918533999999996,
"system": 0.7351580999999999,
"min": 0.30112877952,
"max": 0.41868558452000004,
"times": [
0.30198377952,
0.34544789952000005,
0.37784898352,
0.41868558452000004,
0.40931311252,
0.30112877952,
0.38323031852,
0.31560458252,
0.35758621052,
0.34284634952000004
]
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.31391122718,
"stddev": 0.06160438219313148,
"median": 2.32047491138,
"user": 1.61433544,
"system": 1.0914587199999999,
"min": 2.21916798988,
"max": 2.41565189788,
"times": [
2.31534640288,
2.37286269788,
2.41565189788,
2.30737348588,
2.32560341988,
2.21916798988,
2.2333545688800003,
2.3388884608800002,
2.26119014388,
2.34967320388
]
},
{
"command": "pacquet@main",
"mean": 2.02778887448,
"stddev": 0.14522270506692114,
"median": 1.9740861393800002,
"user": 1.21206014,
"system": 0.8550673199999999,
"min": 1.88822904388,
"max": 2.28017364888,
"times": [
2.2766858988800003,
2.28017364888,
2.02582625988,
1.96576399988,
1.91372752188,
1.92681826188,
1.92290117288,
1.88822904388,
2.09535465788,
1.9824082788800002
]
},
{
"command": "pnpr@HEAD",
"mean": 0.26000974488,
"stddev": 0.010788485690619914,
"median": 0.26041078188,
"user": 0.20059244,
"system": 0.52859132,
"min": 0.24203406788000004,
"max": 0.27185516788,
"times": [
0.24946810188000001,
0.25952257388,
0.26129898988,
0.27185516788,
0.24203406788000004,
0.27015321188,
0.25457886088,
0.24965334188000002,
0.27077528288,
0.27075784988
]
},
{
"command": "pnpr@main",
"mean": 0.25177520018,
"stddev": 0.007192073972608376,
"median": 0.24963212188000003,
"user": 0.18235573999999996,
"system": 0.5391312199999999,
"min": 0.24652752188000002,
"max": 0.27159491788,
"times": [
0.25014028888,
0.25355438088,
0.24965276988000004,
0.24652752188000002,
0.24961147388000002,
0.24820595488000002,
0.24910210388000004,
0.24881661588000004,
0.25054597388,
0.27159491788
]
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.7028076431400001,
"stddev": 0.21398257064284334,
"median": 0.6917123783400001,
"user": 0.6827490399999999,
"system": 0.11720736000000001,
"min": 0.42515867584,
"max": 0.9935455548400001,
"times": [
0.42515867584,
0.48093064684000003,
0.43407160784000004,
0.6788061838400001,
0.61040686584,
0.7046185728400001,
0.9935455548400001,
0.9355416198400001,
0.9066961378400001,
0.8583005658400001
]
},
{
"command": "pacquet@main",
"mean": 0.8601383835400002,
"stddev": 0.22470060412054255,
"median": 0.8055888158400001,
"user": 0.8247549399999998,
"system": 0.15200576,
"min": 0.6024871368400001,
"max": 1.21267240884,
"times": [
1.13130600084,
1.21267240884,
1.10357575184,
0.9439414448400001,
0.8073098928400001,
0.8038677388400001,
0.6965305558400001,
0.6870090588400001,
0.6126838458400001,
0.6024871368400001
]
},
{
"command": "pnpr@HEAD",
"mean": 0.08721489309000001,
"stddev": 0.005485374010484216,
"median": 0.08599567084000001,
"user": 0.017756225714285714,
"system": 0.01164841857142857,
"min": 0.08153965084,
"max": 0.10428689484,
"times": [
0.10068597084000001,
0.10428689484,
0.08974368684,
0.08153965084,
0.08186202784,
0.08201385484000001,
0.08171949984,
0.08293209484000001,
0.08610206584,
0.08734488684000001,
0.08577201384000001,
0.08854297484000001,
0.08562306384000001,
0.09283605084,
0.08735667984,
0.08651026484,
0.08854864584000001,
0.08581975484000001,
0.08363915684,
0.09122119984,
0.09308556284000001,
0.08340317184000001,
0.08605954584,
0.08518865584,
0.08177723884,
0.08593179584,
0.08194804184000001,
0.09052255484
]
},
{
"command": "pnpr@main",
"mean": 0.08614479630875,
"stddev": 0.0034664054505019488,
"median": 0.08616251884000001,
"user": 0.017997565,
"system": 0.011134192500000003,
"min": 0.08083554084000001,
"max": 0.09388773284,
"times": [
0.08643896984,
0.08298720784000001,
0.08422790584,
0.08564092784,
0.08679810684000001,
0.08845743384,
0.08517044084000001,
0.08578159184,
0.08716543984000001,
0.09173570884000001,
0.08950318384000001,
0.08745895284,
0.09042821584,
0.08505210784,
0.09077288584000001,
0.08884629684,
0.08460423384,
0.08152251884,
0.08627274784000001,
0.08477762484000001,
0.08849845984,
0.08629460684000001,
0.08605228984,
0.09225521784000001,
0.09388773284,
0.08662233384000001,
0.08134096484,
0.08223285384000001,
0.08083554084000001,
0.08121539684000001,
0.08085474884,
0.08290083384000001
]
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.7367320486999995,
"stddev": 0.10881595024242316,
"median": 4.7225446385,
"user": 2.6623695599999992,
"system": 1.8950827799999999,
"min": 4.569315973999999,
"max": 4.926026628,
"times": [
4.709039918999999,
4.893294456,
4.650093878,
4.682282144999999,
4.782271236,
4.926026628,
4.736049358,
4.750690354,
4.668256539,
4.569315973999999
]
},
{
"command": "pacquet@main",
"mean": 4.6841331616,
"stddev": 0.1820719733371615,
"median": 4.602386988999999,
"user": 2.3515837599999996,
"system": 1.74092168,
"min": 4.506809194,
"max": 5.039197624,
"times": [
4.549639362,
4.5109623899999995,
4.506809194,
4.609389738,
4.875862452,
4.734896024999999,
4.848634842,
4.5705557489999995,
5.039197624,
4.59538424
]
},
{
"command": "pnpr@HEAD",
"mean": 3.6687289837000003,
"stddev": 0.14861145186108876,
"median": 3.6313033115,
"user": 1.52463556,
"system": 1.50412538,
"min": 3.511111286,
"max": 3.9567187280000002,
"times": [
3.511111286,
3.702207972,
3.669388483,
3.8808162790000003,
3.5580865960000003,
3.5932181400000003,
3.55281614,
3.5582250060000002,
3.9567187280000002,
3.7047012070000003
]
},
{
"command": "pnpr@main",
"mean": 3.6451674873999997,
"stddev": 0.1391346633191025,
"median": 3.6317775115,
"user": 1.47025126,
"system": 1.4567945799999997,
"min": 3.494935813,
"max": 3.889905899,
"times": [
3.889905899,
3.542111699,
3.743014145,
3.494935813,
3.6566719180000002,
3.677221341,
3.518750768,
3.606883105,
3.4991465230000003,
3.823033663
]
}
]
} |
|
| Branch | pr/13074 |
| Testbed | pacquet |
🚨 1 Alert
| Benchmark | Measure Units | View | Benchmark Result (Result Δ%) | Upper Boundary (Limit %) |
|---|---|---|---|---|
| isolated-linker.fresh-resolve.hot-cache.offline | Latency milliseconds (ms) | 📈 plot 🚷 threshold 🚨 alert (🔔) | 702.81 ms(+29.60%)Baseline: 542.31 ms | 650.77 ms (108.00%) |
Summary
This pull request restores the sequential CLI flag (
--sequentialor-s) forpnpm runand adds deterministic lexicographical sorting when matching multiple scripts via regular expressions. The changes are implemented across both the TypeScript CLI (@pnpm/exec.commands) and the RustpacquetCLI to maintain full parity.Related to: #11633
Squash Commit Body
Checklist
[x] The change is implemented in both the TypeScript CLI and the Rust
pnpm/port.[x] Added a changeset (
pnpm changeset) since this PR changes published packages (@pnpm/exec.commands,pnpm,pacquet).[x] Added and updated automated tests verifying CLI options and RegExp execution order.
[x] Updated the documentation snippets explaining the interaction of
--sequentialwith RegExp matching and recursive runs.Need help on this PR? Tag
/codesmithwith what you need. Autofix is disabled.Summary by CodeRabbit
pnpm runcan now match and execute multiple scripts when a regular expression is provided.--sequential(-s) to run selected scripts one-by-one by forcing workspace concurrency to1.--sequentialbehavior for RegExp-selected scripts and updated-sshorthand handling.-sshorthand mapping.