Remove invented scenario cargo authority

This commit is contained in:
Meta Vens 2026-07-16 03:47:28 +01:00
commit c2a4bd46f0
7 changed files with 84 additions and 172 deletions

View file

@ -1478,22 +1478,22 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
var homes = new Dictionary<string, int> { ["forge"] = 0, ["foreign"] = 1 };
var adjacency = new Dictionary<int, IReadOnlyList<int>> { [0] = [1], [1] = [0] };
var first = new AetheriaDaemonLoadoutGenerator(catalog, 42, 0, homes, adjacency).Build("ship", "forge", []);
var second = new AetheriaDaemonLoadoutGenerator(catalog, 42, 0, homes, adjacency).Build("ship", "forge", []);
var station = new AetheriaDaemonLoadoutGenerator(catalog, 84, 0, homes, adjacency).Build("station", "forge", []);
var first = new AetheriaDaemonLoadoutGenerator(catalog, 42, 0, homes, adjacency).Build("ship", "forge");
var second = new AetheriaDaemonLoadoutGenerator(catalog, 42, 0, homes, adjacency).Build("ship", "forge");
var station = new AetheriaDaemonLoadoutGenerator(catalog, 84, 0, homes, adjacency).Build("station", "forge");
var fallbackStation = new AetheriaDaemonLoadoutGenerator(fallbackCatalog, 84, 0, homes, adjacency)
.Build("station", "forge", []);
.Build("station", "forge");
var uninterruptedForge = new AetheriaDaemonLoadoutGenerator(catalog, 101, 0, homes, adjacency);
var interleavedForge = new AetheriaDaemonLoadoutGenerator(catalog, 101, 0, homes, adjacency);
var foreignStream = new AetheriaDaemonLoadoutGenerator(catalog, 202, 1, homes, adjacency);
var uninterruptedSequence = new[]
{
uninterruptedForge.Build("ship", "forge", []),
uninterruptedForge.Build("ship", "forge", [])
uninterruptedForge.Build("ship", "forge"),
uninterruptedForge.Build("ship", "forge")
};
var interleavedFirst = interleavedForge.Build("ship", "forge", []);
foreignStream.Build("ship", "foreign", []);
var interleavedSecond = interleavedForge.Build("ship", "forge", []);
var interleavedFirst = interleavedForge.Build("ship", "forge");
foreignStream.Build("ship", "foreign");
var interleavedSecond = interleavedForge.Build("ship", "forge");
RequireEqual("available-hull", first.HullItemKey,
"loadout generation must exclude manufacturers outside the faction allegiance graph");
@ -1509,6 +1509,8 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
Require(first.HullItemKey == second.HullItemKey &&
first.Equipment.Select(value => value.ItemKey).SequenceEqual(second.Equipment.Select(value => value.ItemKey)),
"same seed, map, faction and catalog must produce the same loadout");
Require(first.Cargo.Length == 0 && first.Receipt.Selections.All(value => value.Role != "cargo"),
"ordinary generated ships must not acquire cargo from non-canonical scenario aliases");
Require(first.Receipt.Seed == 42 && first.Receipt.SourceZoneIndex == 0 &&
first.Receipt.AvailabilityFactionKey == "forge" &&
first.Receipt.Selections.Any(value => value.Role == "hull" && value.ItemKey == "available-hull" &&
@ -1524,8 +1526,12 @@ internal sealed class AetheriaDaemonYmirSmokeChecks
Require(fallbackStation.Equipment.Any(value => value.ItemKey == "ship-sensor"),
"a smaller sensor must remain a valid fallback when it fits inside a larger same-type hardpoint");
Require(station.Cargo.Length > 0 && station.Cargo.Length <= cargo.InteriorOccupiedCells &&
station.Cargo.All(value => value.Item.ItemKey != "cheap-foreign-hull"),
"station inventory draws must respect cargo capacity and exclude unavailable manufacturers");
station.Cargo.All(value => value.Item.ItemKey != "cheap-foreign-hull" &&
catalog.FindItem(value.Item.ItemKey) != null) &&
station.Receipt.Selections.Where(value => value.Role == "cargo")
.Select(value => value.ItemKey)
.SequenceEqual(station.Cargo.Select(value => value.Item.ItemKey)),
"station inventory draws must use canonical catalog keys, respect cargo capacity, exclude unavailable manufacturers, and preserve exact provenance");
Require(LoadoutKeys(uninterruptedSequence[0]).SequenceEqual(LoadoutKeys(interleavedFirst)) &&
LoadoutKeys(uninterruptedSequence[1]).SequenceEqual(LoadoutKeys(interleavedSecond)),
"generation in another faction stream must not perturb this faction's continuing loadout sequence");

View file

@ -31,8 +31,7 @@ public sealed class AetheriaDaemonLoadoutGenerator
public AetheriaDaemonLoadout Build(
string entityKind,
string availabilityFactionKey,
IReadOnlyList<string> scenarioCargo)
string availabilityFactionKey)
{
var hullType = string.Equals(entityKind, "station", StringComparison.OrdinalIgnoreCase) ? "Station" : "Ship";
var hull = Pick(availabilityFactionKey, 0, item =>
@ -80,7 +79,7 @@ public sealed class AetheriaDaemonLoadoutGenerator
AddFreeSpaceItem(hull, availabilityFactionKey, occupied, slots, 2, item =>
IsGear(item) && HasBehavior(item, "Capacitor"));
var cargo = PackCargo(cargoBay, availabilityFactionKey, scenarioCargo,
var cargo = PackCargo(cargoBay, availabilityFactionKey,
string.Equals(entityKind, "station", StringComparison.OrdinalIgnoreCase));
var selectedKeys = new[] { (Role: "hull", Key: hull.ItemKey) }
.Concat(slots.Select(value => (Role: "equipment", Key: value.ItemKey)))
@ -172,15 +171,9 @@ public sealed class AetheriaDaemonLoadoutGenerator
private AetheriaLoadoutItemSlot[] PackCargo(
AetheriaRuntimeCatalogItem cargoBay,
string factionKey,
IReadOnlyList<string> scenarioCargo,
bool includeStationInventory)
{
var candidates = new List<AetheriaRuntimeCatalogItem>();
foreach (var key in scenarioCargo ?? Array.Empty<string>())
{
var item = _catalog.FindItem(key);
if (item != null) candidates.Add(item);
}
if (includeStationInventory)
{
var pool = Available(factionKey)

View file

@ -215,18 +215,18 @@ internal static class AetheriaDaemonZoneGenerator
var entities = new[]
{
Entity(loadouts, availabilityFactions, "Anchor Station", "station", -50, -30, 0, 0, "player", 760, keys[6], [keys[1], keys[2], keys[3], keys[4], keys[6], keys[7], keys[11]], ["repair-parts", "reactor-fuel", "drone-core"]),
Entity(loadouts, availabilityFactions, "Vanguard One", "ship", -40, -30, 0, 0, "player", 540, keys[6], [keys[0], keys[2], keys[4], keys[6], keys[7]], ["coilgun-ammo", "field-rations"]),
Entity(loadouts, availabilityFactions, "Wing Two", "ship", 145, 125, -5, 7, "player", 450, keys[6], [keys[0], keys[1], keys[6], keys[8]], ["sensor-buoy", "shield-cell"]),
Entity(loadouts, availabilityFactions, "Torch Three", "ship", -235, 210, 8, -4, "player", 500, keys[7], [keys[0], keys[1], keys[7]], ["micro-missile", "coolant-pack"]),
Entity(loadouts, availabilityFactions, "Foundry Tug", "ship", 330, -155, -2, 3, "player", 390, keys[6], [keys[0], keys[1], keys[6], keys[10]], ["ore-canister", "field-rations"]),
Entity(loadouts, availabilityFactions, "Derelict Relay", "station", -390, 270, 0, 0, "neutral", 160, "", [keys[0], keys[3]], ["ancient-transponder"]),
Entity(loadouts, availabilityFactions, "Ash Raider", "ship", 20, -30, -5, -2, "raider", 320, "", [keys[0], keys[1], keys[2], keys[4]], []),
Entity(loadouts, availabilityFactions, "Cinder Knife", "ship", 585, -115, -7, 1, "raider", 280, "", [keys[0], keys[3]], ["volatile-fuel"]),
Entity(loadouts, availabilityFactions, "Blackwake", "ship", 690, 300, -4, -3, "raider", 230, "", [keys[2]], ["ore-cache", "burned-relay-core"]),
Entity(loadouts, availabilityFactions, "Vesper Sloop", "ship", 960, 620, -3, -5, "raider", 250, "", [keys[4]], ["stolen-map-fragment"]),
Entity(loadouts, availabilityFactions, "Survey Skiff", "ship", -610, -365, 3, 5, "neutral", 210, "", [keys[4], keys[5]], ["soil-sample", "deep-scan"]),
Entity(loadouts, availabilityFactions, "Lagrange Beacon", "station", 105, 510, 0, 0, "neutral", 190, "", [keys[0], keys[1], keys[6]], ["navigation-key"])
Entity(loadouts, availabilityFactions, "Anchor Station", "station", -50, -30, 0, 0, "player", 760, keys[6], [keys[1], keys[2], keys[3], keys[4], keys[6], keys[7], keys[11]]),
Entity(loadouts, availabilityFactions, "Vanguard One", "ship", -40, -30, 0, 0, "player", 540, keys[6], [keys[0], keys[2], keys[4], keys[6], keys[7]]),
Entity(loadouts, availabilityFactions, "Wing Two", "ship", 145, 125, -5, 7, "player", 450, keys[6], [keys[0], keys[1], keys[6], keys[8]]),
Entity(loadouts, availabilityFactions, "Torch Three", "ship", -235, 210, 8, -4, "player", 500, keys[7], [keys[0], keys[1], keys[7]]),
Entity(loadouts, availabilityFactions, "Foundry Tug", "ship", 330, -155, -2, 3, "player", 390, keys[6], [keys[0], keys[1], keys[6], keys[10]]),
Entity(loadouts, availabilityFactions, "Derelict Relay", "station", -390, 270, 0, 0, "neutral", 160, "", [keys[0], keys[3]]),
Entity(loadouts, availabilityFactions, "Ash Raider", "ship", 20, -30, -5, -2, "raider", 320, "", [keys[0], keys[1], keys[2], keys[4]]),
Entity(loadouts, availabilityFactions, "Cinder Knife", "ship", 585, -115, -7, 1, "raider", 280, "", [keys[0], keys[3]]),
Entity(loadouts, availabilityFactions, "Blackwake", "ship", 690, 300, -4, -3, "raider", 230, "", [keys[2]]),
Entity(loadouts, availabilityFactions, "Vesper Sloop", "ship", 960, 620, -3, -5, "raider", 250, "", [keys[4]]),
Entity(loadouts, availabilityFactions, "Survey Skiff", "ship", -610, -365, 3, 5, "neutral", 210, "", [keys[4], keys[5]]),
Entity(loadouts, availabilityFactions, "Lagrange Beacon", "station", 105, 510, 0, 0, "neutral", 190, "", [keys[0], keys[1], keys[6]])
};
foreach (var index in new[] { 1, 2, 3, 4 })
entities[index].HomeEntityKey = keys[0];
@ -300,11 +300,10 @@ internal static class AetheriaDaemonZoneGenerator
string faction,
double visibility,
string target,
string[] contactKeys,
string[] cargo)
string[] contactKeys)
{
var availabilityFaction = availabilityFactions[faction];
var loadout = loadouts[availabilityFaction].Build(kind, availabilityFaction, cargo);
var loadout = loadouts[availabilityFaction].Build(kind, availabilityFaction);
return new AetheriaEntitySnapshot
{
Name = name,

View file

@ -2422,137 +2422,6 @@ static async Task<bool> ApplyRequestedTerminusSessionAsync(
return true;
}
static async Task EnsureStarbridgeSessionDocumentsAsync(
AetheriaStateNode node,
AetheriaDaemonHostOptions options)
{
var existingScenario = await node.MutableDocument<AetheriaRuntimeStarbridgeScenarioDocument>(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest).ReadAsync().ConfigureAwait(false);
var existingSession = await node.MutableDocument<AetheriaRuntimeStarbridgeSessionDocument>(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest).ReadAsync().ConfigureAwait(false);
if (existingScenario != null &&
string.Equals(existingScenario.Schema, AetheriaRuntimeDaemonSchemas.StarbridgeScenario, StringComparison.Ordinal) &&
existingSession != null &&
string.Equals(existingSession.Schema, AetheriaRuntimeDaemonSchemas.StarbridgeSession, StringComparison.Ordinal))
{
return;
}
const string runId = "local-starbridge";
var baseEntityKey = EntityKey(runId, 0, 0);
var pilotOneKey = EntityKey(runId, 0, 1);
var pilotTwoKey = EntityKey(runId, 0, 2);
var pilotThreeKey = EntityKey(runId, 0, 3);
var scenario = new AetheriaRuntimeStarbridgeScenarioDocument
{
ScenarioId = "starbridge.frontier-fabricator",
DisplayName = "Frontier Fabricator Defense",
StartingBaseKey = baseEntityKey,
StationStock =
[
new AetheriaRuntimeStarbridgeStationStockItem
{
ItemKey = "repair-parts",
Quantity = 4,
Quality = 1,
Durability = 1
},
new AetheriaRuntimeStarbridgeStationStockItem
{
ItemKey = "drone-core",
Quantity = 2,
Quality = 0.9,
Durability = 1
},
new AetheriaRuntimeStarbridgeStationStockItem
{
ItemKey = "coolant-pack",
Quantity = 3,
Quality = 0.85,
Durability = 1
},
new AetheriaRuntimeStarbridgeStationStockItem
{
ItemKey = "shield-cell",
Quantity = 2,
Quality = 0.95,
Durability = 1
}
],
AvailableShipKeys = [pilotOneKey, pilotTwoKey, pilotThreeKey],
AttackerMixKeys = ["scout", "skirmisher", "bomber", "siege-craft", "breach-drone"],
RecoveredTechnologyPoolKeys =
[
"sensor-calibration",
"missile-rack-burst",
"coolant-chain",
"repair-drone-armor"
],
Waves =
[
new AetheriaRuntimeStarbridgeWaveDefinition
{
WaveIndex = 0,
DisplayName = "Scout Probe",
AttackerKeys = ["scout"],
StartsAfterSeconds = 30,
BossKey = "scout-captain",
RecoveredTechnologyKeys = ["sensor-calibration"]
},
new AetheriaRuntimeStarbridgeWaveDefinition
{
WaveIndex = 1,
DisplayName = "Bomber Line",
AttackerKeys = ["bomber", "skirmisher"],
StartsAfterSeconds = 150,
BossKey = "bomber-frame",
RecoveredTechnologyKeys = ["missile-rack-burst", "coolant-chain"]
},
new AetheriaRuntimeStarbridgeWaveDefinition
{
WaveIndex = 2,
DisplayName = "Breach Mother",
AttackerKeys = ["breach-drone", "siege-craft"],
StartsAfterSeconds = 300,
BossKey = "breach-mother",
RecoveredTechnologyKeys = ["repair-drone-armor"]
}
],
RuntimeRoles =
[
new AetheriaRuntimeStarbridgeRuntimeRole
{
RuntimeId = "starbridge.commander",
Role = "commander"
},
new AetheriaRuntimeStarbridgeRuntimeRole
{
RuntimeId = "starbridge.pilot.0",
Role = "pilot",
EntityKey = pilotOneKey
}
]
};
var session = new AetheriaRuntimeStarbridgeSessionDocument
{
SessionId = options.SessionId,
ScenarioId = scenario.ScenarioId,
RunId = runId,
BaseEntityKey = baseEntityKey,
StationEntityKey = baseEntityKey,
Phase = "pre-wave",
CurrentWaveIndex = 0,
RuntimeRoles = scenario.RuntimeRoles
};
await node.MutableDocument<AetheriaRuntimeStarbridgeScenarioDocument>(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest)
.ReplaceAsync(scenario)
.ConfigureAwait(false);
await node.MutableDocument<AetheriaRuntimeStarbridgeSessionDocument>(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest)
.ReplaceAsync(session)
.ConfigureAwait(false);
await node.FlushAsync().ConfigureAwait(false);
}
static async Task EnsureVerseAuthorityPolicyAsync(
AetheriaStateNode node,
AetheriaDaemonHostOptions options)
@ -2935,11 +2804,6 @@ static bool HasTerminusRun(AetheriaRuntimeRunCheckpointCommit? run)
bodies.Length >= 10;
}
static string EntityKey(string runId, int zoneIndex, int entityIndex)
{
return $"global:aetheria.run_state.{runId}.zone.{zoneIndex}.entity.{entityIndex}.v1";
}
static AetheriaRuntimeLoadoutItemSlotCommit[] ToEntitySlotCommits(
IReadOnlyList<AetheriaEntityItemSlot>? slots)
{

View file

@ -2448,6 +2448,19 @@ remains CultMesh work. The fog contract and provider shader execute, but the
current brown-black output is not visual parity with the fossil's blue gravity
sea.
Generated loadouts accept no scenario-authored cargo strings. Catalog selection
is the only loadout item-key owner: ordinary ships begin without generated
cargo, stations draw typed faction-available inventory, and both cargo slots and
selection receipts carry the same canonical catalog keys. Scenario flavor may
later select a typed loot table or authored item key, but it cannot silently
invent identity. `scripts/verify-aetheria-daemon.ps1` restores and runs the
daemon smoke with one explicit CultLib/EveUnity/Ymir root set so a stale NuGet
project graph cannot substitute another worktree during `--no-restore`.
The unused Starbridge bootstrap that wrote invented stock, attacker, boss, and
technology keys has been deleted. A future Starbridge mode must enter through
the active daemon game-mode owner and typed catalogs; a dormant document seeder
is not a game mode.
Ymir restart ownership is deliberately private and asymmetric:
- Owner: `AetheriaYmirPersistenceCoordinator` owns reconstruction durability;

View file

@ -17,7 +17,7 @@ validation proves contract shape, not wiring, exclusivity, lowering, or parity.
|---|---|---|---|---|---|---|
| Run/session state | `ServerShared`, `ActionGameManager` | Aetheria daemon/CultCache | provider/session advertisement | all clients | owner-exists; wired; projected; not proven | restart and multi-client convergence |
| Entity identity/loadout | `ServerShared/Entity*` | daemon | typed entity and inventory surfaces | EveUnity/Electron | owner-exists; wired; projected; not proven | loadout round trip and reconnect |
| Loadout generation | map/faction availability, item cost, hull hardpoints and role constraints | daemon using canonical galaxy, faction knowledge/economy and typed catalog | generated loadout plus provenance/availability facts | Eve inspection and refit surfaces | daemon now uses the fossil candidate filter and seeded weighted selection: manufacturer must be present and allied, ally weight decays by home-zone graph distance, price uses the authored exponent, and hardpoints require matching semantic type, rotated footprint containment, and controller role; generation fills the largest compatible footprint before applying economic weighting, so small gear remains a valid large-mount fallback without displacing available station-scale gear; cargo/capacitor plus station docking equipment must fit remaining hull space; stations draw up to sixteen faction-available equipment rows and pack largest-first into the selected cargo bay's actual interior shape; zone generation derives one continuing deterministic RNG stream per availability corporation, so cross-faction calls cannot perturb another faction; every generated entity persists an immutable source/selection receipt that reaches Eve as `loadout.item` semantics; Terminus explicitly maps combat-role factions to catalog availability corporations | multi-zone generated-world parity and exact root-to-zone stream sequencing against the fossil |
| Loadout generation | map/faction availability, item cost, hull hardpoints and role constraints | daemon using canonical galaxy, faction knowledge/economy and typed catalog | generated loadout plus provenance/availability facts | Eve inspection and refit surfaces | daemon now uses the fossil candidate filter and seeded weighted selection: manufacturer must be present and allied, ally weight decays by home-zone graph distance, price uses the authored exponent, and hardpoints require matching semantic type, rotated footprint containment, and controller role; generation fills the largest compatible footprint before applying economic weighting, so small gear remains a valid large-mount fallback without displacing available station-scale gear; cargo/capacitor plus station docking equipment must fit remaining hull space; stations draw up to sixteen faction-available equipment rows and pack largest-first into the selected cargo bay's actual interior shape; ordinary ships begin without generated cargo, and the deleted scenario-string path can no longer silently invent non-catalog item identities; station cargo slots and receipts preserve the same canonical keys; zone generation derives one continuing deterministic RNG stream per availability corporation, so cross-faction calls cannot perturb another faction; every generated entity persists an immutable source/selection receipt that reaches Eve as `loadout.item` semantics; Terminus explicitly maps combat-role factions to catalog availability corporations | multi-zone generated-world parity and exact root-to-zone stream sequencing against the fossil |
| Flight intent | `Ship`, `Thruster`, `AetherDrive`, input paths | daemon intent + Ymir physics | analog movement/look/tractor | EveUnity input driver | movement intents feed Ymir-owned body integration; authored thrust allocation, torque, energy and heat remain simplified | prove original drive/equipment behavior ordering and runtime interpolation |
| Collision | Unity physics and entity handlers | Ymir | collision/result facts | visual interpolation only | Ymir.Core world stepping wired for entity bodies, radial fields and contacts; missing-owner negative proof passes | publish authoritative collision events and prove Unity cannot write transforms back |
| Targeting/contacts | sensors + `ActionGameManager` | daemon | contact/target semantics | target HUD and indicators | simplified owner wired/projected; daemon weapon lock now acquires and decays from facing, elapsed time, and observer-local contact confidence instead of granting an immediate perfect lock; the provider cockpit projects that same selected-target lock through a generic Eve progress component without client smoothing or reconstruction | target-switch reset, angular decay, visibility/nearest/explicit cases, lock transition events, and authored reticle animation |

View file

@ -0,0 +1,37 @@
param(
[string] $CultLibRoot = "E:\Projects\CultLib",
[string] $EveUnityRoot = "E:\Projects\EveUnity",
[string] $YmirRoot = "E:\Projects\Ymir"
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$project = Join-Path $repoRoot "Aetheria.State.Daemon.Smoke\Aetheria.State.Daemon.Smoke.csproj"
foreach ($dependency in @(
@{ Name = "CultLib"; Path = $CultLibRoot },
@{ Name = "EveUnity"; Path = $EveUnityRoot },
@{ Name = "Ymir"; Path = $YmirRoot }
)) {
if (-not (Test-Path -LiteralPath $dependency.Path -PathType Container)) {
throw "$($dependency.Name) root does not exist: $($dependency.Path)"
}
}
$properties = @(
"-p:CultLibRoot=$CultLibRoot",
"-p:EveUnityRoot=$EveUnityRoot",
"-p:YmirRoot=$YmirRoot"
)
& dotnet restore $project @properties
if ($LASTEXITCODE -ne 0) {
throw "Aetheria daemon dependency restore failed with exit code $LASTEXITCODE."
}
& dotnet run --project $project @properties --no-restore
if ($LASTEXITCODE -ne 0) {
throw "Aetheria daemon smoke failed with exit code $LASTEXITCODE."
}
Write-Host "Aetheria daemon dependency-root and simulation verification passed."