Require typed keys in pending runtime commits
This commit is contained in:
parent
01fc810eb4
commit
a16b0559d4
7 changed files with 60 additions and 69 deletions
Binary file not shown.
|
|
@ -9,6 +9,7 @@ var statePath = args.Length > 1
|
|||
|
||||
RequireGameplaySourcePurity(root);
|
||||
RequirePackageSerializerBoundary(root);
|
||||
RequireTypedPendingCommitKeys(root);
|
||||
RequireEveRuntimeBootstrap(root);
|
||||
RequireNoRendererLocalConsole(root);
|
||||
RequireNoRendererLocalDebugPanels(root);
|
||||
|
|
@ -583,6 +584,44 @@ static void RequirePackageSerializerBoundary(string root)
|
|||
}
|
||||
}
|
||||
|
||||
static void RequireTypedPendingCommitKeys(string root)
|
||||
{
|
||||
var checkedFiles = new[]
|
||||
{
|
||||
Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeStateCommitDocument.cs"),
|
||||
Path.Combine(root, "Aetheria.State", "AetheriaRuntimeCommitLogApplier.cs")
|
||||
};
|
||||
|
||||
var forbiddenSymbols = new[]
|
||||
{
|
||||
"CorporationLegacyId",
|
||||
"OrbitLegacyId",
|
||||
"ParentLegacyId",
|
||||
"BodyLegacyId",
|
||||
"ResourceScannerTargetBodyId { get; set; }",
|
||||
"MiningToolAsteroidBeltId { get; set; }",
|
||||
"ReferenceKey(entity.FactionKey",
|
||||
"ReferenceKey(orbit.OrbitKey",
|
||||
"ReferenceKey(body.BodyKey",
|
||||
"ReferenceKey(relationship.FactionKey"
|
||||
};
|
||||
|
||||
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(
|
||||
"Pending runtime commit authority still accepts legacy ID fallback fields: " +
|
||||
string.Join("; ", hits));
|
||||
}
|
||||
}
|
||||
|
||||
static void RequireEveRuntimeBootstrap(string root)
|
||||
{
|
||||
var bootstrapPath = Path.Combine(
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
{
|
||||
Name = entity.Name ?? "",
|
||||
Kind = entity.Kind ?? "",
|
||||
FactionKey = ReferenceKey(entity.FactionKey ?? "", "aetheria.corporation", entity.CorporationLegacyId ?? ""),
|
||||
FactionKey = entity.FactionKey ?? "",
|
||||
Hull = ToLoadoutItem(entity.Hull),
|
||||
Equipment = ToItemSlots(entity.Equipment),
|
||||
CargoBays = ToItemSlots(entity.CargoBays),
|
||||
|
|
@ -315,8 +315,8 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
return (orbits ?? Array.Empty<AetheriaRuntimeOrbitSnapshotCommit>())
|
||||
.Select(orbit => new AetheriaOrbitSnapshot
|
||||
{
|
||||
OrbitId = ReferenceKey(orbit.OrbitKey ?? "", "aetheria.orbit", orbit.OrbitLegacyId ?? ""),
|
||||
ParentId = ReferenceKey(orbit.ParentOrbitKey ?? "", "aetheria.orbit", orbit.ParentLegacyId ?? ""),
|
||||
OrbitId = orbit.OrbitKey ?? "",
|
||||
ParentId = orbit.ParentOrbitKey ?? "",
|
||||
Distance = orbit.Distance,
|
||||
Phase = orbit.Phase,
|
||||
FixedPosition = new AetheriaVector2
|
||||
|
|
@ -336,10 +336,10 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
return (bodies ?? Array.Empty<AetheriaRuntimeBodySnapshotCommit>())
|
||||
.Select(body => new AetheriaBodySnapshot
|
||||
{
|
||||
BodyId = ReferenceKey(body.BodyKey ?? "", "aetheria.body", body.BodyLegacyId ?? ""),
|
||||
BodyId = body.BodyKey ?? "",
|
||||
Kind = body.Kind ?? "",
|
||||
Name = body.Name ?? "",
|
||||
OrbitId = ReferenceKey(body.OrbitKey ?? "", "aetheria.orbit", body.OrbitLegacyId ?? ""),
|
||||
OrbitId = body.OrbitKey ?? "",
|
||||
Mass = body.Mass,
|
||||
Resources = ToBodyResources(body.Resources),
|
||||
BodyRadiusMultiplier = body.BodyRadiusMultiplier,
|
||||
|
|
@ -490,7 +490,7 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
TractorPower = entity.TractorPower,
|
||||
Heatstroke = entity.Heatstroke,
|
||||
Hypothermia = entity.Hypothermia,
|
||||
FactionKey = ReferenceKey(entity.FactionKey ?? "", "aetheria.corporation", entity.CorporationLegacyId ?? ""),
|
||||
FactionKey = entity.FactionKey ?? "",
|
||||
HullItemKey = entity.HullItemKey ?? "",
|
||||
Equipment = ToEntityItemSlots(entity.Equipment),
|
||||
CargoBays = ToEntityItemSlots(entity.CargoBays),
|
||||
|
|
@ -569,19 +569,13 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
AetherDriveMaximumRpm = state.AetherDriveMaximumRpm,
|
||||
AetherDriveThrustDirectionX = state.AetherDriveThrustDirectionX,
|
||||
AetherDriveThrustDirectionY = state.AetherDriveThrustDirectionY,
|
||||
ResourceScannerTargetBodyId = ReferenceKey(
|
||||
state.ResourceScannerTargetBodyKey ?? "",
|
||||
"aetheria.body",
|
||||
state.ResourceScannerTargetBodyId ?? ""),
|
||||
ResourceScannerTargetBodyId = state.ResourceScannerTargetBodyKey ?? "",
|
||||
ResourceScannerAsteroidIndex = state.ResourceScannerAsteroidIndex,
|
||||
ResourceScannerScanTime = state.ResourceScannerScanTime,
|
||||
ResourceScannerRange = state.ResourceScannerRange,
|
||||
ResourceScannerMinimumDensity = state.ResourceScannerMinimumDensity,
|
||||
ResourceScannerScanDuration = state.ResourceScannerScanDuration,
|
||||
MiningToolAsteroidBeltId = ReferenceKey(
|
||||
state.MiningToolAsteroidBeltKey ?? "",
|
||||
"aetheria.body",
|
||||
state.MiningToolAsteroidBeltId ?? ""),
|
||||
MiningToolAsteroidBeltId = state.MiningToolAsteroidBeltKey ?? "",
|
||||
MiningToolAsteroidIndex = state.MiningToolAsteroidIndex,
|
||||
MiningToolRange = state.MiningToolRange,
|
||||
ThrusterAxis = state.ThrusterAxis,
|
||||
|
|
@ -713,7 +707,7 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
return (relationships ?? Array.Empty<AetheriaRuntimeFactionRelationshipCommit>())
|
||||
.Select(relationship => new AetheriaFactionRelationshipState
|
||||
{
|
||||
FactionKey = ReferenceKey(relationship.FactionKey ?? "", "aetheria.corporation", relationship.CorporationLegacyId ?? ""),
|
||||
FactionKey = relationship.FactionKey ?? "",
|
||||
Relationship = relationship.Relationship ?? "",
|
||||
Standing = relationship.Standing
|
||||
})
|
||||
|
|
@ -740,18 +734,6 @@ public static class AetheriaRuntimeCommitLogApplier
|
|||
return new CultRecordKey($"global:aetheria.run_state.{StableToken(runId)}.zone.{zoneIndex}.entity.{entityIndex}.v1");
|
||||
}
|
||||
|
||||
private static string ReferenceKey(string documentName, string legacyId)
|
||||
{
|
||||
return string.IsNullOrWhiteSpace(legacyId) ? "" : $"{documentName}:legacy:{legacyId}";
|
||||
}
|
||||
|
||||
private static string ReferenceKey(string typedKey, string documentName, string legacyId)
|
||||
{
|
||||
return !string.IsNullOrWhiteSpace(typedKey)
|
||||
? typedKey
|
||||
: ReferenceKey(documentName, legacyId);
|
||||
}
|
||||
|
||||
private static string StableToken(string value)
|
||||
{
|
||||
var chars = (string.IsNullOrWhiteSpace(value) ? "unnamed" : value.Trim().ToLowerInvariant())
|
||||
|
|
|
|||
|
|
@ -102,22 +102,19 @@ Unity runtime commit DTOs carry typed `ItemKey`/`HullItemKey` fields only for
|
|||
loadout items, action-bar targets, body resources, entity hulls, and active
|
||||
consumables; the commit applier no longer reconstructs item keys from legacy
|
||||
item GUID fields.
|
||||
Unity runtime commit DTOs now also carry typed `FactionKey` for loadout
|
||||
Unity runtime commit DTOs now carry typed `FactionKey` only for loadout
|
||||
entities, run entity snapshots, and faction relationship state. The old
|
||||
`CorporationLegacyId` fields remain compatibility-only for older pending
|
||||
commits; current Unity projection does not write them.
|
||||
pending-command `CorporationLegacyId` fallback fields are deleted.
|
||||
`EntityConstructionBlueprint` also carries `FactionKey` now. Loadout restore and
|
||||
entity construction resolve factions by typed key first, with the old GUID
|
||||
field kept as compatibility for construction callers that have not yet been
|
||||
lowered.
|
||||
Run checkpoint commit DTOs carry typed `OrbitKey`, `ParentOrbitKey`, and
|
||||
`BodyKey` for zone orbit/body snapshots. The old `OrbitLegacyId`,
|
||||
`ParentLegacyId`, and `BodyLegacyId` fields remain compatibility-only for older
|
||||
pending commits; current Unity projection does not write them.
|
||||
Behavior-state runtime commits carry typed body keys for resource scanner targets
|
||||
and mining tool asteroid belts. The old raw body ID commit fields remain
|
||||
compatibility-only for older pending commits; current Unity projection does not
|
||||
write them.
|
||||
`BodyKey` only for zone orbit/body snapshots. The old pending-command
|
||||
`OrbitLegacyId`, `ParentLegacyId`, and `BodyLegacyId` fallback fields are
|
||||
deleted. Behavior-state runtime commits carry typed body keys for resource
|
||||
scanner targets and mining tool asteroid belts; the old raw body ID commit
|
||||
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.
|
||||
|
|
|
|||
|
|
@ -1510,7 +1510,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
return new AetheriaRuntimeEntityLoadoutSnapshot(
|
||||
entity.Name ?? "",
|
||||
entity.Kind ?? "",
|
||||
ReferenceKey(entity.FactionKey ?? "", "aetheria.corporation", entity.CorporationLegacyId ?? ""),
|
||||
entity.FactionKey ?? "",
|
||||
CreateRuntimeLoadoutItemSnapshot(entity.Hull),
|
||||
CreateRuntimeLoadoutItemSlotSnapshots(entity.Equipment),
|
||||
CreateRuntimeLoadoutItemSlotSnapshots(entity.CargoBays),
|
||||
|
|
|
|||
|
|
@ -139,9 +139,6 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[Key(1)]
|
||||
public string Kind { get; set; } = "";
|
||||
|
||||
[Key(2)]
|
||||
public string CorporationLegacyId { get; set; } = "";
|
||||
|
||||
[Key(3)]
|
||||
public AetheriaRuntimeLoadoutItemCommit Hull { get; set; } = new AetheriaRuntimeLoadoutItemCommit();
|
||||
|
||||
|
|
@ -277,9 +274,6 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[MessagePackObject]
|
||||
public sealed class AetheriaRuntimeFactionRelationshipCommit
|
||||
{
|
||||
[Key(0)]
|
||||
public string CorporationLegacyId { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public string Relationship { get; set; } = "";
|
||||
|
||||
|
|
@ -358,12 +352,6 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[MessagePackObject]
|
||||
public sealed class AetheriaRuntimeOrbitSnapshotCommit
|
||||
{
|
||||
[Key(0)]
|
||||
public string OrbitLegacyId { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public string ParentLegacyId { get; set; } = "";
|
||||
|
||||
[Key(2)]
|
||||
public double Distance { get; set; }
|
||||
|
||||
|
|
@ -386,18 +374,12 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[MessagePackObject]
|
||||
public sealed class AetheriaRuntimeBodySnapshotCommit
|
||||
{
|
||||
[Key(0)]
|
||||
public string BodyLegacyId { get; set; } = "";
|
||||
|
||||
[Key(1)]
|
||||
public string Kind { get; set; } = "";
|
||||
|
||||
[Key(2)]
|
||||
public string Name { get; set; } = "";
|
||||
|
||||
[Key(3)]
|
||||
public string OrbitLegacyId { get; set; } = "";
|
||||
|
||||
[Key(4)]
|
||||
public double Mass { get; set; }
|
||||
|
||||
|
|
@ -582,9 +564,6 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[Key(7)]
|
||||
public double DirectionY { get; set; }
|
||||
|
||||
[Key(8)]
|
||||
public string CorporationLegacyId { get; set; } = "";
|
||||
|
||||
[Key(10)]
|
||||
public IReadOnlyList<AetheriaRuntimeLoadoutItemSlotCommit> Equipment { get; set; } = Array.Empty<AetheriaRuntimeLoadoutItemSlotCommit>();
|
||||
|
||||
|
|
@ -891,9 +870,6 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[Key(30)]
|
||||
public double AetherDriveThrustDirectionY { get; set; }
|
||||
|
||||
[Key(31)]
|
||||
public string ResourceScannerTargetBodyId { get; set; } = "";
|
||||
|
||||
[Key(32)]
|
||||
public int ResourceScannerAsteroidIndex { get; set; } = -1;
|
||||
|
||||
|
|
@ -909,9 +885,6 @@ namespace GameCult.Aetheria.State.Unity
|
|||
[Key(36)]
|
||||
public double ResourceScannerScanDuration { get; set; }
|
||||
|
||||
[Key(37)]
|
||||
public string MiningToolAsteroidBeltId { get; set; } = "";
|
||||
|
||||
[Key(38)]
|
||||
public int MiningToolAsteroidIndex { get; set; } = -1;
|
||||
|
||||
|
|
|
|||
|
|
@ -554,8 +554,8 @@ legacy catalog cache, and legacy UI paths should be migration-only or deleted.
|
|||
consumables. The older `ItemDefinitionLegacyId` and
|
||||
`HullItemDefinitionLegacyId` fields have been deleted from the pending commit
|
||||
contract; the applier no longer reconstructs item keys from legacy item GUIDs.
|
||||
Corporation legacy IDs still translate to typed corporation record keys at
|
||||
the commit boundary.
|
||||
Corporation legacy ID fallback fields are also deleted from pending runtime
|
||||
commit DTOs; current commands must publish typed faction keys directly.
|
||||
- Entity restore and loadout manufacturer-distance weighting no longer read
|
||||
legacy `Faction` entries through `ItemManager`; they use `Galaxy.ResolveFaction`
|
||||
over the typed corporation projection.
|
||||
|
|
@ -1356,8 +1356,8 @@ First Aetheria surfaces to publish:
|
|||
typed item-key strings; runtime body resource commit projection no longer
|
||||
calls `FromLegacyId`.
|
||||
- Done: move resource scanner targets and mining tool asteroid belts to
|
||||
typed body-key runtime commit fields; raw body ID commit fields are now
|
||||
compatibility-only fallback input.
|
||||
typed body-key runtime commit fields; raw body ID pending-command fields
|
||||
are deleted.
|
||||
- Done: delete the old `ItemData`/`EquippableItemData`/`HullData`/
|
||||
`WeaponItemData` DTO hierarchy from live Unity source; shared runtime
|
||||
geometry/stat primitives now live in `RuntimeGeometry.cs`.
|
||||
|
|
|
|||
Loading…
Reference in a new issue