Remove runtime catalog legacy lookups

This commit is contained in:
Meta Vens 2026-06-16 10:40:39 +01:00
commit 9140f44cf7
6 changed files with 57 additions and 34 deletions

Binary file not shown.

View file

@ -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)

View file

@ -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(

View file

@ -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

View file

@ -8,11 +8,8 @@ namespace GameCult.Aetheria.State.Unity
{
public sealed class AetheriaRuntimeCatalogSnapshot
{
private readonly Dictionary<string, AetheriaRuntimeCatalogItem> _itemsByLegacyId;
private readonly Dictionary<string, AetheriaRuntimeCatalogItem> _itemsByKey;
private readonly Dictionary<string, AetheriaRuntimeCorporation> _corporationsByLegacyId;
private readonly Dictionary<string, AetheriaRuntimeCorporation> _corporationsByKey;
private readonly Dictionary<string, AetheriaRuntimeNameFile> _nameFilesByLegacyId;
private readonly Dictionary<string, AetheriaRuntimeNameFile> _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<AetheriaRuntimeNameFile> 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);

View file

@ -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