Remove TestPileState #85
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?
Test infrastructure should never appear in final types, yet for some reason this appears in solitaire_core/src/klondike_adapter.rs GameState in the test_pile_state field.
Investigated — TestPileState does NOT appear in the final/production types. It's already correctly gated out.
test_pile_stateis#[cfg(feature = "test-support")], andtest-supportis a dev-only feature:solitaire_engine/solitaire_dataenable it in[dev-dependencies], not[dependencies].resolver = "2"(edition 2024), which isolates dev-dependency features from normal builds.cargo tree -p solitaire_app -i solitaire_core -e featuresshows the production app pullssolitaire_corewith only thedefaultfeature — notest-support.cargo build -p solitaire_appcompiles cleanly with no test-support (verified), so the field + everyset_test_*method are compiled out of the shipped binary. The lone production caller,has_test_pile_overrides(), has a#[cfg(not(feature="test-support"))]fallback returningfalse.So the field appears only in source (under the cfg gate) and during test builds — never in a final type.
Fully deleting it from source isn't viable: the ~91 test sites inject arbitrary hand-crafted boards (e.g. a lone 5♣ in Tableau1) that are unreachable by legal play, and the override is checked inside core's own pile-read methods (so the field must live on
GameState). Relocating that mechanism out of core is a large refactor for a field already absent from production.Recommend: close as 'already gated out of production'. Optional modest cleanup: move the
set_test_*impl block +TestPileStateinto a dedicated#[cfg(feature="test-support")]module to declutter game_state.rs (field stays on GameState; ~150 lines of setters move out).