A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
fix(sim): duplicate YAML keys are content errors (I1 probe follow-up)
eyalgolan84c5d6f99541
diff --git a/sim/Statecraft.Sim.Tests/ValidationTests.cs b/sim/Statecraft.Sim.Tests/ValidationTests.csindex 4b1b6fc16..6aad820b3 100644--- a/sim/Statecraft.Sim.Tests/ValidationTests.cs+++ b/sim/Statecraft.Sim.Tests/ValidationTests.cs@@ -222,4 +222,13 @@ status: draftAssert.Equal("events/drought.yaml", ex.File);Assert.Equal(field, ex.Field);}++ [Fact]+ public void DuplicateKeyIsAContentError()+ {+ // YamlDotNet keeps the last of two equal keys by default, which would silently drop the first value.+ var ex = Bad("legislatures.yaml", " size: 10\n", " size: 10\n seats:\n");+ Assert.Equal("legislatures.yaml", ex.File);+ Assert.StartsWith("line ", ex.Field);+ }}diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex bfd89d0cf..d4df407f3 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -31,6 +31,7 @@ namespace Statecraft.Simstatic readonly IDeserializer Yaml = new DeserializerBuilder().WithNamingConvention(UnderscoredNamingConvention.Instance)+ .WithDuplicateKeyChecking() // two equal keys would otherwise silently keep only the last value.Build();static T Read<T>(Func<string, string?> readFile, string relPath)