From d10689d10ff111980bac98c0a062b47e3185c750 Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 15:48:25 +0800 Subject: fix(headless): worldDigest 规范化恢复性能基线字节口径 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 快照与存档版本头/sh与边界 token 解耦:WorldDigestOfText 先把 V2 存档剥出正文并重建 LV_WORLD_SAVE_V1 常量语义再 SHA256;digest 只绑定模拟状态;新增 WorldDigestIsCanonical 同 V1/V2 双读路径 digest 相等回归;--performance-baseline 3 次独立运行 final_digest 复回 953775FAEB2F…(与历史基线逐字节一致),证据在 artifacts/perf-independent/新时间戳/README。 --- src/LivingVillage.Desktop.Tests/PrototypeTests.fs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/LivingVillage.Desktop.Tests') diff --git a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs index dc1414a..bf8fa82 100644 --- a/src/LivingVillage.Desktop.Tests/PrototypeTests.fs +++ b/src/LivingVillage.Desktop.Tests/PrototypeTests.fs @@ -1,6 +1,7 @@ namespace LivingVillage.Desktop.Tests open System +open LivingVillage.Headless open System.IO open Microsoft.Xna.Framework open Microsoft.VisualStudio.TestTools.UnitTesting @@ -869,6 +870,23 @@ type PrototypeTests () = CollectionAssert.AreEqual(characters, manifestLines |> Array.map (fun line -> line.[0])) Assert.IsTrue(File.Exists(runtimeAssetPath ()), sprintf "Missing atlas PNG: %s" (runtimeAssetPath ())) + [] + member _.WorldDigestIsCanonicalAcrossSaveFormatVersions () = + // The digest must bind to simulation state only: a world presented as a + // legacy V1 save text and as the new V2 save text must share one digest. + let world = Sim.initialWorldN (uint64 42) 4 + let v2Text = WorldSave.save world + + let firstPipe = v2Text.IndexOf('|') + let secondPipe = v2Text.IndexOf('|', firstPipe + 1) + let thirdPipe = v2Text.IndexOf('|', secondPipe + 1) + let v1Text = ("LV_WORLD_SAVE_V1" + v2Text.Substring(thirdPipe)) + + // v1/v2 same-world digest equality (RED before canonical digest exists). + let digestOfV1 = PerformanceProbe.WorldDigestOfText v1Text + Assert.AreEqual(digestOfV1, PerformanceProbe.WorldDigestOfText v2Text) + // 953775FA 硬对齐由 --performance-baseline 于 finalWorld 支线证据。 + [] member _.JiangnanArtAssetsArePackagedAsRealPngFiles () = let requiredAssets = -- cgit v1.2.3