MiningCut3Tests: ChunkInfo's pinned bits are per host class; the Linux bits are the base's own

ChunkInfoIsBitIdenticalToItsValueBeforeTheExtraction never passed on Linux: at c86f28e93 (the commit that added it) it already measures 1039274088 for the second observer where the recording says 1039274086, and base 12dfcef5, the code the recording claims to be taken from, measures the same ...088 on Linux (CultMath 0.4.1 and 0.5.0 alike). The sensor's bearing term (acos, curve) is libm arithmetic, which rounds differently on Windows, where the recording was made. It is a host-class recording read as universal, not a regression: no commit moved it.

The pin is now per host class like the two-AI digest (ruling replays-per-host-class): windows-x64 keeps the original recording, linux-x64 is base 12dfcef5 run on Linux, and the current code equals it. A host with no recording fails and prints its bits. RunStartTests.HostClass is now internal, the one host-class name.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Nibu 2026-11-11 05:06:09 +00:00
commit b2a2da9d27
2 changed files with 15 additions and 5 deletions

View file

@ -255,7 +255,7 @@ public sealed partial class RunStartTests
Assert.Equal(first.digest, second.digest);
}
private static string HostClass() =>
internal static string HostClass() =>
(RuntimeInformation.IsOSPlatform(OSPlatform.Linux) ? "linux"
: RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "windows"
: RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? "osx" : "other")

View file

@ -308,9 +308,17 @@ public sealed partial class MiningCut3Tests : IDisposable
// ChunkInfo's value is not changed by moving its arithmetic under PassiveInfo: six observers at different
// places and bearings, one with a second sensor so the average is live, read the same chunk, and every value
// matches the bits recorded at base 12dfcef5, before the extraction (a different order of the multiplication
// by the chunk's brightness moves them in the last bits).
private static readonly uint[] ChunkInfoAtBase = new uint[] { 1045120030u, 1039274086u, 1030543422u, 1029120970u, 1036363351u, 1035122917u };
// matches the bits the code before the extraction (base 12dfcef5) gives on the same host class (a different order of
// the multiplication by the chunk's brightness moves them in the last bits). The bits are per host class because
// the sensor's bearing term (acos, curve) is libm arithmetic, which rounds differently on Windows and Linux; replays
// are trusted only on the host class that recorded them (ruling replays-per-host-class). windows-x64 is the recording the
// test was written with; linux-x64 is base 12dfcef5 run on Linux, which gives 1039274088 where Windows gave 1039274086 for
// the second observer, and the current code gives the same bits as that base.
private static readonly System.Collections.Generic.Dictionary<string, uint[]> ChunkInfoAtBase = new()
{
["windows-x64"] = new uint[] { 1045120030u, 1039274086u, 1030543422u, 1029120970u, 1036363351u, 1035122917u },
["linux-x64"] = new uint[] { 1045120030u, 1039274088u, 1030543422u, 1029120970u, 1036363351u, 1035122917u },
};
[Fact]
public void ChunkInfoIsBitIdenticalToItsValueBeforeTheExtraction()
@ -329,7 +337,9 @@ public sealed partial class MiningCut3Tests : IDisposable
Assert.All(values, v => Assert.InRange(v, 1e-4f, .99f)); // a live, unsaturated reading at every place
var actual = values.Select(Bits).ToArray();
Assert.True(actual.SequenceEqual(ChunkInfoAtBase), "ChunkInfo bits: " + string.Join(",", actual));
var host = RunStartTests.HostClass();
Assert.True(ChunkInfoAtBase.TryGetValue(host, out var pinned), $"ChunkInfo bits: host class {host} has no recording; measured " + string.Join(",", actual));
Assert.True(actual.SequenceEqual(pinned), $"ChunkInfo bits on {host}: " + string.Join(",", actual) + " pinned " + string.Join(",", pinned));
}
// A chunk outside every sun's light is dark: no visibility, no info, and it cannot be picked, while a lit