From 9714f36e6107ed27797b0f7bc1bf6ce1f839807b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 15 Jun 2026 20:43:59 +0100 Subject: [PATCH] Guard gameplay source purity --- .voidbot/state/aetheria.cc | Bin 133668 -> 135385 bytes Aetheria.State.Verify/Program.cs | 44 +++++++++++++++++++++++++++ Aetheria.State/README.md | 6 +++- docs/aetheria-perfect-machine-map.md | 5 +++ 4 files changed, 54 insertions(+), 1 deletion(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 84ab1a0b09f9b9251165d1779ecf3c71ddc5c9d0..9e4695e8256993139d748b12c351ee74ef32c177 100644 GIT binary patch delta 1469 zcmZ8hJ!~9B6lQGW*ic}h*dPSxL5j%A-TBT22h5M;B!&cVu+ApJ6iBnPvv(uU&MY&t zHfIV4r3^*HMp_{#i1-T;NI`-`kr2p5QqYiw;wV5=l*AM%F>im)c2bq3oGm{9rPrWMEl}uXRrQ+UKD21aBS||@)PkZGh8?ec!6X&o@1&7# z-XNpH5Ktj4h#>jyqtWEnFZ(uHMz2}$C|iMfZY^!`1$?f+NxtT^vN~`Tc*Sb@Y`T}&Ilz$~(RP(rOzToC0T zv$-i572_}KGqg#Fvz0kJUUqXN&i?TPd@+c9hAQhi!+faQq8xM zn$9=HNh)|>5{kuMUin=5&pa8sKQD~6YgqpDHhH9XIiJlh=Wpe)ovP=@R`(C4hqj3> hlcws2^YfZs+a~Y#G8iV`FNB2^krKgtqgsGaclFi 1 ? Path.GetFullPath(args[1]) : AetheriaStatePaths.ResolveDefaultStatePath(root); +RequireGameplaySourcePurity(root); + await using var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-state-verify"); var ledger = await node.GetMigrationLedgerAsync() @@ -442,6 +444,7 @@ Console.WriteLine($"Corporations: {corporations.Length}"); Console.WriteLine($"Described/geoname-linked corporations: {describedCorporations}/{corporationNameLinks}"); Console.WriteLine($"Corporation allegiance edges: {corporationAllegianceEdges}"); Console.WriteLine($"Name files: {nameFiles.Length}"); +Console.WriteLine("Live gameplay source purity: no serializer or legacy database symbols in Assets/Scripts"); static void RequireCount(AetheriaMigrationLedger ledger, string documentType, int actual) { @@ -458,6 +461,47 @@ static void RequireCount(AetheriaMigrationLedger ledger, string documentType, in } } +static void RequireGameplaySourcePurity(string root) +{ + var gameplayRoot = Path.Combine(root, "Assets", "Scripts"); + if (!Directory.Exists(gameplayRoot)) + { + throw new InvalidOperationException($"Cannot verify live gameplay source purity; missing path: {gameplayRoot}"); + } + + var forbiddenSymbols = new[] + { + "MessagePack", + "MessagePackObject", + "MessagePackSerializer", + "MessagePackReader", + "IMessagePackFormatter", + "JsonConvert", + "Newtonsoft", + "JsonKnownTypes", + "RethinkDB", + "DatabaseEntry", + "DatabaseLink", + "[Union(", + "[Key(" + }; + + var hits = Directory.EnumerateFiles(gameplayRoot, "*.cs", SearchOption.AllDirectories) + .SelectMany(path => File.ReadLines(path) + .Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line })) + .Where(line => forbiddenSymbols.Any(symbol => line.Line.Contains(symbol, StringComparison.Ordinal))) + .Select(line => $"{Path.GetRelativePath(root, line.Path)}:{line.LineNumber}: {line.Line.Trim()}") + .Take(10) + .ToArray(); + + if (hits.Length > 0) + { + throw new InvalidOperationException( + "Live gameplay source still contains serializer or legacy database symbols: " + + string.Join("; ", hits)); + } +} + static bool ContainsBehaviorValueKind(AetheriaBehaviorValue value, string kind) { return string.Equals(value.Kind, kind, StringComparison.OrdinalIgnoreCase) || diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index 8535d2283..32969fdba 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -280,7 +280,11 @@ payload tree, and the published Eve catalog surface. The current catalog materializes 65 behavior payloads, 661 behavior fields, and 18 behavior-side legacy-ID references. Legacy content currently includes at least one overhanging hardpoint; the verifier preserves the payload and checks hardpoint local masks -rather than silently converting content repair into migration. +rather than silently converting content repair into migration. The verifier also +fails if live `Assets/Scripts` source grows back serializer or legacy database +symbols such as MessagePack, Newtonsoft, JsonKnownTypes, RethinkDB, or old +`DatabaseEntry`/`DatabaseLink` references; the remaining MessagePack usage is a +named package/import CultCache transport boundary, not gameplay state authority. Use it after import when `GameData/aetheria-world.cc` changes. `Aetheria.State.Unity.Smoke` opens the materialized state through the runtime diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index e1ed6dcfe..3d436b202 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -1596,6 +1596,11 @@ First Aetheria surfaces to publish: auto-reference; `Assets/Scripts` and `Assets/Editor` have no `using MessagePack`, `MessagePackSerializer`, `[MessagePackObject]`, or `IMessagePackFormatter` hits. +- `Aetheria.State.Verify` now enforces the gameplay-source purity invariant: + live `Assets/Scripts` cannot contain MessagePack, Newtonsoft, + JsonKnownTypes, RethinkDB, old database-link symbols, or serializer metadata. + Package/import MessagePack usage remains explicitly bounded to CultCache + transport and migration. - Unity batchmode compile returned cleanly after the runtime blueprint rename; live Unity source has no `EntityPack`, `ShipPack`, `OrbitalEntityPack`, `ZonePack`, `PackedContents`, `PackZone`, `EntitySerializer.Pack`, or