Fence package serializer boundary
This commit is contained in:
parent
9714f36e61
commit
b130df9557
4 changed files with 56 additions and 0 deletions
Binary file not shown.
|
|
@ -8,6 +8,7 @@ var statePath = args.Length > 1
|
|||
: AetheriaStatePaths.ResolveDefaultStatePath(root);
|
||||
|
||||
RequireGameplaySourcePurity(root);
|
||||
RequirePackageSerializerBoundary(root);
|
||||
|
||||
await using var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-state-verify");
|
||||
|
||||
|
|
@ -445,6 +446,7 @@ Console.WriteLine($"Described/geoname-linked corporations: {describedCorporation
|
|||
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");
|
||||
Console.WriteLine("Package serializer boundary: MessagePack symbols remain in named CultCache transport files only");
|
||||
|
||||
static void RequireCount(AetheriaMigrationLedger ledger, string documentType, int actual)
|
||||
{
|
||||
|
|
@ -502,6 +504,51 @@ static void RequireGameplaySourcePurity(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequirePackageSerializerBoundary(string root)
|
||||
{
|
||||
var packageRuntimeRoot = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime");
|
||||
if (!Directory.Exists(packageRuntimeRoot))
|
||||
{
|
||||
throw new InvalidOperationException($"Cannot verify package serializer boundary; missing path: {packageRuntimeRoot}");
|
||||
}
|
||||
|
||||
var allowedFiles = new HashSet<string>(StringComparer.Ordinal)
|
||||
{
|
||||
"AetheriaRuntimeCatalogStore.cs",
|
||||
"AetheriaRuntimePendingCultCacheStore.cs",
|
||||
"AetheriaRuntimeStateCommitDocument.cs",
|
||||
"AetheriaRuntimeEveCommandDocument.cs"
|
||||
};
|
||||
|
||||
var serializerSymbols = new[]
|
||||
{
|
||||
"MessagePack",
|
||||
"MessagePackObject",
|
||||
"MessagePackSerializer",
|
||||
"MessagePackReader",
|
||||
"MessagePackWriter",
|
||||
"IMessagePackFormatter",
|
||||
"[Union(",
|
||||
"[Key("
|
||||
};
|
||||
|
||||
var hits = Directory.EnumerateFiles(packageRuntimeRoot, "*.cs", SearchOption.AllDirectories)
|
||||
.Where(path => !allowedFiles.Contains(Path.GetFileName(path)))
|
||||
.SelectMany(path => File.ReadLines(path)
|
||||
.Select((line, index) => new { Path = path, LineNumber = index + 1, Line = line }))
|
||||
.Where(line => serializerSymbols.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(
|
||||
"Package serializer symbols escaped the named CultCache transport boundary: " +
|
||||
string.Join("; ", hits));
|
||||
}
|
||||
}
|
||||
|
||||
static bool ContainsBehaviorValueKind(AetheriaBehaviorValue value, string kind)
|
||||
{
|
||||
return string.Equals(value.Kind, kind, StringComparison.OrdinalIgnoreCase) ||
|
||||
|
|
|
|||
|
|
@ -285,6 +285,10 @@ 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.
|
||||
The package boundary is also fenced: MessagePack symbols may only appear in the
|
||||
runtime catalog reader, pending CultCache envelope store, and typed runtime/Eve
|
||||
command document files until generated CultCache serializers replace that
|
||||
temporary Unity-side codec.
|
||||
Use it after import when `GameData/aetheria-world.cc` changes.
|
||||
|
||||
`Aetheria.State.Unity.Smoke` opens the materialized state through the runtime
|
||||
|
|
|
|||
|
|
@ -1601,6 +1601,11 @@ First Aetheria surfaces to publish:
|
|||
JsonKnownTypes, RethinkDB, old database-link symbols, or serializer metadata.
|
||||
Package/import MessagePack usage remains explicitly bounded to CultCache
|
||||
transport and migration.
|
||||
- `Aetheria.State.Verify` also fences the Unity package serializer boundary:
|
||||
MessagePack symbols may appear only in `AetheriaRuntimeCatalogStore`,
|
||||
`AetheriaRuntimePendingCultCacheStore`, `AetheriaRuntimeStateCommitDocument`,
|
||||
and `AetheriaRuntimeEveCommandDocument` until CultLib generated serializers
|
||||
become the Unity runtime owner.
|
||||
- Unity batchmode compile returned cleanly after the runtime blueprint rename;
|
||||
live Unity source has no `EntityPack`, `ShipPack`, `OrbitalEntityPack`,
|
||||
`ZonePack`, `PackedContents`, `PackZone`, `EntitySerializer.Pack`, or
|
||||
|
|
|
|||
Loading…
Reference in a new issue