From c6bc2bf7ebfefba57694f3411673af2079fe4a8c Mon Sep 17 00:00:00 2001 From: Erik Date: Sun, 9 Aug 2026 20:00:42 +0200 Subject: [PATCH] =?UTF-8?q?test(streaming):=20fix=20#351=20=E2=80=94=20the?= =?UTF-8?q?=20Debug-only=20FarLoad=20strip-test=20failure=20was=20the=20de?= =?UTF-8?q?liberate=20near-payload=20Debug.Assert,=20not=20a=20flake?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test feeds a far-tier factory returning Near payload on purpose to prove the strip safety net. LandblockStreamer.HandleJob is documented "fail loud in Debug builds and strip in Release": the Debug.Assert fires on exactly that input, the VSTest host translates it into a thrown DebugAssertException, and the worker catch folds it into a Failed completion — deterministic on every Debug run since the test and the tripwire landed in the same commit (090b0354). Release compiles the assert out ([Conditional("DEBUG")]), so the strip runs and the test passed there, which is why the Release gate never saw it. The test now pins BOTH halves of the config-divergent contract via "#if DEBUG": Debug expects the loud Failed carrying the assert text, Release keeps the strip assertions. Production code unchanged. LandblockBuildOriginTests 11/11 in Debug AND Release. Co-Authored-By: Claude Fable 5 --- .../Streaming/LandblockBuildOriginTests.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/AcDream.App.Tests/Streaming/LandblockBuildOriginTests.cs b/tests/AcDream.App.Tests/Streaming/LandblockBuildOriginTests.cs index 1de0a773..678a5452 100644 --- a/tests/AcDream.App.Tests/Streaming/LandblockBuildOriginTests.cs +++ b/tests/AcDream.App.Tests/Streaming/LandblockBuildOriginTests.cs @@ -221,6 +221,21 @@ public sealed class LandblockBuildOriginTests origin)); streamer.Start(); +#if DEBUG + // The near-payload tripwire is config-divergent by design ("fail loud + // in Debug builds and strip in Release" — LandblockStreamer.HandleJob): + // in Debug the Debug.Assert fires and the VSTest host translates it + // into a thrown DebugAssertException, which the worker's catch folds + // into a Failed completion (#351). + var failed = Assert.IsType( + await DrainFirstAsync(streamer)); + + Assert.Contains( + "Far-tier factory returned Near payload", + failed.Error, + StringComparison.Ordinal); + Assert.Equal(84ul, failed.Generation); +#else var loaded = Assert.IsType( await DrainFirstAsync(streamer)); @@ -229,6 +244,7 @@ public sealed class LandblockBuildOriginTests Assert.Same(PhysicsDatBundle.Empty, loaded.Landblock.PhysicsDats); Assert.Null(loaded.Build.EnvCells); Assert.Equal(origin, loaded.Build.Origin); +#endif } [Fact]