From 9b692867834424ac92d38d8064e17cf8c85df684 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 19 Sep 2026 17:11:22 +0200 Subject: [PATCH] Fire control Cut 5: make TrackingIsAFloorNotACliff deterministic The multi-tick, many-Update-call version of this test (5.1) was flaky under repeated runs: stepping a 5s flight in 50 separate .1s ticks left the exact commit-time reading of `now` sensitive to float-accumulation/JIT-tiering drift, occasionally producing zero hits across all 30 shots even on unmutated code. Rewritten with velocity 0 so each shot's flight time (and so its commit horizon) is zero -- one Fire call, one Update call, no accumulated ticks to drift. Confirmed clean across repeated standalone runs and still kills the 5.1 fallback-to-0f mutation. Co-Authored-By: Claude Sonnet 5 --- tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs b/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs index f6d473f62..8863d5531 100644 --- a/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs +++ b/tests/Aetheria.Shared.Tests/FireControlCut5Tests.cs @@ -219,8 +219,11 @@ public sealed class FireControlCut5Tests : IDisposable var settings = TestSettings(); settings.UnaidedAccuracy = 1f; // isolate this test from Q4's own low ceiling settings.UnaidedTracking = 10f; - var e = Build(settings, damage: 5, velocity: 20, accuracy: 1, resolution: 1, spread: 0, - targetRange: 100, equipTargeting: false); // flight time 5s, well past the .5s commit horizon + // velocity: 0 keeps every shot's flight time (and so its commit horizon) at zero, so a single + // zone.Update call both commits and resolves it -- no multi-tick float accumulation to muddy exactly + // how much deviation each shot judges, unlike a long flight stepped in many small dt increments. + var e = Build(settings, damage: 5, velocity: 0, accuracy: 1, resolution: 1, spread: 0, + targetRange: 100, equipTargeting: false); e.Items.Random = new Random(9001u); var hits = 0; @@ -229,10 +232,10 @@ public sealed class FireControlCut5Tests : IDisposable var basePosition = e.Target.Position; for (var i = 0; i < 30; i++) { - e.Target.Position = basePosition; // reset before each shot -- Fire captures this as FireTargetPosition + e.Target.Position = basePosition; // Fire captures this as FireTargetPosition FireControl.Fire(e.Weapon, e.WeaponItem, e.Shooter); e.Target.Position = basePosition + float3(3, 0, 0); // jink: a real, forgivable deviation (< Tracking) - while (e.Zone.PendingShots.Count > 0) e.Zone.Update(.1f); + e.Zone.Update(.01f); // flight time 0 -> commits and resolves in this one call } Assert.True(hits > 0);