Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Leave seven legacy event cards out of the gdd-0.3 ruleset (#1772)

Eyal Golaneabae172f946
diff --git a/changelog.d/1718-gdd03-event-effects.md b/changelog.d/1718-gdd03-event-effects.md
new file mode 100644
index 000000000..00a92c088
--- /dev/null
+++ b/changelog.d/1718-gdd03-event-effects.md
@@ -0,0 +1,5 @@
+### Changed
+
+- Under the gdd-0.3 ruleset, keep eight event cards legacy-only through an explicit availability manifest,
+ and reject retired event targets and unaccounted structured effects. Preserve shared event records and
+ legacy/gdd-0.1 loading; explicit Money costs retain borrowing.
diff --git a/content/gdd03-events.yaml b/content/gdd03-events.yaml
new file mode 100644
index 000000000..61fa25769
--- /dev/null
+++ b/content/gdd03-events.yaml
@@ -0,0 +1,21 @@
+# yaml-language-server: $schema=./schema/gdd03-events.schema.json
+# R-EFX-001/002/005/007, #1718: availability only; shared reviewed event records stay byte-identical.
+# No replacement amounts, effects, review statuses or sign-offs are authored here.
+ruleset: gdd-0.3
+exclusions:
+ - id: austerity_1949
+ reason: Rationing policy, Food supply readout and foreign-currency effects need approved contracts.
+ - id: clothing_rationing_1950
+ reason: Foreign-currency import spending has no approved gdd-0.3 ledger mapping.
+ - id: forex_crisis_1951
+ reason: Foreign-currency debit and aid, with Food supply effects, need authored ledger and stock contracts.
+ - id: iraqi_exodus
+ reason: National housing effects need regional population and facility accounting.
+ - id: israel_bonds
+ reason: Foreign-currency bond grants need an approved ledger mapping and authored debt terms.
+ - id: maabarot_policy
+ reason: Maabarot policy and national housing effects need approved facility and population accounting.
+ - id: reparations_claim
+ reason: Coupled foreign-currency refusal cost has no approved gdd-0.3 ledger mapping.
+ - id: reparations_vote
+ reason: Coupled foreign-currency refusal cost has no approved gdd-0.3 ledger mapping.
diff --git a/content/schema/gdd03-events.schema.json b/content/schema/gdd03-events.schema.json
new file mode 100644
index 000000000..3f81ca6eb
--- /dev/null
+++ b/content/schema/gdd03-events.schema.json
@@ -0,0 +1,39 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "GDD 0.3 event availability",
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "ruleset",
+ "exclusions"
+ ],
+ "properties": {
+ "ruleset": {
+ "type": "string",
+ "enum": [
+ "gdd-0.3"
+ ]
+ },
+ "exclusions": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "required": [
+ "id",
+ "reason"
+ ],
+ "properties": {
+ "id": {
+ "type": "string",
+ "pattern": "^[a-z][a-z0-9_]*$"
+ },
+ "reason": {
+ "type": "string",
+ "pattern": "\\S"
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.md
index d8b92313f..ddeb2ba5d 100644
--- a/docs/WRITING_EVENTS.md
+++ b/docs/WRITING_EVENTS.md
@@ -506,3 +506,32 @@ The first owner starts on the first day of the era (no gap). Each `from` is insi
owner's office must exist from its `from` to the next `from` (or the end of the era), and one office may own only one line on
any day. The loader refuses anything else. `Offices.BudgetOwner(content, line, date)` and `Offices.BudgetLineOf(content,
office, date)` are the only readers. Lines that change across an era boundary are the carry rules' job (#59).
+
+
+## GDD 0.3 first-slice availability (#1718)
+
+Legacy and gdd-0.1 continue to load every shared event file, with their existing content identity and effects.
+Only the `gdd-0.3` identity reads and hashes `content/gdd03-events.yaml`. It must contain `ruleset: gdd-0.3`
+and an explicit `exclusions` list of `{ id, reason }` entries. Its schema is `content/schema/gdd03-events.schema.json`.
+Missing/null manifests, unknown/duplicate ids, blank reasons, and references from active requirements, variants,
+rejoin options or objective cards to excluded ids are content errors. Every source file still parses strictly;
+the remaining catalogue receives the usual cross-reference, effect and sensitivity validation.
+
+The approved first slice excludes exactly `austerity_1949`, `clothing_rationing_1950`, `forex_crisis_1951`,
+`iraqi_exodus`, `israel_bonds`, `maabarot_policy`, `reparations_claim` and `reparations_vote`, including all their
+options (`reparations_vote` joined with #1575, for the same reason as `reparations_claim`).
+Six of these are hard anchors: they are unavailable in 0.3. Shared records, Hebrew, tags, status and human
+sign-offs remain unchanged and available to review tools. Removing an exclusion requires a reviewed follow-up
+with approved accounting and authored values; it does not itself approve a replacement or transfer a sign-off.
+There is no automatic review promotion, and all existing release gates still apply.
+
+R-EFX-001 rejects 0.3 writes to `food_supply`, `housing`, `fx_reserves`; `rationing`/`maabarot` policy assignments;
+and Attention, passive budgets, automatic Food refills and defeat commands even if authored as compatibility
+indicators. Reserved target spellings are `attention`/`attention_*`, `budget`/`budget_*`,
+`passive_budget`/`passive_budget_*`, `food_refill`, `automatic_food_refill`, `defeat`, `city_loss_defeat`,
+and `any_city_loss`. Other unknown targets remain errors. No new alias or conversion is provided.
+`grant_units`, `city_effects` and `unlock_projects` await an approved 0.3 accounting contract and are rejected.
+Explicit `food`, `arms`, `treasury` and approved indicator effects retain the existing application and no-gain
+checks (R-EFX-002/005/007). Treasury costs still borrow (R-MONEY-003): the owner's 26 October 2026 ruling
+on #1718 supersedes the proposal's prohibition. Do not invent FX-to-Money rates, debt principal, arrivals,
+Food quantities, facilities or replacement values. Missing replacements remain Deferred in the #1742 workflow.
diff --git a/docs/rules/mvp.md b/docs/rules/mvp.md
index a174a8a54..a1689eec1 100644
--- a/docs/rules/mvp.md
+++ b/docs/rules/mvp.md
@@ -424,9 +424,11 @@ R-NAT-003: International Support is the 0 to 1 `intl_standing` indicator, shown
R-NAT-004: "Low international support" (`low_intl_support`) is a situation on `intl_standing` with the same bands and, likewise, no effect of its own (Q-NAT-3).
-R-EFX-001: An option's effect may target an indicator id from `model.yaml`, `treasury` or `fx_reserves` (game money), or `food`, the national Food stock: the effect moves the stock by whole units (the delta rounds half away from zero) and the stock never drops below 0, so a cut larger than the stock applies only to what is there. Any other target is a load error naming file and field. The Arms stock becomes a target with its pool (#781): `arms` moves it the same way.
+R-EFX-001: In legacy and gdd-0.1, an option's effect may target an indicator id from `model.yaml`, `treasury` or `fx_reserves` (game money), or `food`, the national Food stock: the effect moves the stock by whole units (the delta rounds half away from zero) and the stock never drops below 0, so a cut larger than the stock applies only to what is there. Any other target is a load error naming file and field. The Arms stock becomes a target with its pool (#781): `arms` moves it the same way.
-R-EFX-002: An option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise `treasury`, `fx_reserves`, `food`, `arms`, `food_supply`, `morale` or `intl_standing` (Q-EFX-2, decided 15 October 2026: the no-gain rule covers all five resources, with the legacy indicators standing for Food, Social cohesion and International Support; `food` is Food's own target, and Arms joins the rule with its pool, #781). A cost stays allowed.
+Under gdd-0.3 (#1718, approved C244 first slice): only the active event catalogue is simulated. `content/gdd03-events.yaml` is required, read and hashed only for this identity; it explicitly excludes whole cards by id with a reason. Unknown or duplicate exclusions and stranded requirements, variants, rejoin edges or objective cards are errors. All source YAML is still parsed strictly. Eight legacy cards are excluded without changing their source bytes or reviews. There are no replacement amounts. Approved indicator writes and explicit `treasury`, `food`, `arms` effects retain finite checks, stock rounding and bounds. Writable `food_supply`, national `housing`, `fx_reserves`, Attention, passive-budget, automatic-Food-refill and city-loss/defeat command targets are rejected before compatibility-indicator acceptance. Retired `rationing` and `maabarot` policy writes are errors. Structured `grant_units`, `city_effects` and `unlock_projects` await approved population/facility accounting and are errors in this slice. Explicit Treasury costs continue borrowing with the existing cause under R-MONEY-003; the owner's 26 October 2026 ruling on #1718 overrides the proposal's no-borrowing text. No transaction refusal or new debt limit is introduced.
+
+R-EFX-002: In every ruleset, an option of an event tagged `holocaust`, `terror`, `massacre` or `war-casualties` cannot raise `treasury`, `fx_reserves`, `food`, `arms`, `food_supply`, `morale` or `intl_standing` (Q-EFX-2, decided 15 October 2026: the no-gain rule covers all five resources, with the legacy indicators standing for Food, Social cohesion and International Support; `food` is Food's own target, and Arms joins the rule with its pool, #781). A cost stays allowed. Under gdd-0.3, R-EFX-001 first rejects retired compatibility targets; the remaining Money, Food, Arms and indicator effects keep these no-gain checks. Availability changes do not reset sensitivity tags, review status or human sign-off, and no alias grants an exception (R-EFX-005/007).
R-EFX-007: An option of an event tagged `displacement` cannot raise Money (`treasury` or `fx_reserves`), Food (`food` or `food_supply`), Arms (`arms`), Social cohesion (`morale`), International Support (`intl_standing`) or score, with no exception (Q-DEP-6(a), owner ruling of 18 October 2026). Score is not an event-effect target yet and remains an unknown target under R-EFX-001; when that target exists, this rule covers it. The tag also receives R-EFX-005's ban on unit grants and positive city effects.
diff --git a/sim/Statecraft.Sim.Tests/Fixture.cs b/sim/Statecraft.Sim.Tests/Fixture.cs
index 2a8e35344..ce7cbfa0e 100644
--- a/sim/Statecraft.Sim.Tests/Fixture.cs
+++ b/sim/Statecraft.Sim.Tests/Fixture.cs
@@ -228,6 +228,8 @@ series:
{
var o = new Dictionary<string, string>
{
+ // Empty availability list for synthetic content. Old modes never read or hash this file.
+ ["gdd03-events.yaml"] = "ruleset: gdd-0.3\nexclusions: []\n",
["eras.yaml"] = Files["eras.yaml"] + " systems: { loop: gdd }\n",
["rules.yaml"] = Files["rules.yaml"].Replace("map_action: 1 }", GddCosts) + GddRules,
["cities.yaml"] = GddCities,
diff --git a/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.cs b/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.cs
new file mode 100644
index 000000000..9c44f6246
--- /dev/null
+++ b/sim/Statecraft.Sim.Tests/Gdd03EventRulesTests.cs
@@ -0,0 +1,419 @@
+using Statecraft.Sim;
+using System.Security.Cryptography;
+
+// R-EFX-001/002/005/007, R-MONEY-003: identity comes from eras, never a post-load switch.
+public class Gdd03EventRulesTests
+{
+ const string Manifest = "gdd03-events.yaml";
+ const string Empty = "ruleset: gdd-0.3\nexclusions: []\n";
+ static readonly string[] Excluded = { "austerity_1949", "clothing_rationing_1950", "forex_crisis_1951", "iraqi_exodus", "israel_bonds", "maabarot_policy", "reparations_claim", "reparations_vote" };
+ static string Card(string id = "probe", string option = "") =>
+ $"id: {id}\ntitle: Fixture\ntext: Fixture.\nfrom: 1948-05-15\noptions:\n - id: ok\n text: Accept\n historical: true\n" + option;
+ static Dictionary<string, string> Files(bool modern = true)
+ {
+ var f = Fixture.Gdd();
+ if (modern) f["eras.yaml"] = f["eras.yaml"].Replace("loop: gdd", "loop: gdd, ruleset: gdd-0.3");
+ f[Gdd03BalanceCatalogue.FileName] = File.ReadAllText(Path.Combine(RealContentTests.ContentRoot(), Gdd03BalanceCatalogue.FileName));
+ f["model.yaml"] = Fixture.Files["model.yaml"].Replace("indicators:", "indicators:\n - { id: intl_standing, name: Support, base: 0.5 }");
+ f[Manifest] = Empty;
+ return f;
+ }
+ static Content Load(Dictionary<string, string> f, string card) =>
+ ContentLoader.Load(Fixture.Write(f, new() { ["probe.yaml"] = card }));
+ static ContentException Reject(string option, string field, Action<Dictionary<string, string>>? edit = null)
+ {
+ var f = Files(); edit?.Invoke(f);
+ var ex = Assert.Throws<ContentException>(() => Load(f, Card(option: option)));
+ Assert.Equal("events/probe.yaml", ex.File);
+ Assert.Equal("events[probe].options[ok]." + field, ex.Field);
+ Assert.Contains("gdd-0.3", ex.Message);
+ return ex;
+ }
+ static void Effect(string target, bool indicator = false) => Reject(
+ $" effects: [{{ target: {target}, delta: -0.1 }}]\n", "effects." + target,
+ indicator ? f => f["model.yaml"] = Fixture.Files["model.yaml"].Replace("indicators:", $"indicators:\n - {{ id: {target}, name: Fixture, base: 0.5 }}") : null);
+
+ [Fact] public void Gdd03RejectsAttentionEffectEvenIfIndicatorExists() => Effect("attention", true);
+ [Fact] public void Gdd03RejectsPassiveBudgetEffect() => Effect("budget", true);
+ [Fact] public void Gdd03RejectsAutomaticFoodRefillEffect() => Effect("food_refill", true);
+ [Fact] public void Gdd03RejectsFoodSupplyWrite() => Effect("food_supply");
+ [Fact] public void Gdd03RejectsHousingCompatibilityWrite() => Effect("housing");
+ [Fact] public void Gdd03RejectsFxEffectWithoutApprovedLedger() => Effect("fx_reserves");
+ [Fact] public void Gdd03RejectsRetiredRationingPolicy() => Reject(" set_policy: { rationing: 0.5 }\n", "set_policy.rationing");
+ [Fact] public void Gdd03RejectsRetiredMaabarotPolicy() => Reject(" set_policy: { maabarot: 0.5 }\n", "set_policy.maabarot");
+ [Fact] public void Gdd03RejectsCityLossDefeatEffect() => Effect("city_loss_defeat", true);
+ [Fact] public void Gdd03RejectsUnaccountedPopulationGrant() => Reject(" grant_units: [{ type: halutz, n: 1, at: town_a }]\n", "grant_units");
+ [Fact] public void Gdd03RejectsUnaccountedFacilityEffect() => Reject(" city_effects: [{ city: town_a, field: housing_capacity, delta: 1 }]\n", "city_effects");
+ [Fact] public void Gdd03RejectsUnaccountedProjectUnlock() => Reject(" unlock_projects: [housing]\n", "unlock_projects",
+ f => f["projects.yaml"] = Fixture.GddProjects.Replace("id: housing,", "id: housing, locked: true,"));
+
+ [Theory]
+ [InlineData("attention_per_turn")]
+ [InlineData("budget_finance_minister")]
+ [InlineData("passive_budget")]
+ [InlineData("automatic_food_refill")]
+ [InlineData("defeat")]
+ [InlineData("any_city_loss")]
+ public void CompatibilityIndicatorsCannotEnableCommandTargets(string target) => Effect(target, true);
+
+ [Theory]
+ [InlineData("food_supply")]
+ [InlineData("housing")]
+ [InlineData("fx_reserves")]
+ public void OldRulesStillAcceptCompatibilityWrites(string target)
+ {
+ var c = Load(Files(false), Card(option: $" effects: [{{ target: {target}, delta: -0.1 }}]\n"));
+ Assert.Equal(target, c.Events.Single().Options.Single().Effects.Single().Target);
+ }
+ [Theory] [InlineData("rationing")] [InlineData("maabarot")]
+ public void OldRulesStillAcceptPolicies(string policy) =>
+ Assert.Single(Load(Files(false), Card(option: $" set_policy: {{ {policy}: 0.5 }}\n")).Events);
+
+ static string Exclude(string rows) => "ruleset: gdd-0.3\nexclusions:\n" + rows;
+ [Theory]
+ [InlineData(null, "(file)")]
+ [InlineData("null\n", "(file)")]
+ [InlineData("ruleset: legacy\nexclusions: []\n", "ruleset")]
+ [InlineData("ruleset: gdd-0.3\n", "exclusions")]
+ [InlineData("ruleset: gdd-0.3\nexclusions: null\n", "exclusions")]
+ [InlineData("ruleset: gdd-0.3\nexclusions: [{ id: missing, reason: Fixture }]\n", "exclusions[0].id")]
+ [InlineData("ruleset: gdd-0.3\nexclusions: [{ id: probe, reason: '' }]\n", "exclusions[0].reason")]
+ [InlineData("ruleset: gdd-0.3\nexclusions: [{ id: probe, reason: Fixture }, { id: probe, reason: Fixture }]\n", "exclusions[1].id")]
+ public void ManifestFailsClosed(string? text, string field)
+ {
+ var f = Files(); if (text == null) f.Remove(Manifest); else f[Manifest] = text;
+ var ex = Assert.Throws<ContentException>(() => Load(f, Card()));
+ Assert.Equal(Manifest, ex.File); Assert.Equal(field, ex.Field);
+ }
+ [Fact]
+ public void ExcludedSourceStillParsesStrictly()
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ Assert.Equal("events/probe.yaml", Assert.Throws<ContentException>(() => Load(f, Card() + "unknown_field: true\n")).File);
+ }
+ [Theory]
+ [InlineData("requires: [{ event: probe, option: ok }]\n", "requires[0].event")]
+ [InlineData("kind: reconvergence\nvariants: [{ when: [{ event: probe, diverged: true }], text: Fixture }]\n", "variants[0].when[0].event")]
+ public void CannotStrandActiveReferences(string reference, string field)
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(f, new()
+ {
+ ["probe.yaml"] = Card(), ["active.yaml"] = Card("active") + reference
+ })));
+ Assert.Equal("events/active.yaml", ex.File); Assert.Equal("events[active]." + field, ex.Field);
+ Assert.Contains("excluded", ex.Message);
+ }
+ [Fact]
+ public void CannotStrandObjectiveCard()
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ f["objectives.yaml"] = "objectives: [{ id: goal, card: probe }]\n";
+ var ex = Assert.Throws<ContentException>(() => Load(f, Card()));
+ Assert.Equal("objectives.yaml", ex.File); Assert.Equal("objectives[goal].card", ex.Field);
+ }
+ [Fact]
+ public void CannotStrandRejoin()
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(f, new()
+ {
+ ["probe.yaml"] = Card(), ["active.yaml"] = Card("active", " rejoin: probe\n")
+ })));
+ Assert.Equal("events[active].options[ok].rejoin", ex.Field);
+ }
+ [Fact]
+ public void ExcludedDuplicateIdsAreNotHidden()
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ var ex = Assert.Throws<ContentException>(() => ContentLoader.Load(Fixture.Write(f, new()
+ { ["a.yaml"] = Card(), ["b.yaml"] = Card() })));
+ Assert.Equal("events[probe].id", ex.Field);
+ }
+
+ static Content Real(bool modern, string? manifest = null)
+ {
+ var root = RealContentTests.ContentRoot();
+ return ContentLoader.Load(rel =>
+ {
+ if (rel == Manifest && manifest != null) return manifest;
+ var path = Path.Combine(root, rel);
+ var text = File.Exists(path) ? File.ReadAllText(path) : null;
+ return modern && rel == "eras.yaml" ? text!.Replace("loop: gdd", "loop: gdd, ruleset: gdd-0.3") : text;
+ }, Directory.GetFiles(Path.Combine(root, "events"), "*.yaml").Select(p => "events/" + Path.GetFileName(p)));
+ }
+ [Fact]
+ public void RealCatalogueExcludesExactlyEightWholeCardsAndKeepsOrder()
+ {
+ var old = Real(false); var modern = Real(true);
+ Assert.Equal(39, old.Events.Count); Assert.Equal(31, modern.Events.Count);
+ Assert.Equal(Excluded, old.Events.Select(e => e.Id).Except(modern.Events.Select(e => e.Id)).OrderBy(x => x, StringComparer.Ordinal));
+ Assert.Equal(old.Events.Where(e => !Excluded.Contains(e.Id)).Select(e => e.Id), modern.Events.Select(e => e.Id));
+ Assert.NotEqual(old.Hash, modern.Hash);
+ }
+ [Theory] [InlineData(false)] [InlineData(true)]
+ public void OlderModesNeverReadManifestOrChangeHashSaveOrState(bool gdd)
+ {
+ var f = gdd ? Files(false) : new Dictionary<string, string>();
+ var dir = Fixture.Write(f, new() { ["probe.yaml"] = Card() });
+ var reads = new List<string>();
+ Content Read(string? manifest) => ContentLoader.Load(rel =>
+ {
+ reads.Add(rel);
+ if (rel == Manifest) return manifest;
+ var path = Path.Combine(dir, rel); return File.Exists(path) ? File.ReadAllText(path) : null;
+ }, new[] { "events/probe.yaml" });
+ var absent = Read(null); var poison = Read("this is deliberately invalid YAML: [");
+ Assert.DoesNotContain(Manifest, reads); Assert.Equal(absent.Hash, poison.Hash);
+ var a = GameSession.New(absent, 1948, Mode.Historical); var b = GameSession.New(poison, 1948, Mode.Historical);
+ Assert.Equal(a.Save.Write(), b.Save.Write()); Assert.Equal(a.State.Hash(), b.State.Hash());
+ }
+ [Theory] [InlineData(false)] [InlineData(true)]
+ public void ExcludedCardsCannotTriggerChooseOrDelegate(bool delegateChoice)
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ var c = Load(f, Card(option: " effects: [{ target: treasury, delta: 100 }]\n"));
+ var s = Simulation.NewGame(c, 1, Mode.Historical); var why = new List<Cause>();
+ EventSystem.Trigger(c, s, why);
+ Assert.Empty(s.FiredEvents); Assert.Empty(s.PendingEvents);
+ var money = s.Treasury;
+ Assert.NotNull(EventSystem.Choose(c, s, "probe", "ok", why));
+ if (delegateChoice) EventSystem.Delegate(c, s, why);
+ Assert.Equal(money, s.Treasury); Assert.Empty(s.ChosenOptions);
+ }
+ [Theory] [InlineData(false)] [InlineData(true)]
+ public void ExplicitStocksAndBorrowingApplyOnceWithoutAttention(bool delegateChoice)
+ {
+ var c = Load(Files(), Card(option: " effects: [{ target: food, delta: 2.5 }, { target: arms, delta: -2.5 }, { target: treasury, delta: -4 }]\n").Replace("from:", "anchor: hard\nfrom:"));
+ var s = Simulation.NewGame(c, 1, Mode.Historical); s.Food = 1; s.Arms = 1; s.Treasury = 1; s.Debt = 0; s.Attention = double.NaN;
+ var why = new List<Cause>();
+ if (delegateChoice) EventSystem.Delegate(c, s, why); else Assert.Null(EventSystem.Choose(c, s, "probe", "ok", why));
+ Assert.Equal(4, s.Food); Assert.Equal(0, s.Arms); Assert.Equal(0, s.Treasury); Assert.Equal(3, s.Debt);
+ Assert.True(double.IsNaN(s.Attention));
+ Assert.Contains(why, w => w.Target == "food" && w.Delta == 3);
+ Assert.Contains(why, w => w.Target == "arms" && w.Delta == -1);
+ Assert.Contains(why, w => w.Target == "debt" && w.Delta == 3);
+ Assert.NotNull(EventSystem.Choose(c, s, "probe", "ok", why));
+ EventSystem.Delegate(c, s, why); Assert.Equal(4, s.Food); Assert.Equal(3, s.Debt);
+ }
+ [Theory]
+ [InlineData("holocaust")] [InlineData("terror")] [InlineData("massacre")]
+ [InlineData("war-casualties")] [InlineData("displacement")]
+ public void SensitivePositiveGainsStillFailAndNegativeCostsRemainAllowed(string tag)
+ {
+ foreach (var target in new[] { "treasury", "food", "arms", "morale", "intl_standing" })
+ {
+ string Record(int delta) => Card(option: FormattableString.Invariant($" effects: [{{ target: {target}, delta: {delta} }}]\n")) + $"tags: [{tag}]\n";
+ var ex = Assert.Throws<ContentException>(() => Load(Files(), Record(1)));
+ Assert.Equal("events[probe].options[ok].effects." + target, ex.Field);
+ Assert.Contains("sensitive", ex.Message);
+ Assert.Single(Load(Files(), Record(-1)).Events);
+ }
+ }
+
+ // R-EFX-001/002/007: previews name authored deltas; causes name the bounded applied amount.
+ [Theory] [InlineData(false)] [InlineData(true)]
+ public void RetainedIndicatorsClampOnceThroughChooseAndDelegate(bool delegateChoice)
+ {
+ var c = Load(Files(), Card(option: " effects: [{ target: morale, delta: 0.2 }, { target: intl_standing, delta: -0.2 }]\n").Replace("from:", "anchor: hard\nfrom:"));
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ EffectsSystem.Shift(c, s, "morale", .99 - s.Indicators["morale"]);
+ EffectsSystem.Shift(c, s, "intl_standing", .01 - s.Indicators["intl_standing"]);
+ var preview = EventSystem.OptionEffects(c, s, c.Events.Single().Options.Single());
+ Assert.Equal(.2, preview.Single(x => x.Target == "morale").Delta);
+ Assert.Equal(-.2, preview.Single(x => x.Target == "intl_standing").Delta);
+ var why = new List<Cause>();
+ if (delegateChoice) EventSystem.Delegate(c, s, why);
+ else Assert.Null(EventSystem.Choose(c, s, "probe", "ok", why));
+ Assert.Equal(1, s.Indicators["morale"]); Assert.Equal(0, s.Indicators["intl_standing"]);
+ Assert.Equal(.01, why.Single(x => x.Target == "morale").Delta, 12);
+ Assert.Equal(-.01, why.Single(x => x.Target == "intl_standing").Delta, 12);
+ Assert.Equal("ok", s.ChosenOptions["probe"]); Assert.Empty(s.PendingEvents);
+ var count = why.Count;
+ Assert.NotNull(EventSystem.Choose(c, s, "probe", "ok", why));
+ EventSystem.Delegate(c, s, why);
+ Assert.Equal(count, why.Count); Assert.Equal(1, s.Indicators["morale"]); Assert.Equal(0, s.Indicators["intl_standing"]);
+ }
+ // R-EVT-001/002: active hard anchors reserve slots; source order is not runtime order.
+ [Fact]
+ public void RetainedHardAnchorsFireInOrderAndExcludedAnchorCannotConsumeASoftSlot()
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: excluded, reason: Fixture }\n");
+ string Hard(string id) => Card(id).Replace("from:", "anchor: hard\nfrom:");
+ var c = ContentLoader.Load(Fixture.Write(f, new()
+ {
+ ["a.yaml"] = Card("soft_c"), ["b.yaml"] = Hard("hard_b"),
+ ["c.yaml"] = Card("soft_a"), ["d.yaml"] = Hard("excluded"),
+ ["e.yaml"] = Hard("hard_a"), ["f.yaml"] = Card("soft_b")
+ }));
+ var s = Simulation.NewGame(c, 1, Mode.Historical);
+ Assert.Equal(new[] { "hard_a", "hard_b", "soft_a" }, s.PendingEvents);
+ Assert.Equal(s.PendingEvents, s.FiredEvents);
+ var next = Simulation.Step(c, s, Array.Empty<Command>()).State;
+ Assert.Equal(new[] { "soft_b", "soft_c" }, next.PendingEvents);
+ Assert.Equal(new[] { "hard_a", "hard_b", "soft_a", "soft_b", "soft_c" }, next.FiredEvents);
+ Assert.DoesNotContain("excluded", next.ChosenOptions.Keys);
+ Assert.All(new[] { "hard_a", "hard_b", "soft_a" }, id => Assert.Equal("ok", next.ChosenOptions[id]));
+ }
+
+ // Inventory from the approved C244 plan, pinned to ef35703; includes valid sibling fields.
+ // reparations_vote (#1575) joined after the main merge, excluded for the same reason as reparations_claim.
+ static readonly string[] Inventory =
+ {
+ "austerity_1949/impose/set_policy.rationing=1",
+ "austerity_1949/impose/effects.food_supply=0.15",
+ "austerity_1949/impose/effects.morale=-0.05",
+ "austerity_1949/decline/effects.fx_reserves=-8",
+ "austerity_1949/decline/effects.food_supply=-0.05",
+ "clothing_rationing_1950/extend/effects.morale=-0.05",
+ "clothing_rationing_1950/relax/effects.morale=0.03",
+ "clothing_rationing_1950/relax/effects.fx_reserves=-8",
+ "forex_crisis_1951/request_aid/effects.fx_reserves=-45",
+ "forex_crisis_1951/request_aid/effects.fx_reserves=15",
+ "forex_crisis_1951/request_aid/effects.intl_standing=-0.01",
+ "forex_crisis_1951/cut_imports/effects.fx_reserves=-45",
+ "forex_crisis_1951/cut_imports/effects.food_supply=-0.05",
+ "forex_crisis_1951/cut_imports/effects.morale=-0.04",
+ "iraqi_exodus/airlift/effects.housing=-0.04",
+ "iraqi_exodus/airlift/effects.morale=0.03",
+ "iraqi_exodus/pace/effects.morale=-0.05",
+ "iraqi_exodus/pace/effects.intl_standing=-0.02",
+ "israel_bonds/launch/effects.fx_reserves=52",
+ "israel_bonds/launch/effects.intl_standing=0.02",
+ "israel_bonds/donations_only/effects.fx_reserves=10",
+ "maabarot_policy/maabarot/set_policy.maabarot=1",
+ "maabarot_policy/maabarot/effects.housing=0.04",
+ "maabarot_policy/maabarot/effects.morale=-0.02",
+ "maabarot_policy/maabarot/effects.treasury=2",
+ "maabarot_policy/keep_camps/effects.housing=-0.03",
+ "maabarot_policy/keep_camps/effects.treasury=-4",
+ "reparations_claim/claim/effects.intl_standing=0",
+ "reparations_claim/claim/effects.treasury=-1",
+ "reparations_claim/refuse/effects.intl_standing=0",
+ "reparations_claim/refuse/effects.fx_reserves=-4",
+ "reparations_vote/negotiate/effects.morale=-0.02",
+ "reparations_vote/reject/effects.fx_reserves=-4",
+ "reparations_vote/referendum/effects.treasury=-1",
+ };
+ [Fact]
+ public void AllThirtyFourAffectedAssignmentsRetainTheirLegacyValues()
+ {
+ var rows = Real(false).Events.Where(e => Excluded.Contains(e.Id)).SelectMany(e =>
+ e.Options.SelectMany(o => o.SetPolicy.Select(kv => $"{e.Id}/{o.Id}/set_policy.{kv.Key}=" + kv.Value.ToString("G", System.Globalization.CultureInfo.InvariantCulture))
+ .Concat(o.Effects.Select(fx => $"{e.Id}/{o.Id}/effects.{fx.Target}=" + fx.Delta.ToString("G", System.Globalization.CultureInfo.InvariantCulture)))));
+ Assert.Equal(Inventory.OrderBy(x => x, StringComparer.Ordinal), rows.OrderBy(x => x, StringComparer.Ordinal));
+ Assert.All(Real(false).Events, e => Assert.All(e.Options, o =>
+ { Assert.Empty(o.GrantUnits); Assert.Empty(o.CityEffects); Assert.Empty(o.UnlockProjects); }));
+ }
+ static readonly string[] SourceBytes =
+ {
+ "absorb_immigrants:56880a2e2a96ed94f9131f71e3be55d8f2b27a8cab7aceda83e7cb6b3dd886de",
+ "altalena:7c70e207bcc8b354e5c137e7c7b15d3db1de10f85303e197495615360de397ca",
+ "armistice_egypt:b85f731749e0636502a8d4a10118fbdd9c21f56a6009d6ccc0857fd5591943bc",
+ "armistice_jordan:d6284502a8b49e7463deabd81ee760181451b732bf12db46ead2e838219e4cd4",
+ "armistice_lebanon:e87a66c9df444b0c039b23d2533956d500ca1c277b3ce4236b534b121c24e87e",
+ "armistice_syria:c8424d98187b549a6e7d5d392d9e064bcf6ff0c62d4da3118c940e12ea6300b0",
+ "austerity_1949:f5b0d85ce7fc8772c55f6d235dc8441372083a35e6f51282e63f49b2e17397af",
+ "bernadotte_assassination:9263942438c459aad95b51c2569d1aa89cb2255f7278655e244121044e5755c4",
+ "burma_road_complete:f48054bb7720b93b582cae4e168f13595a4360ee62e91e12815df08de384e6e3",
+ "clothing_rationing_1950:2e33baac62ea7d12e36b9a5fd5237a128139671b8729c4841c967afdfa6dba60",
+ "degania_defence:47233f988033e4a7499e1e3df52a542fe252d2a32a5f1ac8d358887f676d4e23",
+ "education_registration_1951:cce6e7f6ca42058ed265da888258cce7fc40407710bba98e028ad7801a351e11",
+ "elections_1949:959ae7714c1a53a3df6766e6d191bc3490f3fa5b5d2972dd1b965a855106c110",
+ "first_new_yishuv:9edf9e0da02c2feefe11eb52aa056ee64af60a41ac3fa2c283ff976f33d0e0c8",
+ "first_truce:251eaf274e28427c667a1ea46a4d0f3e9f5eefbc4bff8fe1141fc6d8bdf6b378",
+ "forex_crisis_1951:212a675012c6cfb915b960de96d7a2e2eac9622c9652afd7a6ffd4ee2e1ed304",
+ "frumkin_commission:e88bc10c1ae0739c3191fa03a3958f98c7136bd3a1de9e93aaf129ddb8fff55c",
+ "hula_drainage:0b400fda5ce85e202cf2bf7c2557a2ff612f406f33f2f59b24e943636aaf372e",
+ "idf_founding:6777150c6f2cdb064cacd181761f8bb80fa25205c9fc25e523a842a825adae58",
+ "iraqi_exodus:62c43ba683f4981951829a72c0cae97b1ac8f11663472cccf73b46cefc1c60f5",
+ "israel_bonds:b8f95f2ab683a4b88ca36b8a375d168a4bf5921ccb864e5504c45d66821bea08",
+ "jerusalem_ceasefire:79d875217efb2d614538db27b405d9469d46fb61b5288651766611e5559a4643",
+ "jerusalem_demilitarisation_guard:97cc99fc9054ded329be4550248b7cc8d46826581e14f8d1b4554fbd3af4cece",
+ "jerusalem_military_government:322585aeedf0c69b9f81722edebaebbdc0d27ebb4e7b67d275e898607d2cd211",
+ "latrun_proposal:f7612a99e1e6f378e6b9a91f36bb4c31e16de465e8bccb2785fea70bfe4e6932",
+ "law_of_return:d9453c9d4645bfe7b8bd715bbc4aae6d2f5156b72c717317bd6990184b8e61e4",
+ "maabarot_policy:de29ffa17fbc70aa7283b833e546a219b449c8b3e0d712e3d158ed18169d592b",
+ "ministry_supply_crisis:000d54fdc5198b105f101bfa7816a152e2c7682f01a97da67e97988e5ef141db",
+ "operation_hiram:77657ee082201710acf8d1ab25979ddb5571261452e3a8c9ccc5d33e783177b7",
+ "operation_horev:72fb22533fc52e5507502fdce6e84c59cbb0649118b00a1701e5e9b522437678",
+ "operation_yoav:418ea425c461986c0ad2bcf9d493941adc9e22082877506c867b6aab4cf75250",
+ "rafah_force_pressure:ab01fc670aadbb410928c22eccc23f66e785be775dea26a3644c1317b1edb82b",
+ "railway_complete:fb2c0b0edb93217a703a2e9437177943275546c177f5b0751936e3705bca1513",
+ "reparations_claim:b9982aae12edd0f6e2d9f8e4e3273d865d2e9106480fae5824728524edfa4139",
+ "reparations_vote:a79521d61ec59aa72a581b6598ecfade18e8d1e52dc25cef083078b0665a13b3",
+ "rhodes_talks:9ff18db85e108157ab4ff3753fbf42f9933bedb5f021310979d05fae1b731d1c",
+ "second_truce:56c2259ad9af32b4d6d43d22044908611e6b43f2836211350beb125e864b1611",
+ "sinai_withdrawal:29854edb31218257e99417f86f23a6dde91c07a9e66230fa1a1b4a0248b15ac5",
+ "ten_days:805500e569a78c2debd27df872614a153730bdba2360ff94b2edb74ea76c56cb",
+ };
+ [Fact]
+ public void AllThirtyNineSourceRecordsIncludingReviewsAndHebrewAreUnchanged()
+ {
+ var root = Path.Combine(RealContentTests.ContentRoot(), "events");
+ var files = Directory.GetFiles(root, "*.yaml").OrderBy(x => x, StringComparer.Ordinal).ToArray();
+ Assert.Equal(SourceBytes.Select(x => x.Split(':')[0]), files.Select(Path.GetFileNameWithoutExtension));
+ for (int i = 0; i < files.Length; i++)
+ {
+ var bytes = System.Text.Encoding.UTF8.GetBytes(File.ReadAllText(files[i]).Replace("\r\n", "\n"));
+ Assert.Equal(SourceBytes[i].Split(':')[1], Convert.ToHexString(SHA256.HashData(bytes)).ToLowerInvariant());
+ }
+ }
+ [Fact]
+ public void DelegatedHalfShareRoundsAfterScalingAndBorrows()
+ {
+ var c = Load(Files(), Card(option: " effects: [{ target: food, delta: 5 }, { target: treasury, delta: -4 }]\n") + "office: prime_minister\n");
+ foreach (var p in c.People) p.Loyalty = 0;
+ var s = Simulation.NewGame(c, 1, Mode.Historical); s.Food = 0; s.Treasury = 0; s.Debt = 0;
+ var why = new List<Cause>(); EventSystem.Delegate(c, s, why);
+ Assert.Equal(3, s.Food); Assert.Equal(2, s.Debt);
+ Assert.Equal("ok", s.ChosenOptions["probe"]);
+ }
+ [Fact]
+ public void PreviewAndSaveReplayApplyOneGrantAndRejectDuplicateChoice()
+ {
+ var c = Load(Files(), Card(option: " effects: [{ target: food, delta: 3 }]\n"));
+ var session = GameSession.New(c, 1948, Mode.Historical);
+ var command = new ChooseEventOption("probe", "ok");
+ var preview = Simulation.Preview(c, session.State, new Command[] { command });
+ var direct = session.State.Clone(); var why = new List<Cause>();
+ Assert.Null(EventSystem.Choose(c, direct, "probe", "ok", why));
+ Assert.Equal(direct.Hash(), preview.State.Hash());
+ Assert.Equal(EventSystem.OptionEffects(c, session.State, c.Events.Single().Options.Single()).Single().Delta,
+ why.Single(w => w.Target == "food").Delta);
+ Assert.Empty(session.Step(new Command[] { command }).Rejected);
+ var written = session.Save.Write(); var restored = GameSession.Load(c, written, out var warnings);
+ Assert.Empty(warnings); Assert.Equal(written, restored.Save.Write()); Assert.Equal(session.State.Hash(), restored.State.Hash());
+ var duplicate = Simulation.Preview(c, restored.State, new Command[] { command });
+ Assert.Single(duplicate.Rejected); Assert.Equal(restored.State.Hash(), duplicate.State.Hash());
+ }
+
+ [Theory]
+ [InlineData("food", ".nan", ".delta")]
+ [InlineData("arms", ".inf", ".delta")]
+ [InlineData("treasury", "-.inf", ".delta")]
+ [InlineData("morale", ".nan", ".delta")]
+ [InlineData("food", "3000000000", "")]
+ [InlineData("arms", "-3000000000", "")]
+ public void ApprovedTargetsRetainFiniteAndStockRangeChecks(string target, string delta, string suffix)
+ {
+ var ex = Assert.Throws<ContentException>(() => Load(Files(), Card(option: $" effects: [{{ target: {target}, delta: {delta} }}]\n")));
+ Assert.Equal("events/probe.yaml", ex.File);
+ Assert.Equal("events[probe].options[ok].effects." + target + suffix, ex.Field);
+ }
+ [Theory]
+ [InlineData("ruleset: gdd-0.3\nexclusions: [{ id: probe, reason: Fixture, typo: true }]\n")]
+ [InlineData("ruleset: gdd-0.3\nexclusions: [null]\n")]
+ [InlineData("ruleset: gdd-0.3\nexclusions: [\n")]
+ public void MalformedManifestIsAContentError(string text)
+ {
+ var f = Files(); f[Manifest] = text;
+ Assert.Equal(Manifest, Assert.Throws<ContentException>(() => Load(f, Card())).File);
+ }
+ [Fact]
+ public void ExcludedNullOptionIsStillAnError()
+ {
+ var f = Files(); f[Manifest] = Exclude(" - { id: probe, reason: Fixture }\n");
+ Assert.Equal("events/probe.yaml", Assert.Throws<ContentException>(() => Load(f, Card().Replace(" - id: ok", " - null\n - id: ok"))).File);
+ }
+}
diff --git a/sim/Statecraft.Sim.Tests/SchemaTests.cs b/sim/Statecraft.Sim.Tests/SchemaTests.cs
index 9016ffc45..6cffd7054 100644
--- a/sim/Statecraft.Sim.Tests/SchemaTests.cs
+++ b/sim/Statecraft.Sim.Tests/SchemaTests.cs
@@ -142,6 +142,7 @@ public class SchemaTests
public static IEnumerable<object[]> RealFiles()
{
+ yield return new object[] { "gdd03-events.yaml", "gdd03-events.schema.json" };
yield return new object[] { "people.yaml", "people.schema.json" };
yield return new object[] { "offices.yaml", "offices.schema.json" };
yield return new object[] { "parties.yaml", "parties.schema.json" };
@@ -195,6 +196,8 @@ public class SchemaTests
yield return new object[] { "map-overrides.schema.json", "/properties/terrain/items", typeof(TerrainOverride) };
yield return new object[] { "map-overrides.schema.json", "/properties/control/items", typeof(ControlOverride) };
yield return new object[] { "map-overrides.schema.json", "/properties/locations/items", typeof(LocationOverride) };
+ yield return new object[] { "gdd03-events.schema.json", "", typeof(ContentLoader).GetNestedType("Gdd03EventsFile", BindingFlags.NonPublic)! };
+ yield return new object[] { "gdd03-events.schema.json", "/properties/exclusions/items", typeof(ContentLoader).GetNestedType("EventExclusion", BindingFlags.NonPublic)! };
yield return new object[] { "event.schema.json", "", typeof(GameEvent) };
yield return new object[] { "event.schema.json", "/properties/conditions/items", typeof(EventCondition) };
yield return new object[] { "event.schema.json", "/definitions/requirement", typeof(EventRequirement) };
@@ -252,6 +255,17 @@ people:
- { office: prime_minister, from: 1948-05-14, sources: [{ url: ""https://example.org"", checked: 2026-10-09 }] }
";
+ [Fact]
+ public void AvailabilitySchemaRejectsWrongIdentityMissingReasonAndUnknownFields()
+ {
+ const string good = "ruleset: gdd-0.3\nexclusions: [{ id: probe, reason: Fixture }]\n";
+ Assert.Empty(Errors("gdd03-events.schema.json", good));
+ Assert.NotEmpty(Errors("gdd03-events.schema.json", good.Replace("gdd-0.3", "legacy")));
+ Assert.NotEmpty(Errors("gdd03-events.schema.json", good.Replace(", reason: Fixture", "")));
+ Assert.NotEmpty(Errors("gdd03-events.schema.json", good.Replace("Fixture", "' '")));
+ Assert.NotEmpty(Errors("gdd03-events.schema.json", good + "unknown: true\n"));
+ }
+
[Fact]
public void AGoodPersonPasses() => Assert.Empty(Errors("people.schema.json", GoodPerson));
diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.cs
index 024ee462e..834686d30 100644
--- a/sim/Statecraft.Sim/ContentLoader.cs
+++ b/sim/Statecraft.Sim/ContentLoader.cs
@@ -53,6 +53,17 @@ namespace Statecraft.Sim
sealed class ProjectsFile { public List<ProjectKind> Projects { get; set; } = new List<ProjectKind>(); }
sealed class CorridorsFile { public List<CorridorDef> Corridors { get; set; } = new List<CorridorDef>(); }
sealed class ObjectivesFile { public List<Objective> Objectives { get; set; } = new List<Objective>(); }
+ sealed class Gdd03EventsFile
+ {
+ public string Ruleset { get; set; } = "";
+ public List<EventExclusion>? Exclusions { get; set; }
+ }
+ sealed class EventExclusion
+ {
+ public string Id { get; set; } = "";
+ public string Reason { get; set; } = "";
+ }
+
public const string HexesFile = "map/hexes.json";
public const string SettlementHexesFileName = "map/settlement_hexes.yaml";
@@ -370,6 +381,12 @@ namespace Statecraft.Sim
// set without objectives has no file.
// In the file's order, not sorted: it is the order objectives record and their cards fire in (R-OBJ-007, Q-CARD-2).
c.Objectives = ReadOptional<ObjectivesFile>(readFile, ObjectivesFileName)?.Objectives ?? new List<Objective>();
+ // Leave malformed legacy era records to the original validation path (Ruleset needs Systems).
+ if (c.Eras.Count > 0 && c.Eras[0].Systems != null && c.Ruleset == SaveGame.Gdd03Ruleset)
+ {
+ ValidateEras(c); // establish the game-wide identity before consulting its availability manifest
+ ApplyGdd03EventExclusions(readFile, c);
+ }
Validate(c, settlementIds);
if (c.Ruleset == SaveGame.Gdd03Ruleset && c.Gdd03Balance == null)
throw new ContentException(Gdd03BalanceCatalogue.FileName, "(file)", "required for the gdd-0.3 ruleset");
@@ -395,6 +412,52 @@ namespace Statecraft.Sim
return c;
}
+ // R-EFX-001: this file is deliberately never read by legacy/gdd-0.1, including for hashing.
+ // Parse all event sources first: exclusion is availability, not permission to hide malformed YAML.
+ static void ApplyGdd03EventExclusions(Func<string, string?> readFile, Content c)
+ {
+ const string file = "gdd03-events.yaml";
+ var manifest = Read<Gdd03EventsFile>(readFile, file);
+ if (manifest.Ruleset != SaveGame.Gdd03Ruleset)
+ throw new ContentException(file, "ruleset", "must be gdd-0.3");
+ if (manifest.Exclusions == null)
+ throw new ContentException(file, "exclusions", "required: an explicit list (possibly empty)");
+ var sources = new HashSet<string>(StringComparer.Ordinal);
+ foreach (var e in c.Events)
+ {
+ if (!Offices.OfficeId.IsMatch(e.Id)) throw new ContentException(e.File, $"events[{e.Id}].id", IdRule);
+ if (!sources.Add(e.Id)) throw new ContentException(e.File, $"events[{e.Id}].id", "duplicate event id");
+ }
+ var excluded = new HashSet<string>(StringComparer.Ordinal);
+ for (int i = 0; i < manifest.Exclusions.Count; i++)
+ {
+ var row = manifest.Exclusions[i];
+ var at = FormattableString.Invariant($"exclusions[{i}]");
+ if (row == null || string.IsNullOrWhiteSpace(row.Id) || !sources.Contains(row.Id))
+ throw new ContentException(file, at + ".id", "must name an existing event");
+ if (!excluded.Add(row.Id)) throw new ContentException(file, at + ".id", "duplicate exclusion");
+ if (string.IsNullOrWhiteSpace(row.Reason)) throw new ContentException(file, at + ".reason", "required");
+ }
+ // Fail explicitly rather than leaving a mandatory edge pointing into a filtered catalogue.
+ foreach (var e in c.Events.Where(e => !excluded.Contains(e.Id)))
+ {
+ void Reference(string field, string id)
+ {
+ if (excluded.Contains(id)) throw new ContentException(e.File, $"events[{e.Id}].{field}", $"event '{id}' is excluded under gdd-0.3");
+ }
+ for (int i = 0; i < e.Requires.Count; i++)
+ Reference(FormattableString.Invariant($"requires[{i}].event"), e.Requires[i].Event);
+ for (int i = 0; i < e.Variants.Count; i++)
+ for (int j = 0; j < e.Variants[i].When.Count; j++)
+ Reference(FormattableString.Invariant($"variants[{i}].when[{j}].event"), e.Variants[i].When[j].Event);
+ foreach (var o in e.Options) Reference($"options[{o.Id}].rejoin", o.Rejoin);
+ }
+ foreach (var o in c.Objectives)
+ if (excluded.Contains(o.Card)) throw new ContentException(ObjectivesFileName, $"objectives[{o.Id}].card", $"event '{o.Card}' is excluded under gdd-0.3");
+ // Stable removal retains the loader's original ordinal source order. Shared YAML stays available to review tools.
+ c.Events.RemoveAll(e => excluded.Contains(e.Id));
+ }
+
/// <summary>The map editor's overrides (#1009), applied last, once the generated map inputs have been read and
/// checked: terrain and location moves here, so every caller of the sim sees them; control in the map, the only
/// reader of the control file. The file is optional (no file, no overrides) and is in the content hash.</summary>
diff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.cs
index f73f12118..d423a0931 100644
--- a/sim/Statecraft.Sim/EventRules.cs
+++ b/sim/Statecraft.Sim/EventRules.cs
@@ -80,6 +80,8 @@ namespace Statecraft.Sim
throw new ContentException(e.File, F($"options[{o.Id}].alternative"), "an option that did not happen says who proposed it, or basis: design");
foreach (var kv in o.SetPolicy)
{
+ if (c.Ruleset == SaveGame.Gdd03Ruleset && (kv.Key == "rationing" || kv.Key == "maabarot"))
+ throw new ContentException(e.File, F($"options[{o.Id}].set_policy.{kv.Key}"), "retired policy write under gdd-0.3 (R-EFX-001)");
if (c.Policies.All(p => p.Id != kv.Key)) throw new ContentException(e.File, F($"options[{o.Id}].set_policy.{kv.Key}"), "unknown policy");
ContentLoader.Unit(e.File, F($"options[{o.Id}].set_policy.{kv.Key}"), kv.Value);
Active(F($"options[{o.Id}].set_policy.{kv.Key}"), kv.Key);
@@ -87,6 +89,9 @@ namespace Statecraft.Sim
if (o.SetRung.HasValue && (o.SetRung < 1 || o.SetRung > 5)) throw new ContentException(e.File, F($"options[{o.Id}].set_rung"), "must be 1-5");
foreach (var fx in o.Effects)
{
+ // Check before general indicator acceptance: compatibility ids cannot enable commands or readout writes.
+ if (c.Ruleset == SaveGame.Gdd03Ruleset && RetiredGdd03Target(fx.Target))
+ throw new ContentException(e.File, F($"options[{o.Id}].effects.{fx.Target}"), "unsupported event target under gdd-0.3 (R-EFX-001)");
if (!indicators.Contains(fx.Target) && !SpecialTargets.Contains(fx.Target))
throw new ContentException(e.File, F($"options[{o.Id}].effects.{fx.Target}"), "unknown target");
Active(F($"options[{o.Id}].effects.{fx.Target}"), fx.Target);
@@ -103,6 +108,14 @@ namespace Statecraft.Sim
CheckObjectives(c);
}
+ static bool RetiredGdd03Target(string target) =>
+ target == "food_supply" || target == "housing" || target == "fx_reserves" ||
+ target == "attention" || target.StartsWith("attention_", StringComparison.Ordinal) ||
+ target == "budget" || target.StartsWith("budget_", StringComparison.Ordinal) ||
+ target == "passive_budget" || target.StartsWith("passive_budget_", StringComparison.Ordinal) ||
+ target == "food_refill" || target == "automatic_food_refill" ||
+ target == "defeat" || target == "city_loss_defeat" || target == "any_city_loss";
+
/// <summary>The options' structured effects (D-H2): R-EFX-006 refuses a target that does not exist at load, so Resolve
/// never skips one; R-EFX-005 refuses any gain from them on a sensitive event, as R-EFX-002 does for the resources.
/// Called once the GDD files (cities, unit types, sites) are read, so after <see cref="Validate"/>.</summary>
@@ -116,6 +129,9 @@ namespace Statecraft.Sim
static void CheckStructured(Content c, GameEvent e, EventOption o, bool sensitive, Func<string, string> F)
{
if (o.GrantUnits.Count + o.CityEffects.Count + o.UnlockProjects.Count == 0) return;
+ // No approved population/facility accounting adapter exists yet. Do not use the raw legacy mutations.
+ if (c.Ruleset == SaveGame.Gdd03Ruleset)
+ throw new ContentException(e.File, F($"options[{o.Id}].{(o.GrantUnits.Count > 0 ? "grant_units" : o.CityEffects.Count > 0 ? "city_effects" : "unlock_projects")}"), "requires an approved gdd-0.3 accounting contract (R-EFX-001/005)");
// They act on the GDD records (cities.yaml, unit_types.yaml, sites.yaml, projects.yaml), which the legacy loop does not load.
if (!c.IsGdd)
throw new ContentException(e.File, F($"options[{o.Id}].{(o.GrantUnits.Count > 0 ? "grant_units" : o.CityEffects.Count > 0 ? "city_effects" : "unlock_projects")}"), "needs the GDD loop (eras.yaml systems.loop: gdd)");