diff --git a/tests/mutation_tests_stats_power_cut3.py b/tests/mutation_tests_stats_power_cut3.py index 47142254e..b4184918c 100644 --- a/tests/mutation_tests_stats_power_cut3.py +++ b/tests/mutation_tests_stats_power_cut3.py @@ -75,20 +75,26 @@ MUTATIONS: list[Mutation] = [ # --- Cut 3 verification bullet 3 (ยง0.5): "two ships with identical loadouts fitted in opposite equip order # --- get identical grants. That is the death of the hidden priority." The invariant that makes equip order - # --- unable to matter is that every consuming item reads back the SAME GrantRatio; restricting the write to - # --- only the first equipped consumer reintroduces exactly the "whoever equipped first" priority the cut - # --- kills, just relocated from SortPosition into this loop. --- + # --- unable to matter is that every consuming item reads back its own tier's GrantRatio; restricting the + # --- write to only the first draw found reintroduces exactly the "whoever equipped first" priority the cut + # --- kills, just relocated from SortPosition into this loop. + # --- + # --- F8 (docs/stats-and-power-cut.md, Soul pass 2026-09-19) re-anchor: Cut 3's own flat "write GrantRatio to + # --- every consumer" loop (Step) was replaced by Cut 5's tiered AllocateTiers, whose closing loop writes each + # --- draw's own tier ratio instead -- the anchor below follows that move; the rule and the test it's pinned + # --- against (EveryConsumingItemReadsTheSameGrantRatio, a single-tier fixture) are unchanged. --- Mutation( - rule="every consuming item must be written the same GrantRatio, not just the first one found", + rule="every consuming item must be written its own tier's GrantRatio, not just the first draw found", file="Assets/Scripts/ServerShared/PowerBus.cs", anchor=( - " foreach (var item in _entity.Equipment)\n" - " if (item.Behaviors.Any(b => b is IPowerConsumer))\n" - " item.PowerSupply = GrantRatio;" + " foreach (var draw in draws)\n" + " {\n" + " draw.Item.PowerSupply = ratios[draw.Tier];" ), mutated=( - " var firstConsumer = _entity.Equipment.FirstOrDefault(item => item.Behaviors.Any(b => b is IPowerConsumer));\n" - " if (firstConsumer != null) firstConsumer.PowerSupply = GrantRatio;" + " foreach (var draw in draws.Take(1))\n" + " {\n" + " draw.Item.PowerSupply = ratios[draw.Tier];" ), test="PowerBusTests.EveryConsumingItemReadsTheSameGrantRatio", expect="red", diff --git a/tests/mutation_tests_stats_power_cut4.py b/tests/mutation_tests_stats_power_cut4.py index ea6b0c92a..e61f973f1 100644 --- a/tests/mutation_tests_stats_power_cut4.py +++ b/tests/mutation_tests_stats_power_cut4.py @@ -116,12 +116,19 @@ MUTATIONS: list[Mutation] = [ # --- Shield is the map's named exception: a hit is not a chosen activation, so its reserve is a continuous # --- one that may absorb an arbitrary fraction of a hit's cost, unlike a weapon's shot (always spent # --- whole). Requiring a hit to cover the WHOLE reserve before absorbing anything collapses that - # --- distinction back into an activation buffer, which the map explicitly says not to give it. --- + # --- distinction back into an activation buffer, which the map explicitly says not to give it. + # --- + # --- F8 (docs/stats-and-power-cut.md, Soul pass 2026-09-19) re-anchor: the shield reserve ruling + # --- (2026-09-19) gave Shield a Broken state, splitting CanTakeHit's old single-expression body + # --- (`return Item == null || _reserve.CanSpend(...)`) into an Item-null check, a Broken check, and this + # --- CanSpend call as its own line; F5 (the same Soul pass) then made the whole method a pure query. The + # --- rule under test -- CanSpend reads the hit's own cost, not a full-reserve requirement -- is unchanged + # --- and still reachable from this same line. --- Mutation( rule="the shield reserve must allow a partial draw, not require a full reserve before absorbing a hit", file="Assets/Scripts/ServerShared/Behaviors/Shield.cs", - anchor=" return Item == null || _reserve.CanSpend(damage * EnergyUsage);", - mutated=" return Item == null || _reserve.CanSpend(_reserve.Capacity);", + anchor=" return _reserve.CanSpend(damage * EnergyUsage);", + mutated=" return _reserve.CanSpend(_reserve.Capacity);", test="InputCapacitorTests.ShieldReserveAllowsAPartialDrawButRefusesAHitItCannotFullyCover", expect="red", ),