A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
sim: corridors take a person's sign-off, reviewed_by and reviewed_on (Refs #1244) (#1644)
Eyal Golan0b7cb7afcf4f
diff --git a/changelog.d/1244-corridor-signoff-fields.md b/changelog.d/1244-corridor-signoff-fields.mdnew file mode 100644index 000000000..46a36b98b--- /dev/null+++ b/changelog.d/1244-corridor-signoff-fields.md@@ -0,0 +1,2 @@+- Corridors in `content/corridors.yaml` can now carry a person's sign-off, `reviewed_by` and `reviewed_on`, like+ every other status row; the loader checks both or neither, the handle and the day.diff --git a/sim/Statecraft.Sim.Tests/CorridorsContentTests.cs b/sim/Statecraft.Sim.Tests/CorridorsContentTests.csindex 52bcd8095..75979adfa 100644--- a/sim/Statecraft.Sim.Tests/CorridorsContentTests.cs+++ b/sim/Statecraft.Sim.Tests/CorridorsContentTests.cs@@ -72,6 +72,24 @@ public class CorridorsContentTestsAssert.DoesNotMatch(@"(?m)^[^#\n]*\b\w*(turns|cost)\w*\s*:", text);}+ /// <summary>A person's sign-off beside a corridor's status (#375, #1244): reviewed_by and reviewed_on, both or neither, as on+ /// every other status row. Content metadata only: the sim never reads it.</summary>+ [Fact]+ public void ACorridorTakesAPersonsSignOff()+ {+ var signed = Load(new Dictionary<string, string> { ["corridors.yaml"] = ReplaceFirst(Fixture.GddCorridors, " status: draft\n",+ " status: fact-checked\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n") });+ Assert.Equal(("fact-checked", "eyalgolan", "2026-10-15"), (signed.Corridors[0].Status, signed.Corridors[0].ReviewedBy, signed.Corridors[0].ReviewedOn));+ Assert.Equal(("", ""), (signed.Corridors[1].ReviewedBy, signed.Corridors[1].ReviewedOn));+ }++ static string ReplaceFirst(string s, string replace, string with)+ {+ int i = s.IndexOf(replace, StringComparison.Ordinal);+ Assert.True(i >= 0, replace);+ return s.Substring(0, i) + with + s.Substring(i + replace.Length);+ }+static string Cor(string replace, string with) => Fixture.GddCorridors.Replace(replace, with);static string Rules(string mvp) => Fixture.Files["rules.yaml"].Replace("map_action: 1 }", Fixture.GddCosts) + mvp;@@ -90,6 +108,10 @@ public class CorridorsContentTestsnew object[] { "corridors.yaml", Cor("hexes: [[3, 0], [4, 0]]", "hexes: [[1, 1]]"), "corridors[road_a].segments[2].hexes", "hex q=1 r=1 is not next to q=3 r=0" },new object[] { "corridors.yaml", Cor(" status: draft\n", " status: done\n"), "corridors[road_a].status", "unknown status 'done'" },new object[] { "corridors.yaml", Cor(", checked: 2026-10-15", ""), "corridors[road_a].sources[0]", "url and checked date" },+ new object[] { "corridors.yaml", Cor(" status: draft\n", " status: draft\n reviewed_by: eyalgolan\n"), "corridors[road_a].reviewed_on", "required with reviewed_by" },+ new object[] { "corridors.yaml", Cor(" status: draft\n", " status: draft\n reviewed_on: 2026-10-15\n"), "corridors[road_a].reviewed_by", "required with reviewed_on" },+ new object[] { "corridors.yaml", Cor(" status: draft\n", " status: draft\n reviewed_by: '@eyalgolan'\n reviewed_on: 2026-10-15\n"), "corridors[road_a].reviewed_by", "GitHub handle" },+ new object[] { "corridors.yaml", Cor(" status: draft\n", " status: draft\n reviewed_by: eyalgolan\n reviewed_on: 15 October 2026\n"), "corridors[road_a].reviewed_on", "YYYY-MM-DD" },new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("road_segment_turns: 3", "road_segment_turns: 0")), "mvp.road_segment_turns", "must be >= 1" },new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("rail_segment_turns: 2", "rail_segment_turns: 0")), "mvp.rail_segment_turns", "must be >= 1" },new object[] { "rules.yaml", Rules(Fixture.GddRules.Replace("road_segment_cost: 1.5", "road_segment_cost: -1")), "mvp.road_segment_cost", "must be a finite number >= 0" },diff --git a/sim/Statecraft.Sim.Tests/ReviewRecordTests.cs b/sim/Statecraft.Sim.Tests/ReviewRecordTests.csindex 7c1c1e64e..c053b52a3 100644--- a/sim/Statecraft.Sim.Tests/ReviewRecordTests.cs+++ b/sim/Statecraft.Sim.Tests/ReviewRecordTests.cs@@ -127,7 +127,7 @@ public class ReviewRecordTestsvar signed = c.People.Select(p => (p.ReviewedBy, p.ReviewedOn)).Concat(c.Legislatures.Select(l => (l.ReviewedBy, l.ReviewedOn))).Concat(c.Governments.Select(g => (g.ReviewedBy, g.ReviewedOn))).Concat(c.Aliyah.Select(a => (a.ReviewedBy, a.ReviewedOn))).Concat(c.PopulationAnchors.Select(a => (a.ReviewedBy, a.ReviewedOn))).Concat(c.Events.Select(e => (e.ReviewedBy, e.ReviewedOn)))- .Concat(c.Sites.Select(s => (s.ReviewedBy, s.ReviewedOn))).Where(x => x.ReviewedBy != "").ToList();+ .Concat(c.Sites.Select(s => (s.ReviewedBy, s.ReviewedOn))).Concat(c.Corridors.Select(x => (x.ReviewedBy, x.ReviewedOn))).Where(x => x.ReviewedBy != "").ToList();Assert.All(signed, x => { Assert.True(ReviewRecord.IsHandle(x.ReviewedBy)); Assert.True(ReviewRecord.IsDay(x.ReviewedOn)); Assert.True(DateTime.ParseExact(x.ReviewedOn, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) <= DateTime.UtcNow.Date); });}}diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 00b5d40b6..07d69515e 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -771,6 +771,19 @@ namespace Statecraft.Simpublic List<SegmentDef> Segments { get; set; } = new List<SegmentDef>();public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;}/// <summary>One segment of a corridor: the hexes its stretch of the traced line crosses, in order, ending at the routediff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 42c0b0f1f..e1ef0469b 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -1428,6 +1428,7 @@ namespace Statecraft.Simif (x.Sources[i] == null || string.IsNullOrWhiteSpace(x.Sources[i].Url) || x.Sources[i].Checked == default)throw new ContentException(cf, FormattableString.Invariant($"{at}.sources[{i}]"), "needs a url and checked date");Status(cf, at + ".status", x.Status);+ Review(cf, at, x.ReviewedBy, x.ReviewedByGiven, x.ReviewedOn, x.ReviewedOnGiven);}}