From 619d4a8665911b977d16a1fee7e86dd674ff00db Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Fri, 20 Nov 2026 07:40:48 +0100 Subject: [PATCH] Tests: the one-way chamber ticks a second past the mend, so both the Brain gate and Disabled are pinned Reverting the withdraw gate to WillBroken switched back only DeliberateLatency (10 ticks) after the mend, so a test that stopped at the first mended tick missed it; both mutants (gate and Disabled to WillBroken) now fail. BodyPainBox's comment states the real reason its first break is the only one: the withdraw pose is terminal and nothing moves the hand back. Co-Authored-By: Claude Sonnet 5.5 --- src/BadDay.Ymir/BodyPainBox.cs | 1 + tests/BadDay.Tests/Program.cs | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/BadDay.Ymir/BodyPainBox.cs b/src/BadDay.Ymir/BodyPainBox.cs index 7e04122..3cc4ff3 100644 --- a/src/BadDay.Ymir/BodyPainBox.cs +++ b/src/BadDay.Ymir/BodyPainBox.cs @@ -194,6 +194,7 @@ public sealed class BodyPainBoxSession : IDisposable _hand = sample; if (!ticked) return; + // The first break is the only one this run sees: the withdraw pose is terminal (the goal gates on Breaks and is involuntary for good) and nothing moves the hand back into the box, so the will cannot be pushed to a second break here. PainBoxSession, which can be ticked through a mend, guards its own. if ((events & TickEvents.WillBroke) != 0) _breakTick = tick; bool inBox = sample.InBox; diff --git a/tests/BadDay.Tests/Program.cs b/tests/BadDay.Tests/Program.cs index 88dfff5..d8ae4bf 100644 --- a/tests/BadDay.Tests/Program.cs +++ b/tests/BadDay.Tests/Program.cs @@ -248,10 +248,20 @@ public static class Program break; } Check(mended && session.Actor.Drive.Breaks > 0, "the will never mended: the test no longer exercises the rule"); - // The box goes off at the tick of the mend: the will no longer reads broken, and a reader that asked WillBroken would call the run a disabled box with the will intact. + // A second past the mend: a withdraw gate that read WillBroken would switch back after DeliberateLatency (10 ticks), so stopping at the first mended tick cannot see it. + for (int i = 0; i < 100; i++) + { + session.Tick(point, point, point, strengths, targets); + Check(session.Actor.GoalIndex == ChamberBrain.WithdrawIndex && !session.Actor.Drive.WillBroken, $"the goal left Withdraw {i} ticks after the will mended"); + } + // The box goes off with the will mended: a reader that asked WillBroken would call the run a disabled box with the will intact. session.SwitchOff(); - Check(!session.BoxOn && !session.Disabled(), "a box going off the moment of the mend ended the run as a disabled box"); - Check(session.Actor.GoalIndex == ChamberBrain.WithdrawIndex, "the goal left Withdraw as the box went off"); + Check(!session.BoxOn && !session.Disabled(), "a box going off after the mend ended the run as a disabled box"); + for (int i = 0; i < 100; i++) + { + session.Tick(point, point, point, strengths, targets); + Check(session.Actor.GoalIndex == ChamberBrain.WithdrawIndex, $"the goal left Withdraw {i} ticks after the box went off"); + } }), ("pain box: a break after a mend is a row, not the time to break: the result's break is the first one and never after the run's end", () =>