From 2c1480ad71340e7a1b787acd0efb079f718cbcb3 Mon Sep 17 00:00:00 2001 From: Eli Pinkerton Date: Wed, 14 Oct 2026 21:50:42 +0000 Subject: [PATCH] Fix performance baseline enum and naming contracts The full EditMode gate fails because the baseline driver uses a valid zero phase and one test expects a per-item suffix instead of the fixture cycle. Reserve an obsolete zero sentinel, move the explicitly initialized Idle state to 8, retain other ordinals, and test cycle boundaries through index 9999. These phases are not serialized. Reproduced both failures on Unity 6000.5.2f1, Windows. After repair: focused baseline 23/23, enum 1/1, full EditMode 390/390, PlayMode 15/15. CSharpier, fast check, full local gate and npm pack dry run pass. The gate selects affected surfaces and skips unchanged harness and payload checks. No 10k timing claim is made. Fixes #240. Refs #114, #226. --- Tests/Editor/PerfBaseline.cs | 20 ++++++++++++-------- Tests/Editor/PerfBaselineTests.cs | 15 +++++++++------ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/Tests/Editor/PerfBaseline.cs b/Tests/Editor/PerfBaseline.cs index 441de1e..f5b4b4b 100644 --- a/Tests/Editor/PerfBaseline.cs +++ b/Tests/Editor/PerfBaseline.cs @@ -950,14 +950,18 @@ internal RunState(string outputDirectory) private enum Phase { - Idle, - WaitingColdReady, - InteractionSamples, - WaitingSearchResults, - WarmOpen, - WaitingWarmReady, - BetweenWarmRepetitions, - Finished, + [Obsolete("Please use a valid value")] + None = 0, + + // RunState explicitly initializes Idle; phases are never persisted. + Idle = 8, + WaitingColdReady = 1, + InteractionSamples = 2, + WaitingSearchResults = 3, + WarmOpen = 4, + WaitingWarmReady = 5, + BetweenWarmRepetitions = 6, + Finished = 7, } } } diff --git a/Tests/Editor/PerfBaselineTests.cs b/Tests/Editor/PerfBaselineTests.cs index 0803556..fc0dc12 100644 --- a/Tests/Editor/PerfBaselineTests.cs +++ b/Tests/Editor/PerfBaselineTests.cs @@ -71,13 +71,16 @@ public void ShouldEscapeJsonStrings(string input, string expected) Assert.AreEqual(expected, PerfBaseline.JsonEscape(input)); } - [Test] - public void ShouldNameFixturesDeterministically() + [TestCase(0, "Player Save")] + [TestCase(7, "Damage Table")] + [TestCase(8, "Player Save 000001")] + [TestCase(9, "World Settings 000001")] + [TestCase(15, "Damage Table 000001")] + [TestCase(16, "Player Save 000002")] + [TestCase(9999, "Damage Table 001249")] + public void ShouldNameFixturesDeterministically(int index, string expected) { - Assert.AreEqual("Player Save", PerfBaseline.FixtureName(0)); - Assert.AreEqual("Damage Table", PerfBaseline.FixtureName(7)); - Assert.AreEqual("Player Save 000001", PerfBaseline.FixtureName(8)); - Assert.AreEqual("World Settings 000002", PerfBaseline.FixtureName(9)); + Assert.AreEqual(expected, PerfBaseline.FixtureName(index)); } [Test]