From 9140f44cf72c116c316c289d7718d02abb77ee09 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 16 Jun 2026 10:40:39 +0100 Subject: [PATCH] Remove runtime catalog legacy lookups --- .voidbot/state/aetheria.cc | Bin 160658 -> 163351 bytes Aetheria.State.Unity.Smoke/Program.cs | 9 ++++- Aetheria.State.Verify/Program.cs | 35 ++++++++++++++++++ Aetheria.State/README.md | 3 ++ .../Runtime/AetheriaRuntimeCatalogSnapshot.cs | 27 -------------- docs/aetheria-perfect-machine-map.md | 17 ++++++--- 6 files changed, 57 insertions(+), 34 deletions(-) diff --git a/.voidbot/state/aetheria.cc b/.voidbot/state/aetheria.cc index 28f846bf5c1432a8557ad79d04cf1e81b3b6f2f6..d6dcc4fbbbdba8444b4aaff2fd67c6a487286a83 100644 GIT binary patch delta 2817 zcmai0-ES0C6z2{NP>AI#mJhLB5VVE;YHOhu2rg|(Dky}HqEKk=&fJ~7baw7Cccx{v zx>0;EF(!n0xbeX!6n*i72VD{#@WuF~v57|8kdP1)5{(IefFzzfU%RaZUz+KiopaCm zo!|NW&ei*^@}JhPuWPNn{R4gdnccZQxt3||{`cAk@lkhoc*K{!ksL+8TG8^1R-U`u z)l%ZSa4kQT+g8x>a<;f%O0dCAmB3b?>M+aM03qJD2R>Rg)7AEy^R=FsC|E`uR((A%RB_ej8Ufgji4`q}lU zbEDt&aog$BQIG_an0fJ>1nkN-@jt65pDwEM917>aqC&N~bXA?q>__eX-TX4YGS?~} zZbEJHm0!?`Z&TRRtG|B~olMDhsdlwzwmTe^xWOTvD?|wBOTdz#MQLbJ)QkF!Y1EHum#;arIQzR} z;%y73fBF%_KRq7K{=Ctjj;FrCs^F+e0~Wjq6k#=>**M>ZeKN4!-})dW*BRP|bb6TU zz;y#hO z)^Q^e#ZVE`K;h5JpnZyBcb06allRcy_vDXb+A4XWOxrTy+R&s4iEO{7gpoUD z#soU*p5@99ThZ#;0vU*rYWPCIV-~QjVGEHTK&-?w{@cV)FV)PSuZOLQHE#U%x1$(Kg8c6n|NEtlsNdH>{-Fefdx2|CCO=Ry`R5U=MZvDT>S>qersJBExUdFXZ{6)b_UY` delta 1275 zcmaKs!EYBu6vvtUHMK<&h=NvBcpj>4EK6Hre^@bC`Guy^q)1y1jnU3;cYgaDezQBv z%&cWiv@yhsUcf!f9SV5xpr_@g9{2;mm{`I^E*^}B-i`WpfBP$KOuTG%-n{v~_df5< z*uMt9{(bPf+s@vJ`t%!VbWbfBtgh1U!fTy6f|DK4{r`sk-~EYG{O%og_xEXA_g);Weo`NJS>X2Tuw?V?#ZZs3E-D!`(8aM4H913lOR*WmOv1)p?od>jT-Y)0+WzJ_uvf7FA!t;{N1r7lLw5BAa$w)&dFpj&z>dkaD7(%N9>yU% z7Gg66Ru~zDB;2bv6>Dvt%I?n`w5x~7(R}N5a+k~-M0!UjVTg0Hd3rIF9foJZm|_@g zKq(6{W)WU48Wh*Sz+&TE)h>@3Dr8VOWY=DOH@kM}K>oH%$SdT%?EX{Zxm+MiWA)AY zMZ9k4g2^ra_X6hsp*N6?)XG~ zWy8=wKiXsR@pW>ff8RGD3uQ3}kM_Kni!aEZkL}NwoniY=;5=<>${FfCIa8CxlVhiq o^TW1js(giHt=}Hej@&lCS$ck}ozHuwdU-gXH_lIk+qU}3zd|g?AOHXW diff --git a/Aetheria.State.Unity.Smoke/Program.cs b/Aetheria.State.Unity.Smoke/Program.cs index 1982b4d61..1c3d5b63a 100644 --- a/Aetheria.State.Unity.Smoke/Program.cs +++ b/Aetheria.State.Unity.Smoke/Program.cs @@ -44,12 +44,17 @@ if (catalog.EquipmentItems.Count == 0) var shaped = catalog.Items.FirstOrDefault(item => item.ShapeCells.Count > 0) ?? throw new InvalidOperationException("Runtime catalog has no typed shape masks."); -var packageShaped = packageCatalog.FindItemByLegacyId(shaped.LegacyId); +if (string.IsNullOrWhiteSpace(shaped.ItemKey)) +{ + throw new InvalidOperationException($"Runtime shape sample has no typed item key: {shaped.Name}."); +} + +var packageShaped = packageCatalog.FindItem(shaped.ItemKey); if (packageShaped == null || packageShaped.Name != shaped.Name || packageShaped.ShapeCells.Count != shaped.ShapeCells.Count) { - throw new InvalidOperationException($"Package catalog store did not read the expected typed item payload for {shaped.Name}."); + throw new InvalidOperationException($"Package catalog store did not read the expected typed item payload for {shaped.ItemKey}."); } if (shaped.ShapeCells.Count != shaped.OccupiedCells) diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 4569254e9..2d4524ea8 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -12,6 +12,7 @@ RequirePackageSerializerBoundary(root); RequireTypedPendingCommitKeys(root); RequireTypedRuntimeFactionKeys(root); RequireTypedGalaxyFactionRelationships(root); +RequireRuntimeCatalogKeyOnlyLookups(root); RequireEveRuntimeBootstrap(root); RequireNoRendererLocalConsole(root); RequireNoRendererLocalDebugPanels(root); @@ -699,6 +700,40 @@ static void RequireTypedGalaxyFactionRelationships(string root) } } +static void RequireRuntimeCatalogKeyOnlyLookups(string root) +{ + var checkedFiles = new[] + { + Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeCatalogSnapshot.cs"), + Path.Combine(root, "Aetheria.State.Unity.Smoke", "Program.cs") + }; + + var forbiddenSymbols = new[] + { + "_itemsByLegacyId", + "_corporationsByLegacyId", + "_nameFilesByLegacyId", + "FindItemByLegacyId", + "FindCorporationByLegacyId", + "FindNameFileByLegacyId" + }; + + var hits = checkedFiles + .Where(File.Exists) + .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()}") + .ToArray(); + + if (hits.Length > 0) + { + throw new InvalidOperationException( + "Unity runtime catalog snapshot must expose typed-key lookups only; legacy-ID indexes belong to migration boundaries: " + + string.Join("; ", hits)); + } +} + static void RequireEveRuntimeBootstrap(string root) { var bootstrapPath = Path.Combine( diff --git a/Aetheria.State/README.md b/Aetheria.State/README.md index c6317494d..52bec2192 100644 --- a/Aetheria.State/README.md +++ b/Aetheria.State/README.md @@ -120,6 +120,9 @@ fields are deleted. The package runtime catalog snapshot indexes items by canonical item key; Unity gameplay, HUD, inventory, trade, ship, and zone helper lookups use `ItemKey` directly instead of deriving `ItemId` and searching by legacy GUID. +The Unity runtime package snapshot also no longer exposes item, corporation, or +name-file lookup by legacy ID. Canonical legacy-ID lookup remains only in +`Aetheria.State` migration/catalog inspection APIs. The shared runtime item catalog reader is also item-key-only now: its GUID index, `GetRuntimeItem(Guid)` entry point, raw GUID string fallback, `AetheriaRuntimeItemReference(Guid)` constructor, `FromLegacyId`, and reverse diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs index 0731de73b..d6d52748d 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeCatalogSnapshot.cs @@ -8,11 +8,8 @@ namespace GameCult.Aetheria.State.Unity { public sealed class AetheriaRuntimeCatalogSnapshot { - private readonly Dictionary _itemsByLegacyId; private readonly Dictionary _itemsByKey; - private readonly Dictionary _corporationsByLegacyId; private readonly Dictionary _corporationsByKey; - private readonly Dictionary _nameFilesByLegacyId; private readonly Dictionary _nameFilesByKey; public AetheriaRuntimeCatalogSnapshot( @@ -26,21 +23,12 @@ namespace GameCult.Aetheria.State.Unity TradeItems = items.Where(item => item.Price > 0).ToArray(); EquipmentItems = items.Where(item => !string.IsNullOrWhiteSpace(item.HardpointType)).ToArray(); - _itemsByLegacyId = items - .Where(item => !string.IsNullOrWhiteSpace(item.LegacyId)) - .ToDictionary(item => item.LegacyId, StringComparer.OrdinalIgnoreCase); _itemsByKey = items .Where(item => !string.IsNullOrWhiteSpace(item.ItemKey)) .ToDictionary(item => item.ItemKey, StringComparer.OrdinalIgnoreCase); - _corporationsByLegacyId = corporations - .Where(corporation => !string.IsNullOrWhiteSpace(corporation.LegacyId)) - .ToDictionary(corporation => corporation.LegacyId, StringComparer.OrdinalIgnoreCase); _corporationsByKey = corporations .Where(corporation => !string.IsNullOrWhiteSpace(corporation.CorporationKey)) .ToDictionary(corporation => corporation.CorporationKey, StringComparer.OrdinalIgnoreCase); - _nameFilesByLegacyId = nameFiles - .Where(nameFile => !string.IsNullOrWhiteSpace(nameFile.LegacyId)) - .ToDictionary(nameFile => nameFile.LegacyId, StringComparer.OrdinalIgnoreCase); _nameFilesByKey = nameFiles .Where(nameFile => !string.IsNullOrWhiteSpace(nameFile.NameFileKey)) .ToDictionary(nameFile => nameFile.NameFileKey, StringComparer.OrdinalIgnoreCase); @@ -56,31 +44,16 @@ namespace GameCult.Aetheria.State.Unity public IReadOnlyList NameFiles { get; } - public AetheriaRuntimeCatalogItem? FindItemByLegacyId(string legacyId) - { - return TryGet(_itemsByLegacyId, legacyId); - } - public AetheriaRuntimeCatalogItem? FindItem(string itemKey) { return TryGet(_itemsByKey, itemKey); } - public AetheriaRuntimeCorporation? FindCorporationByLegacyId(string legacyId) - { - return TryGet(_corporationsByLegacyId, legacyId); - } - public AetheriaRuntimeCorporation? FindCorporation(string corporationKey) { return TryGet(_corporationsByKey, corporationKey); } - public AetheriaRuntimeNameFile? FindNameFileByLegacyId(string legacyId) - { - return TryGet(_nameFilesByLegacyId, legacyId); - } - public AetheriaRuntimeNameFile? FindNameFile(string nameFileKey) { return TryGet(_nameFilesByKey, nameFileKey); diff --git a/docs/aetheria-perfect-machine-map.md b/docs/aetheria-perfect-machine-map.md index 0bbe71bbb..90e386991 100644 --- a/docs/aetheria-perfect-machine-map.md +++ b/docs/aetheria-perfect-machine-map.md @@ -693,9 +693,11 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted. ID fields demoted to compatibility. The package runtime catalog snapshot now indexes items by canonical item key, and Unity gameplay/UI/zone helper lookups resolve `ItemKey` directly rather than deriving legacy GUIDs for - `FindItemByLegacyId`. The shared runtime item catalog reader no longer has a - GUID index or `GetRuntimeItem(Guid)` entry point; item-key strings are the - only lookup authority; + `FindItemByLegacyId`. The package snapshot no longer exposes item, + corporation, or name-file `Find*ByLegacyId` indexes; legacy-ID lookup remains + only on the canonical `Aetheria.State` migration/catalog inspection boundary. + The shared runtime item catalog reader no longer has a GUID index or + `GetRuntimeItem(Guid)` entry point; item-key strings are the only lookup authority; there is no remaining `ItemInstance.Data` identity/backing field. The reader interface for this bridge is named `IRuntimeItemCatalogReader` and exposes only typed catalog row lookup. Behavior @@ -1559,8 +1561,10 @@ First Aetheria surfaces to publish: Unity smoke without any item legacy-ID commit fields. - Done: add package runtime catalog lookup by canonical item key and move Unity gameplay, HUD, inventory, trade, ship, and zone helper lookups off - `ItemId`/`FindItemByLegacyId` detours. Legacy item lookup remains only as - a catalog/migration compatibility API. + `ItemId`/`FindItemByLegacyId` detours. The Unity runtime package catalog + snapshot no longer exposes item/corporation/name-file legacy-ID lookup; + legacy lookup remains only as a canonical `Aetheria.State` + catalog/migration inspection API. - Done: move server-shared weapon grouping, generated loadout previous-item reuse, and hauling task item target identity off derived item GUIDs and onto typed `ItemKey` strings. @@ -1745,6 +1749,9 @@ First Aetheria surfaces to publish: no `Faction.Allegiance` GUID dictionary, GUID faction containment, GUID faction resolver, or `CorporationLegacyId` relationship read may return to the live `Galaxy`/`LoadoutGenerator` path. +- `Aetheria.State.Verify` guards Unity runtime catalog lookup authority: + package snapshots may expose typed-key lookup only, while legacy-ID lookup + remains quarantined in canonical migration/catalog inspection APIs. - Unity batchmode compile returned cleanly after the runtime blueprint rename; live Unity source has no `EntityPack`, `ShipPack`, `OrbitalEntityPack`, `ZonePack`, `PackedContents`, `PackZone`, `EntitySerializer.Pack`, or