Remove unused distribution_mode field from Scenario #61
Loading…
Reference in a new issue
No description provided.
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?
Context
Scenario.distributionMode(enumApp\Enum\DistributionMode= EVEN | PRIORITY) is stored but unused. It has a DB column, a typed property, getter, setter — but nothing reads it:getDistributionMode()is called only by its own persistence test, never by any service.EvenSplitter,AllocateIncome,PreviewProcessor) hardcodes even-splitting and does not branch on the scenario's mode. The test comment attests/Service/Allocation/AllocateIncomeTest.php:17confirms it: "preview()no longer accepts aDistributionModeparameter at all."It was a placeholder for a PRIORITY distribution strategy that was never wired in. Discovered while scoping #58 (scenario create-from-UI). Removing it now — before the SPA is built against the schema — is the cheapest moment, and avoids the create form exposing a meaningless picker.
Scope
distributionModeproperty, getter, setter, and theuse App\Enum\DistributionMode;import fromsrc/Entity/Scenario.php.src/Enum/DistributionMode.php(no remaining references after this ticket).DROP COLUMN distribution_modefrom thescenariotable. Leave the historicalVersion20260618213556.php(which created the column) untouched. CS-fix the generated migration (php-cs-fixer stripsdeclare(strict_types=1)).setDistributionMode(...)calls + now-unused imports):tests/Service/Allocation/AllocateIncomeTest.php:480tests/Service/Allocation/ResultTest.php:82tests/Entity/ScenarioPersistenceTest.php::testDistributionModeDefaultsToEvenWhenNotExplicitlySettests/Entity/ScenarioPersistenceTest.php::testItRoundTripsAnExplicitlySetPriorityDistributionModeDistributionModeassertions intests/Enum/RemainingEnumsTest.php(lines 26–27 + import)Acceptance
distributionMode/DistributionMode/distribution_modeanywhere insrc/,tests/, orconfig/.POST /api/scenarioscreate contract unaffected (name required, description optional) — verified by #58's characterization tests.Notes
Resolved in
e563816(onrelease/v0.3.0).Removed the dead
Scenario.distributionModefield — stored but never read (the allocation engine hardcodes even-splitting;getDistributionMode()was only called by its own tests). Done as one atomic commit (entity + enum + migration + tests must move together to stay bisect-safe — the entity/schema mismatch breaks inserts otherwise):src/Entity/Scenario.php; deletedsrc/Enum/DistributionMode.php.Version20260627065959—DROP distribution_mode(down() re-adds it, with an empty-table-assumption comment).ScenarioPersistenceTest, 2 enum assertions fromRemainingEnumsTest, and vestigialsetDistributionMode()fixture calls fromAllocateIncomeTest/ResultTest.Gotcha captured in PLATFORM.md: removing an
#[ApiResource]property needs acache:clear(stale API Platform metadata →NoSuchPropertyException→ 500 on GET) and the test DB needs the migration run manually (it persists between runs).195 tests green, php-cs-fixer + PHPStan level 6 clean. pr-reviewer: Approve, 0 must-fix.