Map: body facts for compound stacks and commodity stacking; Extracted.Body no longer named

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
soul 2026-11-27 18:50:17 +01:00
commit f0119a3599

View file

@ -98,12 +98,33 @@ Probe: throwaway tests `ZzZoneKeyProbe` / `ZzZoneKeyOverlapProbe` in a detached
- Identity now: `ZoneGenerator` writes each body and orbit with a keyless `cache.Upsert`; CultCache mints `Guid.NewGuid().ToString("N")` for a document it holds no handle for (`CultCache.CreateStoredDocument`). A body's `Name` ([CultName]) is the key's first eight characters. Nothing reads a body's `Name`; nothing calls `GetByName` on a body type. CultCache refuses shared index values, not shared names.
- Three readers hash a body's key and so carry its randomness: `FireControl.Extract` (ore weights: StableHash of `field:index:ore`), `Entity.ByIndexThenField` (chunk tie-break on `CultRecordKey.GetHashCode`, which is .NET's process-randomized string hash, so the order differs between processes even for one key) and `DrawAhead.DrawListOf` (which rock meshes a belt draws). `FieldKinds.Ensure` already takes a seed-derived site (`{seed}:belt:{index}`, `:swarm:`, `:lane:`), except on first load of a kindless belt, where `Zone` passes the key.
- Readers that keep keys as opaque identity: `ZonePack.Planets`/`Orbits`, `ChunkId.Field`, `ChunkWearPack.Field`, `Extracted.Body` (lot provenance), `Zone.Planets`/`AsteroidBelts`, `ZoneRenderer._beltDraw`, `WellNode`. No CultNet contract and nothing in `native/aetherlight` names a body.
- Readers that keep keys as opaque identity: `ZonePack.Planets`/`Orbits`, `ChunkId.Field`, `ChunkWearPack.Field`, `Zone.Planets`/`AsteroidBelts`, `ZoneRenderer._beltDraw`, `WellNode`. No CultNet contract and nothing in `native/aetherlight` names a body.
- The run store holds two runs at once: `RunSave.Replace` starts a new run with the saved run's records still stored and, on success, removes the saved keys; `RunSave.Beside` runs a simulation beside it. Every scenario but InfiniteFunLand is `Saved` with a fixed `Seed`, so replaying one while its save exists generates the same zone seed into the same keyspace. A key that is a pure function of the seed would be upserted over the saved run's body, and Replace would then delete the new run's body.
- Baseline at e32b04d5d, DemoTerminus seed 1, cap 300 s, starter fit, two calls in each of two processes: rocks 32/32/32/31, units 131/133/131/129, hold full 160.42/160.42/160.42/148.28 s, sell 1255/3099/1261/1577. Seed 2: sell 16/16 in one process and 11/11 in the other.
- Prototype (a persisted `BodyData.Site` that the generator writes, `SiteOr(key)` in Extract, tie-break and DrawAhead, names from `StableHash(Site)`): seed 1 rocks 32, units 131, hold full 160.42 s and sell 1734 in all four samples. Seed 2 sold 13 in all four.
- Same seed generated twice into one store (the shape of Replace), prototype: 11 bodies, then 22. Keys are disjoint, both generations' sites and names are equal, the first generation's documents are still held at their keys, and the duplicate names are admitted.
## Body facts: compound stacks (nibu-imagination, 2026-11-27, at 6702b01bf)
Probe: throwaway test `ZzImagStackProbe` in the detached worktree `F:\aeth-wt\imag-compound-stacks` (CultLib 7225835d, CultMath f1edfa45), with `CompoundCommodity` given `[Key(13)] Quantity { get; set; } = 1`, `SimpleCommodity.Quantity` made a property and `CompoundCommodityData` given `[Key(12)] MaxStack = 10`; reverted after. Spec: `aetheria-living-world:cut_spec:cut-compound-commodity-stacks.r2`.
- A pre-cut `CompoundCommodity` (union arm 1, 12 slots, lot in slot 11, hand-written bytes) reads with `Lot` 42 and `Quantity` 1: a missing trailing key keeps the property initializer. A new one round-trips `Lot` 7, `Quantity` 5 (22 bytes); its JSON gains `"quantity"`.
- `SimpleCommodity.Quantity` as an auto-property writes the same three-slot array as the field (`92 00 93 A5 probe 00 09`), and all eight `FungibleCommodityTests` pass with it, the pre-ruling 3- and 12-slot reads included.
- The shipped catalog loads with the extra `CompoundCommodityData` slot: 63 compound records, every `MaxStack` 10 (CultCache `CompatibleDrift` defaults the missing slot; precedent `HullData.Kind`, fba7bd1b4, added a slot with no catalog rewrite). Simple records: `MaxStack` 10 on 47, 5 on 3.
- Keys taken on the item side: `ItemInstance` 0-1; `CraftedItemInstance` 2, 9, 10 retired, 11 `Lot`; `EquippableItem` 7, 8, 12; keys 3-6 held fields removed before 2026-09 (Ingredients, Name, Blueprint, SourceEntity). So `CompoundCommodity.Quantity` takes 13. On the design side `CraftedItemData` holds 9 (`Roles`) and `CompoundCommodityData` retired 10 and 11, so its `MaxStack` takes 12.
- No live path mints more than one compound unit per lot today: `ItemManager.CreateInstance(int lot)` returns one unit, station stock draws only equippables (`LoadoutGenerator` 142-150), and the only other compound source is the debug console (`ActionGameManager` 606). Stacking matters once a producer mints a lot of N units; the cut builds the bay rule ahead of it, as ruling compound-commodities-stack-by-lot orders.
- Bay entry points at base: `EquippedCargoBay` has typed public overloads for `SimpleCommodity` and `CraftedItemInstance` (Entity.cs 2477-2740). A `CompoundCommodity` binds statically to the crafted overloads, so any stack rule added beside them can be bypassed by a caller holding a typed compound; the cut makes the typed entries private behind the `ItemInstance` dispatchers.
- Diamond: the only raw recipe with a compound output (Diamond, `station-kind:mining`, no inputs, workforce 12, cycle 1200); its record key is minted (`8776c2fd-...`), and a recipe key is `recipe:<output key>`. Gun Barrel (fabrication) takes Gun Forging x1 and Diamond x1. `EconomyChecks` L-source-sink and L-consumer-demand would judge a Cut Diamond that nothing uses.
## Body facts: commodity stacking (nibu-imagination, 2026-11-27, at 587d19f52)
Probe: throwaway test `ZzImagCommodProbe` in the detached worktree `F:\aeth-wt\imag-commod-lots` (CultLib 7225835d), shipped catalog through `AetherDb.Open()`, plus source reads. Spec: `aetheria-living-world:cut_spec:cut-simple-commodities-fungible.r1`.
- Serialization: `CultUnionGuard` (CultLib `GameCult.Caching.MessagePack/CultUnionGuard.cs`) refuses an undeclared union arm on read ("Union Provenance has no arm for key 7"). So deleting the `Extracted` arm (key 2) outright would make every run ledger saved with a mined stack unloadable. An arm with fewer fields than the payload reads it (Attributed, one field, read a three-slot payload), and a concrete item reads an array longer than its keys, skipping the extra slots (CompoundCommodity read 14 slots and took slot 11). So an empty retired arm loads old Extracted lots, and a SimpleCommodity without key 11 loads an old lot-stamped stack.
- CultCache's schema id is a fingerprint of a document's top-level members only (`CultCache.BuildSemanticFingerprint`): `ProvenanceLedger` is `NextLot` plus `Dictionary<int, Lot>`, so reshaping a provenance arm or an item instance changes no schema id.
- Shipped catalog: 50 simple and 63 compound commodities. The 19 commodities field kinds yield (Regolith, Troilite, Nickel-Iron, Pentlandite, Chalcopyrite, Sperrylite, Ilmenite, Anorthite, Native Copper, Orthoclase, Uraninite, Brannerite, Monazite, Columbite, Wolframite, Magnetite, Sylvite, Native Gold, Isoferroplatinum) are exactly the simple commodities with a raw recipe at `station-kind:mining`. Water, Methane and Ammonia are raw at `volatiles` and no field yields them. Diamond is a compound commodity with a raw mining recipe and no field yields it. Mining Rights, Travel Permit, Local Newscast and SpaceCast are compound.
- Lot writers on simple stacks at base: only `FireControl.Extract` (via `ItemManager.ExtractedLot`). Copiers: bay split (`EquippedCargoBay.Remove`), restore split (`EntitySerializer.RestoreStack`/`SpillOversize`). Readers: the bay's merge test (two sites), `StationServices.OreStacks`, `EconomyLoop.Ammunition`, `RunSave.Commit` roots, `CargoGain.Lot` (no reader outside tests). `Produced` has no writer; `Brand` and `Reachable` read it.
## Stale and missing
- `docs/aetheria-living-world-target.md` (the target r2 DocRef, commit d61948f6) lives only on `origin/eureka/aetheria-living-world-target`; master has no copy. The target r2 statement of L-recipe ("inputs are commodities except in gear, hull and consumer-good recipes, which take roles") and L-roles are already contradicted by live code: intermediate commodities take roles through `RecipeData.RoleInputs` (ruling `ores-fill-metal-roles`). The next target revision should restate them.