Cut 11.3: fix the degenerate fixtures that made mutants indistinguishable

Most of Stryker's surviving mutants in FireControl.cs traced to a handful of
fixture constants that make a mutant compute exactly the same number as the
original -- the same defect class as the zero-velocity target and the damage
that happened to equal an item's durability, found here as a pattern.

- The kernel fixture's shooter sat at float3.zero, where `target - source` and
  `target + source` are the same vector. HitProbabilityMatchesInspect gains a
  configuration with the shooter far from the origin: the correct separation is
  500, in range; the mutated sum is 1300, out of range.
- The kernel fixture's Resolution was 1000, which saturates pSensor to exactly 1
  above the detection threshold, so multiplying and dividing by it agreed. Now 2.
- EvasionCountsUntilCommitAndNotAfter fired at zone time 0, so `now - FireTime`
  equalled `now + FireTime`. Cut 5 gave this test a moving target to defend its
  own declared mutation and it still survived; the clock now advances first.
- Every fixture used zero spread and a cell size of 1, leaving the whole spread
  term untested. PSpreadIsTheSilhouettesShareOfTheSpreadCone pins what pSpread
  means -- a silhouette filling the cone scores 1, half the cone scores .5, and
  a bigger one saturates -- rather than how it is computed.

Triaged as equivalent, not chased: the float-threshold boundary flips, and the
three MixSeed mutants that turn a right shift left -- measured, the die stays
fair under all three (worst deviation from p .017-.030 against .022 correct), so
killing them would mean pinning the mixer's bit arithmetic, not its behaviour.

Recorded, not fixed: FireControl.Apply's derivation of hitDirection from the two
positions has no geometry test through the FireControl path, and
StatResolverTests.AModifierThatTargetsItsOwnMagnitudeStatIsRefusedAtEquip fails
intermittently in the full suite -- likely cross-class pollution through
CultCache's process-wide document registry.

241 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-22 16:20:45 +02:00
commit 1b187db45b
3 changed files with 52 additions and 7 deletions

View file

@ -375,6 +375,11 @@ public sealed class FireAuthorityTests : IDisposable
// tracking needed -- makes the mutation observable even with no jink at all: the mutant
// mispredicts the intercept by Velocity * CommitHorizon, which the post-commit-jink assertion
// below (expected to still hit) catches as a spurious miss.
// Cut 11: advance the zone clock before firing. Build leaves it at 0, so every shot fired with
// FireTime = 0 -- and `now - FireTime` equals `now + FireTime` when FireTime is 0. That is why the
// moving target Cut 5 added still left this test's own declared mutation (measure elapsed wrongly)
// alive: Stryker found `now + shot.FireTime` surviving.
e.Zone.Update(2.5f);
e.Target.Velocity = float2(4, 0);
FireControl.Fire(e.Weapon, e.WeaponItem, e.Shooter);
var t = 0f;

View file

@ -34,7 +34,7 @@ public sealed class FireControlCut11Tests : IDisposable
Directory.Delete(_root, true);
}
private static GameplaySettings TestSettings() => new GameplaySettings
private static GameplaySettings TestSettings(float schematicCellSize = 1f) => new GameplaySettings
{
DefaultEntitySettings = new EntitySettings(),
Tiers = new[] { new RarityTier { Name = "Common", Quality = .5f, Rarity = 0, Color = new float3(1, 1, 1) } },
@ -44,7 +44,7 @@ public sealed class FireControlCut11Tests : IDisposable
TargetGearInfoThreshold = .8f,
FiringArc = 170,
CommitHorizon = .5f,
SchematicCellSize = 1f,
SchematicCellSize = schematicCellSize,
UnaidedAccuracy = .05f,
UnaidedTracking = 10f,
UnaidedPrecision = 2f,
@ -79,7 +79,7 @@ public sealed class FireControlCut11Tests : IDisposable
string zoneName = "Cut11",
float damage = 5, float velocity = 0, float accuracy = 1,
bool equipShield = false, float shieldCapacity = 30,
bool markers = false)
bool markers = false, float spread = 0, float schematicCellSize = 1f)
{
// 5 wide x 3 tall: schematic x runs port (0) to starboard (4). Tool gear may only occupy interior
// cells, which on this hull is the middle row x = 1..3, so the markers sit at (1, 1) and (3, 1) --
@ -101,7 +101,7 @@ public sealed class FireControlCut11Tests : IDisposable
Behaviors = { new InstantWeaponData
{
Damage = Constant(damage), Range = Constant(1000), MinRange = Constant(0),
Velocity = Constant(velocity), Spread = Constant(0), DamageSpread = Constant(0),
Velocity = Constant(velocity), Spread = Constant(spread), DamageSpread = Constant(0),
Penetration = Constant(0), Count = Constant(1), BurstTime = Constant(0), Cooldown = Constant(1000),
DamageCurve = new BezierCurve { Keys = new[] { float4(0, 1, 0, 0), float4(1, 1, 0, 0) } }
} }
@ -136,7 +136,7 @@ public sealed class FireControlCut11Tests : IDisposable
var ledger = new ProvenanceLedger();
for (var i = 1; i <= 16; i++) ledger.Lots[i] = new Lot { Origin = new Attributed(), Quality = 1 };
var items = new ItemManager(cache, ledger, TestSettings(), _ => { });
var items = new ItemManager(cache, ledger, TestSettings(schematicCellSize), _ => { });
var zone = new Zone(items, new PlanetSettings(), new ZonePack(), new GalaxyZone { Name = zoneName, Owner = null }, null);
EquippableItem Make(string name, int lot, float durability) => new EquippableItem
@ -317,6 +317,32 @@ public sealed class FireControlCut11Tests : IDisposable
}
}
// ---- pSpread is the share of the spread cone the target's silhouette covers. ----
// Every earlier fixture used zero spread (pSpread is then 1 regardless) and a cell size of exactly 1 (so
// multiplying and dividing by it agree), which left the whole spread term untested. This pins what the
// number MEANS rather than how it is computed: a silhouette that exactly fills the cone scores 1, one half
// the cone's angular size scores .5, and one bigger than the cone saturates at 1. Here the 5-wide hull at a
// cell size of 2 has a half-extent of 5 world units, against a 10-degree cone (5-degree half-angle).
[Fact]
public void PSpreadIsTheSilhouettesShareOfTheSpreadCone()
{
const float halfExtent = 5f, halfCone = 5f;
float At(float range)
{
var e = Build(spread: 2 * halfCone, schematicCellSize: 2f);
e.Target.Position = e.Shooter.Position + float3(0, 0, range);
return FireControl.Inspect(e.Weapon, e.Shooter, e.Target).PSpread;
}
var fills = halfExtent / (float) Math.Tan(halfCone * Math.PI / 180); // silhouette == cone
var half = halfExtent / (float) Math.Tan(halfCone / 2 * Math.PI / 180); // silhouette == half the cone
Assert.Equal(1f, At(fills), 2);
Assert.Equal(.5f, At(half), 2);
Assert.Equal(1f, At(fills / 3), 2); // bigger than the cone: saturates, never exceeds 1
Assert.True(At(half * 2) < At(half)); // and falls away with range
}
// ---- Zones roll differently. ----
// The roll is a function of (zone, shot id). Replacing `CombatSeed *` with `/` in Commit's seed drops the

View file

@ -285,7 +285,10 @@ public sealed class FireControlCut9Tests : IDisposable
MinimumTemperature = -1000, MaximumTemperature = 1000, OptimalTemperature = 0, PlateauWidth = 2000,
Behaviors = { new TargetingSystemData
{
Accuracy = Constant(1f), Resolution = Constant(1000f), Precision = Constant(precision), Tracking = Constant(100000f)
// Cut 11: a finite Resolution, so pSensor actually varies with info. At 1000 it saturated to exactly 1
// for any info above the detection threshold, which made `x * pSensor` and `x / pSensor` the same
// number and let a mutant of Inspect's product survive HitProbabilityMatchesInspect.
Accuracy = Constant(1f), Resolution = Constant(2f), Precision = Constant(precision), Tracking = Constant(100000f)
} }
});
cache.FlushAsync().Wait();
@ -418,6 +421,17 @@ public sealed class FireControlCut9Tests : IDisposable
Check("behind the mount");
e.Target.Position = float3(0, 0, 100);
// Cut 11: a shooter far from the origin. Every other configuration keeps the shooter at float3.zero,
// where `target - source` and `target + source` are the same vector; here the correct separation is
// 500 (in range) while the mutated sum is 1300 (out of range), so a sign mutant in either caller's
// bearing makes the two disagree.
var home = e.Shooter.Position;
e.Shooter.Position = float3(600, 0, 0);
e.Target.Position = float3(600, 0, 500);
Check("shooter far from the origin");
e.Shooter.Position = home;
e.Target.Position = float3(0, 0, 100);
e.Shooter.VisibleEntities.Remove(e.Target);
Check("not visible");
@ -425,7 +439,7 @@ public sealed class FireControlCut9Tests : IDisposable
var nullHud = FireControl.Inspect(e.Weapon, e.Shooter, null).PBase;
Assert.True(nullHot == nullHud, $"no target: {nullHot} != {nullHud}");
}
Assert.Equal(21, checkedConfigurations); // 3 precisions x (4 info levels + out of range + behind + not visible)
Assert.Equal(24, checkedConfigurations); // 3 precisions x (4 info levels + out of range + behind + far shooter + not visible)
}
// The cost regression itself. A target out of range is the common case for every AI and turret, and it