test(streaming): fix #351 — the Debug-only FarLoad strip-test failure was the deliberate near-payload Debug.Assert, not a flake

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 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-09 20:00:42 +02:00
parent 6bb4cfa795
commit c6bc2bf7eb

View file

@ -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<LandblockStreamResult.Failed>(
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<LandblockStreamResult.Loaded>(
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]