refactor(engine): split oversized plugin modules (card_plugin 4.1k lines, hud/settings 3.5k+) #118
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Severity: Low (maintainability / refactor)
Problem
Several
solitaire_engineplugin modules have grown past the point of comfortable navigation and review (line counts include their in-file test modules):solitaire_engine/src/card_plugin.rssolitaire_engine/src/hud_plugin.rssolitaire_engine/src/settings_plugin.rssolitaire_engine/src/game_plugin.rssolitaire_engine/src/input_plugin.rsThe
card_animation/directory already demonstrates the target shape: a module directory with focused submodules (interaction.rs,tuning.rs,mod.rs) and a separatetests.rs(asreplay_overlay/does).Suggested approach
Incrementally, one file per PR, no behaviour change:
#[cfg(test)] mod testsblock into a siblingtests.rs(biggest single win — e.g. much ofcard_plugin.rsis tests).card_plugin, band/buttons/toasts forhud_plugin, sections forsettings_plugin).Keep the single-responsibility system rule from CLAUDE.md §3.1 as the seam guide.
Found during scripted repo review (
rsoutline/wcpass), 2026-07-06.Tests-extraction phase complete (PRs #124, #125): all five oversized files are now module directories with tests in sibling tests.rs files. Runtime line counts after extraction: card_plugin 2,536 / settings_plugin 2,857 / hud_plugin 2,725 / input_plugin 1,832 / game_plugin 1,310. Remaining work on this issue: split the runtime code along system boundaries (spawn/layout/interaction for card_plugin; band/buttons/toasts for hud_plugin; sections for settings_plugin).
settings_plugin runtime split merged (PR #127): mod.rs 561 / input.rs 632 / updates.rs 495 / ui.rs 1,231. Remaining: hud_plugin (2,725) and card_plugin (2,536) runtime splits; game_plugin (1,310) and input_plugin (1,832) are now within reasonable size and may not need further splitting.