Repository navigation
refactor: limit Rust structs to eight fields - #14872
Conversation
Group internal state and options by responsibility across pnpm and pnpr. Reuse shared contexts, shorten nested field names, and preserve fixed external formats with documented exceptions. Related to #14562.
|
Too many files changed for review (760 files, 100 file limit). |
|
Important Review skippedToo many files! This PR contains 760 files, which is 460 over the limit of 300. To get a review, reduce the PR to 300 files or fewer by splitting it into smaller PRs or changing its base branch. Usage-priced reviews support at most 300 files. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (760)
You can disable this status message by setting the 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 QodoEnforce an eight-field limit for Rust structs
AI Description
Diagram
High-Level Assessment
Files changed (195)
|
Code Review by Qodo
1. A cache comment preserves old history
|
PR Code Suggestions ✨Latest suggestions up to c238b8d Warning
Previous suggestionsSuggestions up to commit e520e2c
|
||||||||||||||||||
Micro-Benchmark ResultsLinux |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14872 +/- ##
==========================================
+ Coverage 90.80% 90.81% +0.01%
==========================================
Files 1239 1252 +13
Lines 160163 161609 +1446
==========================================
+ Hits 145432 146766 +1334
- Misses 14731 14843 +112 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.3804551943,
"stddev": 0.12766998834383797,
"median": 2.377535509,
"user": 1.2396761,
"system": 1.4304504399999998,
"min": 2.2254556479999996,
"max": 2.591748371
},
{
"command": "pacquet@main",
"mean": 2.3590254024999995,
"stddev": 0.14503131956822338,
"median": 2.306298398,
"user": 1.1514503999999999,
"system": 1.32149094,
"min": 2.216768791,
"max": 2.546002695
},
{
"command": "pnpr@HEAD",
"mean": 1.4272830559,
"stddev": 0.13424300517206925,
"median": 1.3695312899999998,
"user": 1.0922688,
"system": 1.19663284,
"min": 1.281918274,
"max": 1.649815929
},
{
"command": "pnpr@main",
"mean": 1.4436640021,
"stddev": 0.14935096423148464,
"median": 1.402387245,
"user": 1.0521432000000002,
"system": 1.2241444400000003,
"min": 1.280558561,
"max": 1.651948587
}
]
}Scenario: Isolated linker: fresh restore, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.20844674738000002,
"stddev": 0.003649714148338626,
"median": 0.20923161478000002,
"user": 0.22288507999999996,
"system": 0.53665532,
"min": 0.20284773578,
"max": 0.21288468978000002
},
{
"command": "pacquet@main",
"mean": 0.20365309898,
"stddev": 0.006789600518683125,
"median": 0.20388351978000002,
"user": 0.21631057999999995,
"system": 0.52011542,
"min": 0.19283118978000002,
"max": 0.21745527678
},
{
"command": "pnpr@HEAD",
"mean": 0.22067122158000002,
"stddev": 0.006149094744906513,
"median": 0.21943450178,
"user": 0.24225278,
"system": 0.52288552,
"min": 0.21325630678000002,
"max": 0.22857297978000002
},
{
"command": "pnpr@main",
"mean": 0.21878938298,
"stddev": 0.004617356800580942,
"median": 0.21908400828000002,
"user": 0.23262237999999996,
"system": 0.51489542,
"min": 0.20836779578,
"max": 0.22373970278000002
}
]
}Scenario: Isolated linker: repeat install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.006109086239047616,
"stddev": 0.00032071732942511787,
"median": 0.00608682222,
"user": 0.0036989495238095274,
"system": 0.0027883741428571416,
"min": 0.00546912322,
"max": 0.00763036022
},
{
"command": "pacquet@main",
"mean": 0.006352869470000007,
"stddev": 0.0004376398793387694,
"median": 0.006309426220000001,
"user": 0.003959447766990289,
"system": 0.0028305782038834945,
"min": 0.00563697922,
"max": 0.00925355922
},
{
"command": "pnpr@HEAD",
"mean": 0.006321685648921573,
"stddev": 0.00027456768939472395,
"median": 0.00633667172,
"user": 0.003904275294117644,
"system": 0.002838773480392156,
"min": 0.00556480322,
"max": 0.00817505322
},
{
"command": "pnpr@main",
"mean": 0.006382955411214468,
"stddev": 0.00027346797921956937,
"median": 0.0063952622200000005,
"user": 0.0038999715245478027,
"system": 0.0029137958656330763,
"min": 0.00570181922,
"max": 0.00813254322
}
]
}Scenario: Isolated linker: repeat install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.014448527476024845,
"stddev": 0.001126069074579317,
"median": 0.01454908224,
"user": 0.007986825962732919,
"system": 0.007520622857142852,
"min": 0.01096604224,
"max": 0.017472874240000002
},
{
"command": "pacquet@main",
"mean": 0.011653409798441563,
"stddev": 0.0023544453615893398,
"median": 0.01217078324,
"user": 0.006867900779220775,
"system": 0.005698887662337663,
"min": 0.006184844240000001,
"max": 0.016364646240000003
},
{
"command": "pnpr@HEAD",
"mean": 0.007172860597142857,
"stddev": 0.00026942366211598175,
"median": 0.00717917174,
"user": 0.004206139428571428,
"system": 0.003626234285714282,
"min": 0.006388634240000001,
"max": 0.00820629024
},
{
"command": "pnpr@main",
"mean": 0.007204043771250005,
"stddev": 0.00029346934314005996,
"median": 0.007217867240000001,
"user": 0.004064561319444442,
"system": 0.003802426388888891,
"min": 0.006243453240000001,
"max": 0.008115189239999999
}
]
}Scenario: Isolated linker: fresh install, cold cache + cold store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 2.4170690023200003,
"stddev": 0.010717655368423397,
"median": 2.4141273938200003,
"user": 1.4947835799999998,
"system": 1.5134448399999998,
"min": 2.40211941082,
"max": 2.4338749008200002
},
{
"command": "pacquet@main",
"mean": 2.41717433892,
"stddev": 0.0171826933217038,
"median": 2.41810748332,
"user": 1.5094628799999998,
"system": 1.4483769399999997,
"min": 2.38862093582,
"max": 2.44054902882
},
{
"command": "pnpr@HEAD",
"mean": 1.4869453900200003,
"stddev": 0.12442596307839605,
"median": 1.4737716283200002,
"user": 0.98399518,
"system": 1.17203804,
"min": 1.34799328682,
"max": 1.67687714082
},
{
"command": "pnpr@main",
"mean": 1.48721368542,
"stddev": 0.13355862164647073,
"median": 1.47687446132,
"user": 0.9908628799999999,
"system": 1.1779539399999996,
"min": 1.35328007282,
"max": 1.72713457882
}
]
}Scenario: Isolated linker: fresh install, hot cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.44030454607999997,
"stddev": 0.006943621026058297,
"median": 0.43844779798000005,
"user": 0.67114084,
"system": 1.08355224,
"min": 0.42834474398000005,
"max": 0.44923216698
},
{
"command": "pacquet@main",
"mean": 0.43437386188000005,
"stddev": 0.012873199282272197,
"median": 0.43208582698000003,
"user": 0.6697922399999999,
"system": 1.04997294,
"min": 0.41426061298000005,
"max": 0.45196701898
},
{
"command": "pnpr@HEAD",
"mean": 0.32681954698,
"stddev": 0.005496391527948576,
"median": 0.32587620948000007,
"user": 0.28387344,
"system": 0.7057271399999999,
"min": 0.32001439098,
"max": 0.34012826798
},
{
"command": "pnpr@main",
"mean": 0.32392705878000005,
"stddev": 0.005379359858989398,
"median": 0.32280926298,
"user": 0.27251284,
"system": 0.7028422400000001,
"min": 0.31705932998,
"max": 0.33589360298000004
}
]
}Scenario: Isolated linker: fresh install, cold cache + hot store
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 1.5592912608999998,
"stddev": 0.010168830952206697,
"median": 1.5604808372,
"user": 0.82274114,
"system": 1.04048806,
"min": 1.5423970437,
"max": 1.5707460427
},
{
"command": "pacquet@main",
"mean": 1.5567828567,
"stddev": 0.0207660630282995,
"median": 1.5543528047000001,
"user": 0.81219664,
"system": 1.0283898599999999,
"min": 1.5273600676999999,
"max": 1.5977214837
},
{
"command": "pnpr@HEAD",
"mean": 0.28875756790000007,
"stddev": 0.005667856038338556,
"median": 0.2874830962,
"user": 0.23198094,
"system": 0.58317376,
"min": 0.28166426370000003,
"max": 0.29701791670000005
},
{
"command": "pnpr@main",
"mean": 0.27697611590000004,
"stddev": 0.001874128797519461,
"median": 0.2769701832,
"user": 0.20634083999999997,
"system": 0.5374966600000001,
"min": 0.27327807870000004,
"max": 0.27941988070000007
}
]
}Scenario: Isolated linker: fresh resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.18652643143333333,
"stddev": 0.013179822905708332,
"median": 0.18338330430000002,
"user": 0.18891480000000002,
"system": 0.06941711333333335,
"min": 0.17214071830000002,
"max": 0.22175426730000003
},
{
"command": "pacquet@main",
"mean": 0.18548035673750002,
"stddev": 0.00671211072378268,
"median": 0.18393281030000003,
"user": 0.20199540000000002,
"system": 0.06331285499999999,
"min": 0.17850738530000002,
"max": 0.19963398930000004
},
{
"command": "pnpr@HEAD",
"mean": 0.08808798539677419,
"stddev": 0.0017230728899601487,
"median": 0.08786368230000001,
"user": 0.029066206451612904,
"system": 0.013893979999999995,
"min": 0.0851954363,
"max": 0.0922634183
},
{
"command": "pnpr@main",
"mean": 0.0894634628333333,
"stddev": 0.002339757767247016,
"median": 0.0892566363,
"user": 0.03070303333333333,
"system": 0.014736113999999998,
"min": 0.0843841833,
"max": 0.0938756033
}
]
}Scenario: Isolated linker: peer-heavy resolve, hot cache, offline
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.6262700780688888,
"stddev": 0.0928184020753005,
"median": 0.60694016218,
"user": 0.6570704577777778,
"system": 0.15498340444444442,
"min": 0.55069932818,
"max": 0.85159018818
},
{
"command": "pacquet@main",
"mean": 0.6065278308466666,
"stddev": 0.03996440341048497,
"median": 0.60542521118,
"user": 0.6209570133333333,
"system": 0.13934351555555555,
"min": 0.54661927118,
"max": 0.65337193218
},
{
"command": "pnpm@HEAD",
"mean": 2.9475249059577777,
"stddev": 0.07011763672685903,
"median": 2.93204620818,
"user": 4.608109235555555,
"system": 0.20873007111111114,
"min": 2.86834788118,
"max": 3.10610829418
}
]
}Scenario: Isolated linker: fresh restore, cold cache + cold store + cold pnpr
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 4.38153715892,
"stddev": 0.13299886470238254,
"median": 4.37474089712,
"user": 1.31355376,
"system": 1.52953744,
"min": 4.2330204576199995,
"max": 4.71154060862
},
{
"command": "pacquet@main",
"mean": 4.354568016719999,
"stddev": 0.11586275438615659,
"median": 4.30659745112,
"user": 1.2409782599999999,
"system": 1.4224502399999999,
"min": 4.24882235762,
"max": 4.618235621619999
},
{
"command": "pnpr@HEAD",
"mean": 3.4318550594200006,
"stddev": 0.08439190931703301,
"median": 3.41166380712,
"user": 1.1832973599999999,
"system": 1.2956545399999997,
"min": 3.34239069462,
"max": 3.62918334662
},
{
"command": "pnpr@main",
"mean": 3.42819198562,
"stddev": 0.09503199341193283,
"median": 3.3915758671200003,
"user": 1.16332916,
"system": 1.3093357399999999,
"min": 3.34551831262,
"max": 3.62396304762
}
]
}Scenario: GVS linker: fresh restore, hot cache + hot storeSame install as the isolated fresh-restore hot/hot scenario, into the shared virtual store, the layout pnpm 12 installs into by default. Scenarios run on separate machines, so compare main and branch within each table.
BENCHMARK_REPORT.json{
"results": [
{
"command": "pacquet@HEAD",
"mean": 0.10663901526,
"stddev": 0.0036636929990659576,
"median": 0.10644768190000001,
"user": 0.13090373999999996,
"system": 0.12525126,
"min": 0.1000804779,
"max": 0.11400707490000002
},
{
"command": "pacquet@main",
"mean": 0.106360959275,
"stddev": 0.0031610077715522765,
"median": 0.10612795190000002,
"user": 0.12911554666666666,
"system": 0.121069535,
"min": 0.10049600790000002,
"max": 0.1122823269
},
{
"command": "pnpr@HEAD",
"mean": 0.12087566512727271,
"stddev": 0.003136727454582909,
"median": 0.12168724990000002,
"user": 0.14302256181818176,
"system": 0.12942084181818184,
"min": 0.11531080290000001,
"max": 0.1266684779
},
{
"command": "pnpr@main",
"mean": 0.12295108432857144,
"stddev": 0.004261106634419389,
"median": 0.12298658390000002,
"user": 0.13999776095238095,
"system": 0.1378526123809524,
"min": 0.11725053490000001,
"max": 0.1374124589
}
]
} |
|
| Project | pnpm's project |
| Branch | pr/14872 |
| 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) |
|---|---|---|
| gvs-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 112.05 ms |
| isolated-linker.fresh-install.cold-cache.cold-store | 📈 view plot | 1,368.43 ms |
| isolated-linker.fresh-install.cold-cache.hot-store | 📈 view plot | 243.98 ms |
| isolated-linker.fresh-install.hot-cache.hot-store | 📈 view plot | 238.08 ms |
| isolated-linker.fresh-resolve.hot-cache.offline | 📈 view plot | 92.47 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store | 📈 view plot | 1,280.97 ms |
| isolated-linker.fresh-restore.cold-cache.cold-store.cold-pnpr | 📈 view plot | 3,340.44 ms |
| isolated-linker.fresh-restore.hot-cache.hot-store | 📈 view plot | 200.05 ms |
| isolated-linker.repeat-install.cold-cache.hot-store | 📈 view plot | 5.82 ms |
| isolated-linker.repeat-install.hot-cache.hot-store | 📈 view plot | 6.42 ms |
Cache debug and release directories explicitly so tar cannot include the lint library through their parent. Rotate workspace cache keys to avoid restoring older snapshots that contain a stale Perfectionist library.
|
Code review by qodo was updated up to the latest commit c238b8d |
Reuse install invocation, project selection, and importer peer options through their consumers. Share recursive run/exec arguments and mapping, archive and config-dependency store contexts, and Git source cache inputs. Related to #14562.
|
Code review by qodo was updated up to the latest commit 9158e61 |
PR Code Suggestions ✨Warning
No code suggestions found for the PR. |
…iling with 400 An upstream with search enabled made almost every npm search fail with 400 "refine the query": the guard refused whenever the upstream reported a total above 2000, and npmjs's loose full-text search reports five-digit totals for nearly any term (jquery 23k, even narrow hyphenated names 30k+ because the tokenizer matches each word). The page and result budgets now bound what pnpr actually downloads. A source small enough to exhaust keeps the deduplicated total exact, as before; a larger one is truncated after the budgeted pages and its unscanned remainder folds into total as an over-approximation. A huge from offset walks at most the same budget and returns an empty window instead of a 400. Review rounds folded in: every admitted source gets at least one fetch even when earlier sources spent the shared budgets, sized to the remaining result budget (down to a one-entry probe), so a source routed after a large one never vanishes from objects and total at once. Tests cover the starved second source, the upstream that reports results but returns an empty page (502), the upstream without a search endpoint (skipped), and pin the probe size. The README search section states the truncation contract and the fetch bounds precisely. Rebased onto main after the config routing refactor (#14872): test config access goes through config.routing.
…iling with 400 An upstream with search enabled made almost every npm search fail with 400 "refine the query": the guard refused whenever the upstream reported a total above 2000, and npmjs's loose full-text search reports five-digit totals for nearly any term (jquery 23k, even narrow hyphenated names 30k+ because the tokenizer matches each word). The page and result budgets now bound what pnpr actually downloads. A source small enough to exhaust keeps the deduplicated total exact, as before; a larger one is truncated after the budgeted pages and its unscanned remainder folds into total as an over-approximation. A huge from offset walks at most the same budget and returns an empty window instead of a 400. Review rounds folded in: every admitted source gets at least one fetch even when earlier sources spent the shared budgets, sized to the remaining result budget (down to a one-entry probe), so a source routed after a large one never vanishes from objects and total at once. Tests cover the starved second source, the upstream that reports results but returns an empty page (502), the upstream without a search endpoint (skipped), and pin the probe size. The README search section states the truncation contract and the fetch bounds precisely. Rebased onto main after the config routing refactor (#14872): test config access goes through config.routing.
Pin perfectionist to the merge containing too_many_struct_fields and configure max_fields = 8 with tests included. Refactor oversized internal state, options, and request structs across pnpm and pnpr. Group fields by responsibility, reuse existing context and policy types, and pass groups directly to the helpers consuming them. Use shorter field names inside their namespace and fetching for fetch settings. Update all callers, fixtures, and documentation links. Reuse install/project/peer groups through their consumers instead of reconstructing them. Share run/exec execution arguments and their mapping, existing archive/config-dependency store contexts, and GitSource cache inputs. Preserve owned versus borrowed representations where tasks need different lifetimes. Preserve fixed external configuration, serialized document, and binding interfaces with narrowly scoped expectations that identify the format. There are no legacy exemptions for ordinary internal structs. Cache workspace debug/release artifacts explicitly and rotate their cache namespace so old Perfectionist binaries cannot leak into CI after a pin change. Reproduced the cache inclusion with Actions glob settings and tar, and verified that the new paths exclude the lint library. Related to pnpm#14562.
Pin perfectionist to the merge containing too_many_struct_fields and configure max_fields = 8 with tests included. Refactor oversized internal state, options, and request structs across pnpm and pnpr. Group fields by responsibility, reuse existing context and policy types, and pass groups directly to the helpers consuming them. Use shorter field names inside their namespace and fetching for fetch settings. Update all callers, fixtures, and documentation links. Reuse install/project/peer groups through their consumers instead of reconstructing them. Share run/exec execution arguments and their mapping, existing archive/config-dependency store contexts, and GitSource cache inputs. Preserve owned versus borrowed representations where tasks need different lifetimes. Preserve fixed external configuration, serialized document, and binding interfaces with narrowly scoped expectations that identify the format. There are no legacy exemptions for ordinary internal structs. Cache workspace debug/release artifacts explicitly and rotate their cache namespace so old Perfectionist binaries cannot leak into CI after a pin change. Reproduced the cache inclusion with Actions glob settings and tar, and verified that the new paths exclude the lint library. Related to pnpm#14562.
Summary
Enforce an eight-field limit for Rust structs across pnpm and pnpr, including tests, using the merged
too_many_struct_fieldsrule from KSXGitHub/perfectionist#408.Refactor oversized internal structs throughout the workspace into groups with shared responsibilities, reuse those groups across callers, and move related behavior onto them. Nested fields use concise names such as
package.integrity,store.dir, andstore.index; fetch settings usefetching.Reuse install invocation, project-selection, and peer-policy groups through the install pipeline. Share recursive execution arguments between
runandexec, use existing store contexts in the CLI and tarball resolver, and passGitSourcedirectly to the checkout cache.Keep narrowly scoped, documented exceptions for structs that mirror fixed configuration, serialized formats, and binding interfaces. Document the convention in the Rust style guide.
Keep the CI workspace cache separate from the pinned lint-library cache. Explicit debug/release paths and a new cache namespace prevent stale Perfectionist libraries from being restored after a pin change.
Related to #14562.
Validation:
just ready(11,129 Rust tests passed, 13 skipped), strict workspace Dylint, private all-feature documentation, TypeScript compilation and linting, spelling, and TOML formatting.Squash Commit Body
Checklist
Written by an agent (Codex, GPT-6).
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.