The Imagination pass over cultcache-migration-target.md: answers to its eight questions with evidence from CultLib and its canonical packages, the CultLib store-routing authority map, the wire-parity plan, ten sequenced cuts with failing-first tests, negative checks and build budgets, a subtraction ledger, and rejected paths. Two corrections on review: Cut 0 is already done (6bd3e176,560779a4), and Cut 7 adds an LFS rule for .cc before committing the catalog. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
56 KiB
CultCache Migration Cut
Date: 2026-09-12
Status: cut map. Ends are owned by cultcache-migration-target.md; this
document owns the means. Nothing here is cut until the operator commits the
five pending ServerShared edits (Cut 0).
Evidence base: CultLib main at c2a9a6e; Aetheria codex/aetheria-state-rebuild
at 68fbce4a plus five uncommitted files. Line numbers refer to those revisions.
Canonical runtimes are the C# reference under CultLib\src and the packages
under CultLib\packages (cultcache-ts, cultcache-rs, cultcache-py,
cultnet-*, cultmesh-*). The neighboring repos F:\Projects\cultcache-rs,
cultcache-py, cultnet-rs, cultnet-ts are defunct copies (operator
correction, 2026-09-12): no parity claim, no evidence, and no cut in this
document refers to them, and the target document's list is being corrected.
1. Answers to the open questions
Q1. Is routing a C# behavior or a cross-runtime semantic?
Routing is a cache semantic every sibling already has. C# is the outlier, and no bytes change.
- TypeScript routes by type:
addBackingStore(store, ...types)and#resolveRoutepick the stores registered for the type, else the untyped stores; the first is primary, the rest are mirrors (CultLib\packages\cultcache-ts\src\cult-cache.ts:180-192, 663-677, writes at401-402, 447-448, 502-503). - Rust routes the same way (
packages\cultcache-rs\src\lib.rs:1950-1963, 2363-2380); batch puts require exactly one route per type and one store per batch (2174-2186). Its README claims this "mirrors the C# behavior" (packages\cultcache-rs\README.md:216-241); that claim is false today. - Python keeps
stores_by_typeandgeneric_storesand writes to every store in the resolved list (packages\cultcache-py\src\cultcache_py\cache.py:23-24, 100-105, 199-201, 300-302). - C# replicates every record to every attached store
(
CultLib\src\GameCult.Caching\CultCache.cs:2097-2101, 2135-2139) and pushes all entries into a newly attached store (1436-1439). The typed overloadAddBackingStore(CacheBackingStore, Type[])existed in the pre-rewrite C# cache (it survives as a dead symbol intests\GameCult.Networking.Tests\lcov.info:460) and was dropped byda94389 Rewrite CultCache as attribute-first storage. - No runtime writes store identity into the file. Every runtime writes the same
snapshot
[formatVersion, catalog[], records[]]with records[key, schemaId, storedAt, payload](C#CultDocumentMessagePackSerialization.cs:180-251; TSsingle-file-messagepack-backing-store.ts:203-232; Rustlib.rs:244-280, 2401-2455; Pythonstores.py:137-152).storeIdis an optional header field in the contract (cultcache-persistence-format.md:93) that nothing implements. The CultNet wire record is likewiseschemaId + key(packages\cultnet-rs\src\replication.rs:36-60).
Decision: routing is written into the contract as a cache composition rule,
not a wire rule. C# adopts one home store per type with no mirrors, which is a
strict subset of what TS and Rust do. Sibling caches change no code; the
cultcache-rs README sentence is corrected. Every .cc file a routed cache emits
is a complete single-store file readable by any runtime, and that is the parity
claim to test (section 3).
Q2. How do Unity.Mathematics values encode portably?
As fixed-length positional arrays of components, which is already Aetheria's wire shape. CultMath defines no encoding and is not adopted in this migration.
- Aetheria's formatters write
float2as[f32,f32],float3as three,float4as four,int2as[int,int],bool2as[bool,bool](Aetheria\Assets\Scripts\ServerShared\CultCache\Serialization\MathFormatters.cs:8, 49, 90, 131, 177);MathResolver.csmaps the types, nullables, arrays and lists, with one bug at:55(int2?[]mapped toArrayFormatter<float2?>).bool2[,]goes through MessagePack'sTwoDimensionalArrayFormatteras[len0, len1, [flat...]]. - CultMath lives at
CultLib\packages\cultmath(float2,float3,float4,int2,bool2,double2/3,quaternion,rect,Color32,Random) with no MessagePack attributes, formatters, ext types, or serde in its Rust core. No sibling runtime defines a vector shape. - The persisted member type name is the CLR full name
(
CultGeneratedDocumentMetadata.cs:258-282, used atCultCache.cs:710), so afloat2member hashes into the schema id asUnity.Mathematics.float2. That is the existing rule for every member (System.Int32and friends); the generator does the same (CultDocumentMessagePackGenerator.cs:354-384). A sibling would have to emit the same string only if it declared the same schema, and none does. - CultLib has no consumer formatter extension point:
Optionsis astatic readonlycomposite ofCultDocumentResolverandStandardResolver(CultDocumentMessagePackSerialization.cs:50-55), and generated serializers read that same static at call time (CultDocumentMessagePackGenerator.cs:290, 308).
Decision: Cut 3 adds one registration call that composes consumer resolvers
ahead of StandardResolver before the first serialization, and the contract
gains a rule: vector-like value types encode as fixed-length positional arrays
of primitive components; no ext types, no maps. Aetheria keeps
Unity.Mathematics in ServerShared (26,566 lines lean on Unity.Mathematics.math)
and registers its existing formatters through that call. Switching to CultMath
is a separate migration and is rejected here (section 6).
Known non-portable shape, recorded and left alone: EntityPack carries
Dictionary<int2, PersistentBehaviorData[]> (EntitySerializer.cs:183), a map
with array keys. It lives in the Run store, which no other runtime reads.
Q3. What replaces System.Type fields?
A string holding the BehaviorData subclass simple name, matching the sibling
field that already does this.
- The only persisted
TypeisStatModifierData.RequireBehavior(ServerShared\Behaviors\StatModifier.cs:22-23), written asAssemblyQualifiedNamebyTypeFormatterResolver.cs:17, read only atStatModifier.cs:73, 80as an exactGetType() ==filter. StatReference.Target(StatModifier.cs:136-137) has the same[InspectableType(typeof(BehaviorData))]and is already astringtype name resolved by name at:63.- The closed set is the
[Union]list onBehaviorData(Behaviors\Behaviors.cs:152-190).
Decision: RequireBehavior becomes string; the comparison becomes
b.GetType().Name == _data.RequireBehavior; the importer maps the stored
assembly-qualified name to Type.GetType(name).Name. TypeFormatterResolver.cs
is deleted. Rejected: the union tag as an int (opaque in the Studio and bound
to MessagePack-C#), and keeping a CLR name string (that is what broke portability).
No operator decision needed.
Q4. Do CultNet or CultMesh depend on replication, declared-type schema, or exact-type watches?
No. Every CultNet and CultMesh cache has one store; no caller writes through a base type; every watch names a concrete leaf. Three things do lean on current mechanics and are named in the authority map.
- Replication: every
AddBackingStorecaller in CultLib attaches one store per cache (CultCacheMessagePack.cs:119, 128, one branch or the other;CultMesh.cs:1589DocumentFromStore;CultNetLocal.cs:146throughOpenAsync;CultCacheStudioWindow.cs:688by reflection). Every consumer does too (Aquarium:24-26; AquaSynth, Ymir, Mimir, Gjallar and AetheriaEve all throughOpenAsync/Create). Tests that show twoAddBackingStorecalls are two caches on one file (BackingStoreTests.cs:27/40, 67/76, 822/825, 856/864, 909/915, 1501/1509;CultMeshStreamingTests.cs:2402-2475, 2634/2643, 2688/2697), which is sharing, not replication.CultNetLocal.cs:148readscache.BackingStores.OfType<SingleFileMessagePackBackingStore>().FirstOrDefault(); the property stays. - What does lean on attach-time push (
CultCache.cs:1436-1439): callers that construct the cache with globals materialized and attach afterwards:CultCacheMessagePack.Create(:75),CultMesh.DocumentFromStore(CultMesh.cs:1589), Aquarium, and most tests. The push is also a live bug: it marks the store dirty before the first pull, andSingleFileBackingStore.PullAllreturns without loading when dirty (CultCache.cs:2572-2573), so aCreate()over a registry with any[CultGlobal]type never reads its own file. The authority map gives these pre-attach defaults an explicit owner instead. - Declared-type schema:
CultNetDatabase.PutAsync<T>andPutPredictedAsync<T>take the descriptor fromGetRequired<T>()for shard, schema and log (CultNetDatabase.cs:869-902, 908-927), whilePublishCacheUpdatealready usesdocument.GetType()(:1214-1215), as doCultNetDocumentRegistry.cs:327,CultNetDatabaseServer.cs:391-398andCultNetDatabaseSubscriptionServer.cs:504-513.CultMesh.cs:3515-3538converts a same-schema value to the stored CLR type and callsPutAsync<storedType>byMakeGenericMethod, so its runtime type equalsT. No caller passesobject, an interface, or a base class, and no CultNet fixture uses document inheritance. Cut 2 makesPutAsync<T>derive its descriptor from the runtime type so CultNet and the cache stop having two answers; no wire change follows because every existing call hasTequal to the runtime type. - Exact-type watches:
CultNetDatabase.Watch<T>(:1134-1140) is its own exact match onCultNetDatabaseChange<documentType>;WatchByName/WatchByIndex(:1171-1189) filter it through_cache.GetByName<T>/GetByIndex<T>. Every caller names a leaf (CultMeshGameSession.cs:155,Server.cs:490-733, AquaSynth, Brokkr, AetheriaEveWatchRecord<T>).CultMesh.Collection<T>(CultMesh.cs:2289-2290) snapshots with the assignableGetAlland streams with the exactWatch; after Cut 2 both are assignable and the inconsistency closes by itself.CultNetDatabase.Watch<T>stays exact in this cut: nothing needs it changed, and changing it is scope. - Transactions:
CultNetDatabase.ExecuteTransactionAsync(:519-555) wraps the cache primitive; the only non-test caller isAetheriaStateNode.cs:460on a single directory store. No test asserts the single-store rule; the message exists only in source. - The Studio reaches the cache by string reflection (
OpenAsync,GetRequired,UpsertAsync(Type, object, CultRecordKey?),Remove,FlushAsync,IsDirtyatCultCacheStudioWindow.cs:688-739); those signatures are frozen for Cut 2. - The generator cannot see Aetheria's hierarchies: it requires
[CultDocument]on the declaring type, discovers members withGetMembers()on that type only (CultDocumentMessagePackGenerator.cs:43-50, 80), and has no[Union]handling. That confirms Cut 6's choice not to reference it. - Stale docs describing the old typed overload and mirrors:
CultLib\README.md:240-264,src\GameCult.Caching\GameCult.Caching.txt:157, the generator README. Cut 1 rewrites them.
Q5. Can existing stores hold records written under a declared parent schema?
No consumer writes one, and the fix does not touch existing bytes.
- Aquarium writes two fixed keys with
AddAsync(state, new CultRecordHandle<T>(key))whereTis the concrete class (Aquarium\src\Aquarium.Epiphany\State\AquariumCultStateStore.cs:82-83, 95-96). - AetheriaEve calls
PutAsync<T>andUpsertAsyncwith concrete document types everywhere (Aetheria.State\AetheriaStateNode.cs:360-554,Aetheria.State.Daemon\AetheriaYmirPersistenceCoordinator.cs:212, 269); it has no document subclasses, only interface implementations. - Ymir's four
UpsertAsynccalls are typed to the concrete document (Ymir\src\Ymir.Core\...\YmirServicePublicationDocument.cs:169-177,YmirWorldStateDocument.cs:255). - Heimdall uses only cultcache-ts; Idunn only cultcache-rs. Neither has C#.
- Delvehold references Caching and the generator but was not audited for calls; Cut 2's Soul step greps it.
What the fix changes: CreateStoredDocument(typeof(T), ...) at
CultCache.cs:1632, 1641 becomes document.GetType(). Records already on disk
keep their persisted schemaId and read back exactly as before. The new loud
failure: passing an instance whose runtime type has no [CultDocument] throws
from GetRequired (CultCache.cs:493-498) instead of silently storing the base
shape. The payload path already serialized the runtime type
(CultDocumentMessagePackSerialization.cs:465), so the old behavior was a
schema-id lie over a subclass payload, which is exactly what the probe saw.
Q6. Which consumers pin which revision, and what is the release order?
| Consumer | Takes CultLib by | Pin | Affected by this cut |
|---|---|---|---|
| AetheriaEve | Unity UPM git URL (two projects) + .NET sibling ..\..\CultLib |
b9cbd75 (package 1.0.56), 94 behind |
Not until it re-pins; then unaffected (single directory store per cache, concrete PutAsync) |
| Aquarium | .NET sibling checkout, unpinned (Aquarium.Epiphany.csproj:14-15) |
none | Compiles against main immediately; single store, concrete types; must build after Cut 2 |
| Ymir | .NET sibling checkout, unpinned (Ymir.Core.csproj:4-14) |
none | Same as Aquarium |
| Delvehold | .NET sibling with a hard revision guard (Directory.Build.props/targets) |
334e60f, 52 behind |
Not until it re-pins |
| Heimdall | submodule, TS packages only | b6b1d9c |
No |
| Idunn, Epiphany, Odin, Ghostlight, Muninn, Ratatoskr, CodexConnector | Cargo by commit | various | No (Rust cache unchanged) |
| Huginn, Sai, Stonks, Vili, EvePlugins | npm sibling paths | none | No |
| Aetheria | nothing yet | n/a | The consumer this cut serves |
Release mechanics: the Unity package template unity\org.gamecult.cultlib\package.json
is at 1.0.56 with committed DLLs under Runtime\Plugins; the newest release
tag is cultlib-unity-v1.0.46 (1fc68a4, 2026-08-17). Versions 47 through 56
were never tagged, which is why AetheriaEve pins a raw commit. Install docs are
stale (docs\nuget-packaging.md:22 says v1.0.46, the package README says
v1.0.41). CultCache Studio ships as a separate package,
org.gamecult.caching.unity 1.0.0 at src\GameCult.Unity\Assets\Caching, never
tagged, referenced by no consumer. No workflow publishes C# or Unity artifacts;
publish-packages.yml covers only npm and PyPI tags.
Order: CultLib main (Cuts 1-4) -> Cut 5 tags cultlib-unity-v1.0.57 and
caching-unity-v1.1.0 -> Aetheria consumes the tags (Unity) and the tagged
commit (headless, through a Delvehold-style revision guard). No other consumer
is forced to move. Aquarium and Ymir are built in Cut 2's verification because
they track main unpinned.
Q7. Where do Aetheria's world types fall, and where are the save points?
Corrections to the target first: the root union has 30 tags, not 29
(DatabaseEntry.cs:23-54); five name classes that are not DatabaseEntry
subclasses (tags 4, 5, 6 item instances; 14 OrbitalEntity; 20 Ship), so
they were never cache records; and two DatabaseEntry subclasses have no tag
at all (ConsumableItemData, ItemData.cs:348; PatrolOrbitsTask), so they
could never have been written. Agent tasks are not persisted today:
Zone.Agents (Zone.cs:35) is absent from ZonePack.
| Type | Store | Kind | Why |
|---|---|---|---|
| SimpleCommodityData, CompoundCommodityData, GearData, HullData, CargoBayData, DockingBayData, WeaponItemData, ConsumableItemData | Catalog | document | referenced by ItemInstance.Data, FactionProductData.Design, Faction.BossHull, WeaponData.AmmoType |
| Faction | Catalog | document | referenced by ItemData.Manufacturer, EntityPack.Faction, SavedGame.Factions, Faction.Allegiance keys |
| FactionProductData | Catalog | document | referenced by ItemInstance.Product (ItemInstance.cs:49) |
| PersonalityAttribute | Catalog | document | keys in Faction.Personality, CompoundCommodityData.DemandProfile |
| NameFile | Catalog | document | Faction.GeonameFile (Corporations.cs:40), read at Galaxy.cs:338 |
| GalaxyMapLayerData (tag 8), PlayerData (tag 11) | dropped | - | no live reference (ItemManager.cs:20 is commented out; PlayerData referenced by nothing). Not imported. |
| BehaviorData and subclasses, WeaponData, ItemRole | inside item design | value | owned by EquippableItemData.Behaviors (ItemData.cs:351) |
| OrbitData | Run | document | referenced by Guid from BodyData.Orbit, OrbitData.Parent, OrbitalEntityPack.Orbit, MoveTo.Orbit; created at runtime (Zone.cs:120, 265) |
| BodyData: PlanetData, GasGiantData, SunData, AsteroidBeltData | Run | document | referenced by Mining.Asteroids, Survey.Planets, MiningToolData.AsteroidBelt, Zone.Planets keys |
| SavedZone (with its ZonePack) | Run | document | one per zone; holds CultRecordRef lists to its orbits and bodies |
| SavedGame | Run | [CultGlobal] document |
the run root: factions, home/boss zones, current zone, action-bar bindings |
| EntityPack (ShipPack, OrbitalEntityPack), ItemInstance and subclasses, PersistentBehaviorData, SavedActionBarBinding | inside SavedZone / SavedGame | value | no identity; SavedActionBarBinding indexes into the run's entity (SavedGame.cs:111-118), so it stays with the run rather than the Player store the target table names |
| AgentTask and subclasses | not persisted | value owned by Agent |
not saved today; this migration adds no persistence. Reserved suggests shared ownership; if tasks are ever persisted they become Run documents |
| Entity, Ship, OrbitalEntity, Zone, Galaxy | live simulation | not records | stale union tags 14 and 20 are deleted |
| PlayerSettings | Player | [CultGlobal] document |
name, tutorial flag, credits; SavedRun leaves it and becomes the Run store |
| InputLayout | Player | document keyed by layout name | today one file per layout under GameData\KeyboardLayouts |
| Brush, InputLayout row/column unions | value | - | not cache data |
Save points today (Gameplay\ActionGameManager.cs unless noted):
SavePlayerSettings (:76-79) writes GameData\PlayerSettings.msgpack, which
embeds the whole run; SaveState (:240-249) builds it via Zone.PackZone()
(Zone.cs:107-118). Triggers: quit (:238), wormhole entry (:611), death
(Die, :1057-1065, which nulls the galaxy but leaves SavedRun on disk),
settings Back (UI\MainMenu.cs:237), new game (MainMenu.cs:139, 168). Two
writers are dead or orphaned: SaveLoadout (:233-236, path assignment
commented out at :272-275) and SaveZone (:1093-1094, no callers). Key
rebinding writes GameData\KeyboardLayouts\*.msgpack
(UI\InputScreen\InputDisplayLayout.cs:495-501). Loads: the catalog at
ActionGameManager.cs:49-57 (which also writes, see Q1 of the target), player
settings at :65-72, run resume at MainMenu.cs:97-106 through
Galaxy(CultCache, SavedGame, ...) (Galaxy.cs:47-90).
After the cut there is one run save path (SaveRun) used by quit, wormhole and
menu; Die deletes the run store file; new game creates a fresh one.
Q8. How do identity comparisons survive without DatabaseEntry.ID?
Documents are singleton instances per cache, and identity is the record key. Reference equality replaces ID equality; keys replace stored Guids.
- The only
Equals/GetHashCodeoverride is onDatabaseEntry(DatabaseEntry.cs:60-69); no subclass overrides. It goes with the class. - The cache holds exactly one instance per key (
_entries,CultCache.cs:1274) andGetreturns that instance (:1710-1719), so the seven dictionaries keyed byFactionorOrbitData(Galaxy.cs:18, 19, 28, 34;ZoneGenerator.cs:97, 243;UI\Menu\SectorMap.cs:51) work with the default comparer once the override is gone. The precondition is that no code deserializes a second copy of a catalog document; saves embed references, not copies, so this holds. - The 14 explicit
.ID ==comparisons (Entity.cs:291, 304, 319;LoadoutGenerator.cs:159, 161;Narrative\ZoneConstraints.cs:37, 52;Zone.cs:316;UI\Menu\SectorRenderer.cs:65;TradeMenu.cs:292, 300;TradeMenuDebug.cs:275, 283) become reference comparisons where both sides are documents, orCultRecordRef.Keycomparisons where one side is a reference. - Guid-keyed runtime dictionaries (
Zone.cs:59-77, 122, 265;Zone Display\ZoneRenderer.cs:342-413;ItemsOfTypeinEntity.cs:331, 334, 1332, 1489-1589,TradeMenu*.cs) key byCultRecordKeytaken from theCultRecordRefon the instance.ItemInstance.DataandSavedActionBarConsumableBinding.Target, the only twoDatabaseLink<T>fields, becomeCultRecordRef<T>; all other references are already rawGuidfields and becomeCultRecordRef<T>too. - Saves that store faction Guids (
SavedGame.cs:56-73,EntitySerializer.cs:43) storeCultRecordRef<Faction>. - The key of a document in hand comes from
CultCache.TryGetHandle(CultCache.cs:1699). No helper type is added; the fourDatabaseLinkBase.Cachewriters (CultCache.cs:42,ActionGameManager.cs:49,DatabaseView.cs:107,AetherDb.cs:23) go with the static, andItemManager.GetData(ItemManager.cs:62-75) is the single resolution path for item designs. ZoneGenerator.cs:164names a planet from the first eight characters of its ID; it uses the first eight characters of the key.
Catalog keys carry the legacy Guid in D format. Run and Player keys are
whatever the cache mints (N format, CultCache.cs:2200). Keys are opaque
strings; the mix is fine.
2. CultLib authority map: store routing
Written in the Loud Rebuild Contract form. It governs Cut 2.
Owner. The route table inside CultCache: AddBackingStore(store) for the
sole unrouted store, AddBackingStore(store, params Type[] homeTypes) for routed
stores, and one private HomeStore(CultDocumentDescriptor) that resolves the
most specific assignable route. Nothing else decides where a record lands.
Inputs. The record's Descriptor.DocumentType, which is now always the
runtime type (CreateStoredDocument(document.GetType(), ...)); the route table;
each store's IsReadOnly; whether the cache has hydrated (any Pull* has run
on any attached store).
Pre-attach defaults. new CultCache() and CultCacheMessagePack.Create
materialize [CultGlobal] defaults before any store exists, and Aquarium,
CultMesh.DocumentFromStore and most tests rely on that order. Those entries
are owned by a _pendingDefaults set until the cache can tell whether they are
missing from durable storage. AddBackingStore no longer pushes them. They are
admitted, in one place (AdmitPendingDefaults), at the end of every Pull*
(each default whose key was not loaded from its home store is routed and pushed
as a mutation) and at the start of every flush or transaction commit that runs
before any pull. A default whose home store is read-only is dropped from the
pending set and logged. This is also the fix for the pre-pull dirty store that
makes SingleFileBackingStore.PullAll skip loading (CultCache.cs:2572-2573).
Outputs. Exactly one store.Push, store.Delete, or store.CommitBatch
per mutation, on the home store. IsDirty is any store IsDirty when stores are
attached and the in-memory flag only when none are.
Derived state.
_hasUnflushedMutationsis no longer an owner after hydration; it is derived from the stores.RecomputeDirtyState(CultCache.cs:2279-2284) is deleted.- A store's
IsDirtyis derived fromPush/Delete/CommitBatchon that store only.PullAllsets it false and nothing on the load path sets it true (SingleFileBackingStore.PullAll:2614,DirectoryMessagePackBackingStore.PullAllCore:224). - Global materialization (
InitializeGlobals,:2155-2186) is a mutation. It routes like any other. A global whose home store is read-only is not materialized;GetGlobal<T>returns null and the cache logs it. A missing catalog global is a data defect the Studio fixes, not something the runtime invents at startup. _globalKeys,_nameMaps,_indexMapsstay keyed by concrete type; typed lookups search every registered key assignable toT. Ambiguity (two assignable types both holding the name, or two assignable globals) throws.Watch<T>is derived from the same change stream but projects a change of a runtime type assignable toTintoCultCacheDocumentChange<T>(CultManagedDocument.cs:34is a sealed invariant generic, sois CultCacheDocumentChange<T>atCultCache.cs:1404can only ever match exactly).
Forbidden writers.
AddStoredDocumentInternalandRemoveStoredDocumentInternalmay not push to or delete from any store whensource != null(the load path). The loops atCultCache.cs:2097-2101and2135-2139are deleted, not conditioned.AddBackingStoremay not push existing entries into the new store (:1436-1439, deleted). Attaching after hydration throws; attaching while the cache holds only pre-attach defaults is the normalCreate()order.CultNetDatabase.PutAsync<T>andPutPredictedAsync<T>(CultNetDatabase.cs:869-927) may not take their descriptor fromT; they take it fromdocument.GetType(), asPublishCacheUpdate(:1214-1215) already does. Every existing call passes the runtime type asT, so no behavior or bytes change.- The signatures the Studio reflects on (
OpenAsync,GetRequired,UpsertAsync(Type, object, CultRecordKey?),Remove,FlushAsync,IsDirty) and the publicBackingStoresproperty thatCultNetLocal.cs:148reads are frozen. CommitTransactionmay not iterate all stores (:1957-1958). It resolves the home store of every staged mutation; if they resolve to more than one store it throws before touching any store. The_backingStores.Count > 1guard at:1933-1937is deleted; a routed cache with three stores may transact as long as the batch lands in one.- A load event for a record whose home store is not the emitting store throws
from
AddStoredDocumentInternal; the record is not admitted. - A
Push,Delete,CommitBatchorPushAllon a read-only store throws inside the store, and the cache checksIsReadOnlyon the home store before it mutates_entries, so in-memory state never diverges from a refused write. Directorystore index upgrade (_needsIndexUpgrade,DirectoryMessagePackBackingStore.cs:362, 399) is a flush-time format rewrite, not dirtiness; it is left alone for writable stores and never runs on a read-only store because the cache never flushes one.- The generic
TofAddAsync<T>/UpsertAsync<T>no longer chooses the descriptor.UpsertAsync(Type, object)keeps itsIsInstanceOfTypecheck as an argument guard and also uses the runtime type.
Shared paths. AddAsync, UpsertAsync<T>, UpsertAsync(Type, object),
Remove, InitializeGlobals, and CommitTransaction all go through
HomeStore(descriptor) then the store's own Push/Delete/CommitBatch. The
load path (EntryAdded/EntryUpdated/EntryDeleted subscriptions at
:1432-1434) goes through AddStoredDocumentInternal(source: store) and stops
at the cache's in-memory state.
Named demotions.
- Replication is no longer an owner of durability; durability is derived from the home store alone.
_hasUnflushedMutationsis no longer an owner once a store is attached; it is derived fromstore.IsDirty.typeof(T)inAddAsync<T>is no longer an owner of schema; schema is derived fromdocument.GetType().- The
Count > 1transaction rule is no longer an owner; atomicity is derived from "all staged mutations share one home store". - Exact
Descriptor.DocumentTypeis no longer an owner of typed lookup results; results are derived from assignability, asGetAll<T>already does (:1751-1759).
Deletion line (cut before anything is added).
CultCache.cs:1436-1439 (push-all on attach), 2097-2101 and 2135-2139
(replication loops), 1933-1937 (single-store transaction guard),
2279-2284 (RecomputeDirtyState) and its callers at 2106, 2144, 1506,
1553; the _hasUnflushedMutations = _backingStores.Any(...) recomputations at
1459, 1484, 1991; typeof(T) at 1632, 1641. No test in
tests\GameCult.Caching.Tests attaches two stores to one cache (every
AddBackingStore call at BackingStoreTests.cs:27-1602 is one store per cache;
the two-store cases at :822-825, :856-864, :909-915 are two caches on one
file), so no test is deleted for replication.
3. Wire-parity plan
| Change | Bytes on disk or wire | Runtimes that change | How parity is verified |
|---|---|---|---|
| Store routing, attach rules, read-only stores, loading never writes, transaction rule | none; each routed file is a complete cultcache.store.v1 snapshot |
C# only (siblings already route) | New C# test: a three-store routed cache and three single-store caches holding the same records with pinned storedAt produce byte-identical files. Cross-runtime: the C# interop peer (tests\GameCult.Caching.InteropPeer\Program.cs) gains a write-routed mode that writes two files; the existing writer-by-reader loop in packages\cultcache-ts\test\cult-cache.test.ts:536-617 reads both with the unchanged TS, Rust, and Python readers |
| Runtime type decides schema | none for existing records; a new record written through a base-typed T now carries the subclass schema id and payload it always should have |
C# only (siblings have no inheritance) | The canonical fixture ids in Contracts\cultcache-schema-compatibility.md:20-24 must not move (a test already asserts them in BackingStoreTests.cs); a new test writes Weapon through UpsertAsync<Gear> and reopens it as Weapon |
| Assignable typed lookups and watches | none | C# only | unit tests; Mesh and Networking suites re-run as the regression gate |
| Consumer formatter resolver | payload bytes of consumer-owned schemas only; CultLib's own documents are unchanged | C# only | A test document with a custom value type round-trips through reflection and generated paths; the interop note document's bytes are unchanged |
| Contract text: composition rule, value-type encoding rule | none | doc-only: cultcache-rs\README.md:216-241 corrected |
review |
The hosted interop workflow (.github\workflows\cultnet-interop.yml) tests
CultNet frames only; .cc parity lives in the cultcache-ts test above, which
runs on npm test and on cultcache-ts-v* release tags. Byte-level comparison
across runtimes is not attempted: Rust writes a stub catalog and second-precision
storedAt (lib.rs:2397-2433), so it would fail today for reasons unrelated to
this cut. That is a pre-existing parity gap and is recorded, not fixed here.
4. Cut sequence
Each cut is an independently executable Hands task with its own Soul check. Build hosts are the Windows workstation for .NET and Unity; every .NET target below is built and tested on the host it runs on. Nothing builds for Linux.
Cut 0. Commit the pending ServerShared edits (done)
- Done on
codex/aetheria-state-rebuild: the five ServerShared edits are6bd3e176, verified by the headlessAetheria.SharedandAetherDbbuilds, a Unity 6000.3.24f1 batchmode compile (the agent can run Unity headless when the editor is closed), andAetherDb doctor,station-fit,loadout. The 6000.3 settings reserialization is560779a4; the TMP fallback atlas that batchmode cleared was restored, not committed. - Consequence for the cuts below: "operator Unity recompile" steps can be a batchmode compile run by the agent while the editor is closed. A play smoke still needs the operator.
Cut 1. CultLib contract and red tests
- Repo/branch: CultLib,
codex/cultcache-store-routing. - Deletes first: nothing (documentation and tests only).
- Adds:
src\GameCult.Caching\Contracts\cultcache-store-composition.mdwith the authority map of section 2, the value-type encoding rule, and the consumer-resolver rule; amendscultcache-persistence-format.md:52-54(transactions require one home store, not one attached store) andcultcache-schema-compatibility.md(runtime type decides schema; lookups are assignable). Correctspackages\cultcache-rs\README.md:216-241, and rewrites the stale typed-overload and mirror prose inCultLib\README.md:240-264,src\GameCult.Caching\GameCult.Caching.txt:157, and the generator README. - Tests:
tests\GameCult.Caching.Tests\StoreRoutingTests.cs, written against today's API so they compile and are red:- two stores on one cache, pull the first, flush: the second store's file must not exist (red: replication writes it);
UpsertAsync<Gear>(new Weapon()), flush, reopen,Get<Weapon>non-null (red: stored asGear);GetByName<AbstractBase>(name)finds a concrete subclass record (red);Watch<AbstractBase>()receives a subclass change (red);GetGlobal<AbstractBase>()finds the concrete global (red);CultCacheMessagePack.Createover a registry containing a[CultGlobal]type, thenPullAllBackingStoresAsync, loads the records already in the file (red: the attach-time push marks the store dirty and the pull skips). API-shape tests (routed attach, read-only refusal, attach-after-hydrate, overlapping routes, foreign-store load refusal, transaction across two homes, byte-identical routed files) arrive with Cut 2 and must pass there.
- Build budget:
dotnet test tests\GameCult.Caching.Tests(net10.0, Windows). - Soul: the five tests are red for the stated reasons and no other test changed state.
Cut 2. CultLib routing implementation
- Repo/branch: CultLib, same branch, after Cut 1 and after Q4 is answered.
- Files:
src\GameCult.Caching\CultCache.cs;src\GameCult.Caching.MessagePack\CultDocumentMessagePackSerialization.cs(SingleFileMessagePackBackingStoreread-only flag) andDirectoryMessagePackBackingStore.cs(same);CultCacheMessagePack.cs(CultCacheOpenOptions.ReadOnly);src\GameCult.Networking\CultNetDatabase.cs:869-927(descriptor from the runtime type);tests\GameCult.Caching.Tests\StoreRoutingTests.cs;tests\GameCult.Caching.InteropPeer\Program.cs(write-routedmode);packages\cultcache-ts\test\cult-cache.test.ts:536-617(read the two routed files). - Deletes first: the deletion line in section 2.
- New behavior: the authority map in section 2, exactly. Read-only is a
constructor argument or init property on
CacheBackingStore(IsReadOnly), enforced in the store and checked by the cache. - Tests that must fail before and pass after: Cut 1's six, plus the API-shape
tests, plus: a
Create()-ordered cache whose default global is absent from the file writes it on first flush, and one whose global is present loads the persisted value and writes nothing. Negative checks: a catalog-routed record never appears in the run file (assert by deserializing the run snapshot and listing schema ids); opening a routed cache and flushing without mutation leaves every file's bytes unchanged (hash before and after);AddBackingStoreafterPullAllBackingStoresAsyncthrows; a record of a run-routed type found inside the catalog file throws on load and is absent fromAllEntries; a transaction staging one catalog and one run record throws and neither store'sIsDirtychanges; a global whose home store is read-only is not materialized. - Build budget:
dotnet build src\GameCult.Caching src\GameCult.Caching.MessagePack;dotnet test tests\GameCult.Caching.Tests tests\GameCult.Networking.Tests tests\GameCult.Mesh.Tests(all net10.0, Windows; Mesh and Networking are minutes, not seconds);dotnet build F:\Projects\Aquarium\src\Aquarium.EpiphanyandF:\Projects\Ymir\src\Ymir.Core(unpinned sibling consumers);npm testinpackages\cultcache-tsfor the interop loop (builds the C# peer, needs Rust and Python toolchains present). - Soul: every negative check above, the Q4 dependencies confirmed untouched by
the Mesh/Networking suites, Aquarium and Ymir compile, Delvehold grep shows
no base-typed writes, the schema-compatibility fixture ids unchanged, and the
six reflected Studio signatures plus
BackingStoresstill resolve by name (a reflection assertion in the test project, since the Studio only fails at runtime).
Cut 3. CultLib consumer formatter resolver
- Repo/branch: CultLib, same branch (separate files from Cut 2; may run in parallel with it).
- Files:
src\GameCult.Caching.MessagePack\CultDocumentMessagePackSerialization.cs, a test intests\GameCult.Caching.Tests. - Deletes first: the
static readonlyinitializer ofOptions(:50-55) becomes the default value of a once-settable property. - New behavior:
CultDocumentMessagePackSerialization.ConfigureResolvers(params IFormatterResolver[] consumerResolvers)composes the consumer resolvers ahead ofCultDocumentResolverandStandardResolver; a second call, or a call after any serialization, throws. Generated serializers already readOptionsat call time (CultDocumentMessagePackGenerator.cs:290, 308), so they need no change. - Tests: a document with a custom
struct Pair(float, float)and a resolver that writes[f,f]round-trips through reflection and through the generated path; callingConfigureResolverstwice throws; the interop note document's serialized bytes are unchanged with a consumer resolver installed. - Build budget: as Cut 2's first two commands plus the Caching tests.
- Soul: the three tests; no other project touched.
Cut 4. CultCache Studio absorbs Database Tools
- Repo/branch: CultLib,
codex/cultcache-studio-drawers(independent of Cuts 1-3 in files; depends on Cut 2 only for not writing on open). - Files:
src\GameCult.Unity\Assets\Caching\Editor\CultCacheStudioWindow.cs(847 lines, fixedDrawValuechain at:326-364), a newCultCacheStudioDrawers.csbeside it,Assets\Caching\package.json(1.0.0->1.1.0). - Deletes first: the "anything else as a disabled text field" fallback in
DrawValue; unknown types now route through the drawer registry and fail visibly if nothing claims them. - New behavior: dictionaries (key and value drawn recursively); abstract or
interface members offer a subtype popup built from the member type's
[MessagePack.Union]attributes (not from reflection over all subclasses, so the popup can only choose what the wire can encode);CultRecordRef<T>gets a record picker listing documents assignable toTby name; non-primitive structs keep the reflective path (this covers Unity.Mathematics and CultMath, verify rather than assume); a drawer extension point discovered through UnityTypeCacheon a[CultInspectorDrawer(typeof(MemberType))]attribute, so a consumer's editor assembly can register drawers with no runtime coupling. - Tests: none executable by the agent; Studio is Unity editor code. Operator
opens
src\GameCult.Unityin Unity, loads a.ccwith each member kind, and confirms edit and save; opening then closing without edits leaves the file bytes unchanged. - Build budget: Unity editor compile of
src\GameCult.Unity(operator). - Operator step: the compile and the manual check.
Cut 5. CultLib release
- Repo/branch: CultLib
mainafter Cuts 1-4 merge. - Files:
unity\org.gamecult.cultlib\package.json(1.0.56->1.0.57),unity\org.gamecult.cultlib\Runtime\Plugins\*.dllviascripts\build-unity-package.ps1 -UpdateTemplate,unity\org.gamecult.cultlib\README.md:15,docs\nuget-packaging.md:22. - Deletes first: the stale install lines.
- New behavior: tags
cultlib-unity-v1.0.57andcaching-unity-v1.1.0on the same commit; pushed. - Verification: the committed DLLs are byte-identical to a fresh
artifacts\unity\org.gamecult.cultlibbuild;GameCult.Caching.dllin the template exposesAddBackingStore(CacheBackingStore, Type[])(reflection check from a throwaway script); tags resolve onorigin. - Build budget:
dotnet publishofGameCult.Mesh,GameCult.Networking.WebSockets(netstandard2.1) andGameCult.Mesh.Quic.Native, Release, Windows host, as the script does today.
Cut 6. Aetheria data model cutover
- Repo/branch: Aetheria, new branch
codex/cultcache-cutoverfrom Cut 0. Depends on Cuts 0 and 5. - Deletes first (before any new attribute is added):
Assets\Scripts\ServerShared\CultCache\CultCache.cs(437),DatabaseEntry.cs(91),ReflectionExtensions.cs(127) andCollectionExtensions.cs(75) unless a non-cache user remains,Serialization\JsonKnownTypes\**(320, with its stray.csproj),Serialization\TypeFormatterResolver.cs(65),Serialization\JsonConverters.cs(169) if noJsonConvertcaller survives,Serialization\RegisterResolver.cs(37);Assets\Plugins\MessagePack\**(97 files, 30,088 lines, and its asmdef);Assets\Scripts\CultCache\Editor\**(17 files, 1,963 lines); theAssets\Plugins\MessagePack\**compile include inAetheria.Shared\Aetheria.Shared.csproj:23; theMessagePackreference inAetheria.Shared.Unity.asmdef; the root[Union]list and everyJsonKnownTypesattribute; the stale tags 4, 5, 6, 14, 20. - Kept and moved:
MathFormatters.csandMathResolver.cs(fix:55) underServerShared\Serialization\, registered by oneAetheriaSerialization.Configure()that calls Cut 3'sConfigureResolvers; theInspectable*attributes fromAttributes.csthat Studio drawers will read. - Adds:
Directory.Build.props/Directory.Build.targetsat the Aetheria root, copied fromF:\Projects\Delvehold(CultLibRoot,CultLibRevisionset to the Cut 5 commit, the revision and clean-tree guard). Reused, not invented.Aetheria.Shared.csproj:ProjectReferencetoGameCult.CachingandGameCult.Caching.MessagePack(both netstandard2.1). The MessagePack generator is not referenced: Unity cannot run it, and the target notes it silently falls back on hierarchies, so both bodies use reflection descriptors and behave the same.Packages\manifest.json:org.gamecult.cultlibathttps://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.57andorg.gamecult.caching.unityat...?path=/src/GameCult.Unity/Assets/Caching#caching-unity-v1.1.0;Aetheria.Shared.Unity.asmdefreferencesGameCult.CultLiband keepsnoEngineReferences: true.[CultDocument("aetheria.<type>", "1")]on every concrete document type in the Q7 table;[CultGlobal]onSavedGameandPlayerSettings;[CultName]on the existingNamemembers.[MessagePackObject]is removed from abstract bases that are not union roots (ItemData,CraftedItemData,EquippableItemData,BodyData,AgentTask) to satisfy MsgPack005; the value unions (ItemInstance,BehaviorData,WeaponData,EntityPack,SavedActionBarBinding,InputLayout) keep theirs.- Every
GuidandDatabaseLink<T>reference field becomesCultRecordRef<T>(Dictionary<Guid, float>becomesDictionary<CultRecordRef<T>, float>; the ref formatter writes string keys, so the map stays portable). RequireBehaviorbecomesstring(Q3).ServerShared\AetheriaStores.cs: one staticOpen(catalogPath, runPath, playerPath, readOnlyCatalog)that builds the routed cache. This is the composition root shared by the game, the tool, and tests; the route table is written once.- Identity changes of Q8 across the 75 Unity-side and 16 ServerShared call
sites;
DatabaseLinkBase.Cachegone;ItemManager.GetDatais the resolution path. - A small Aetheria editor file (
Assets\Scripts\Editor\CultCacheDrawers.cs) registering Studio drawers for[InspectableType](behavior name picker),[InspectableColor](float3/float4as color) and[InspectableAnimationCurve](float4[]). tests\Aetheria.Shared.Tests(xunit, net10.0) with the negative checks below; the headless counterpart of the Unity compile.
- Tests that must fail before and pass after (they cannot compile before; "fail
before" is the headless build failing on the deleted types): open the routed
cache on a copy of
GameDatawhose run and player files already hold their globals, flush, assert all three files' hashes are unchanged; write aWeaponItemDatathrough aGearData-typed call and read it back asWeaponItemData; writing to the catalog store throws and the catalog file is unchanged; aSavedZonenever appears in the catalog file; theDictionary<Faction, ...>inGalaxyresolves the same instance from twoGet<Faction>calls. - Build budget:
dotnet build Aetheria.Shared\Aetheria.Shared.csprojanddotnet test tests\Aetheria.Shared.Tests(Windows host; CultLib is built as a project reference from the pinned checkout). Unity: one editor recompile after the cut, by the operator; the agent updates every Unity call site it can find by grep but cannot prove the Unity compile. - Operator steps: Unity recompile; approve the two UPM git URLs (network fetch from GitHub on first import).
- Soul: headless build green; the five tests;
rg "DatabaseEntry|DatabaseLink| JsonKnownTypes|TypeFormatterResolver|MultiFileBackingStore" Assets toolsis empty;Assets\Plugins\MessagePackgone; the asmdef has noMessagePackreference; manifest pins the two tags; the revision guard refuses a dirty or wrong-revision CultLib.
Cut 7. One-shot importer
- Repo/branch: Aetheria, same branch, after Cut 6.
- Files:
tools\AetherDb\Import.cs(new),Program.cs(importandlegacy-censuscommands),GameData\Aetheria.cc(new, committed), and.gitattributesgaining*.cc filter=lfs diff=lfs merge=lfs -textbefore the.ccis added:AetherDB.msgpackis LFS-tracked today and.ccmatches no rule (git check-attr filterreportsunspecified), so without the rule the catalog would land in plain git. - Deletes first:
doctor(it deserializesDatabaseEntry[], which no longer exists), thewithNameFilesbranch and its comment inAetherDb.cs:7-10, 25, 34. - New behavior: the importer reads
GameData\AetherDB.msgpack(a MessagePack array of[tag, payload]) andGameData\NameFile\*.msgpack(12 files, each[tag, payload]) withMessagePackReader, never through the legacy types. A tag table maps the 30 legacy tags to new document types (tags 4, 5, 6, 14, 20 cannot occur; 8 and 11 are dropped and counted). The payload is rewritten slot by slot against the new type's[Key]members: a 16-byteGuid(the legacyNativeGuidResolver) or a legacyDatabaseLinkarray[guid]at aCultRecordRefslot becomes the Guid'sDstring;Guidmap keys likewise; theRequireBehaviorstring becomes a simple name; nested[MessagePackObject]values and[Union]members are recursed by their own[Key]and[Union]metadata; everything else is copied. The rewritten payload is deserialized with CultLib and written withAetheriaStores.Open(catalog only, writable for this one command) under the legacy GuidDstring as key. Slot numbers are untouched. - Verification:
legacy-censuscounts records per tag structurally;importprints the same per-type counts from the new cache; they must match minus the dropped tags, and everyCultRecordRefin the new store must resolve. Thecensus,factions,hardpoint-fitoutputs (Cut 9 versions) must match their pre-cut outputs captured at Cut 0. - Then, in the same commit: delete
GameData\AetherDB.msgpack,GameData\NameFile\, and the 32 empty per-type folders the legacyMultiFileBackingStoreconstructor created (CultCache.cs:237-244). KeepGameData\KeyboardLayoutsfor Cut 8. - Build budget:
dotnet run --project tools\AetherDb -- legacy-census, then-- import, both net10.0 on Windows. - Soul: counts match;
GameData\Aetheria.ccdeserializes withCultDocumentMessagePackSerialization.DeserializeSnapshotand every schema id in its records is in its catalog; no legacy file remains;git statusshows the.ccadded and the legacy files removed in one commit.
Cut 8. Runtime cutover
- Repo/branch: Aetheria, same branch, after Cut 7.
- Files:
Assets\Scripts\Gameplay\ActionGameManager.cs,UI\MainMenu.cs,UI\InputScreen\InputDisplayLayout.cs,ServerShared\Galaxy.cs,ServerShared\SavedGame.cs,ServerShared\PlayerSettings.cs,ServerShared\Zone.cs. - Deletes first: the catalog bootstrap at
ActionGameManager.cs:49-57;SavePlayerSettings/SaveState(:76-79, 240-249) as they stand;SaveLoadout(:233-236, dead path) andSaveZone(:1093-1094, no callers); thePlayerSettings.msgpackreader (:65-72); the per-file layout writer (InputDisplayLayout.cs:495-501) and reader (:88-91); theGameData/PlayerSettings.msgpack.gitignoreline. - New behavior:
ActionGameManageropens the cache throughAetheriaStores.Openwith the catalog read-only, the run store at a per-run path, and the player store;SaveRun()is the single run save path (oneExecuteTransactionAsyncoverSavedGameand theSavedZone/OrbitData/BodyDatarecords) and is called from quit, wormhole entry, and menu;Die()closes and deletes the run store file; new game creates a fresh run store;SavedGamebecomes the Run global andPlayerSettingsthe Player global;InputLayoutrecords live in the Player store keyed by layout name;Galaxy(CultCache, SavedGame, ...)resolvesCultRecordRef<Faction>. - Tests: headless, in
tests\Aetheria.Shared.Tests: save a run, reopen, the same zones and refs resolve; delete-run leaves the catalog and player files byte-identical; a secondSaveRunafter a wormhole is the only writer of the run file (hash the run file, assert catalog and player hashes unchanged). - Build budget: headless build and tests as Cut 6; Unity recompile and a play smoke (new game, one wormhole, quit, resume, die) by the operator.
- Soul: the three tests; the play smoke;
rg "PlayerSettings.msgpack|\\.zone| \\.loadout|KeyboardLayouts" Assetsis empty; exactly one call site writes the run store.
Cut 9. AetherDb rewrite and final deletions
- Repo/branch: Aetheria, same branch, after Cut 8 has run.
- Files:
tools\AetherDb\AetherDb.cs,Program.cs,Import.cs,docs\. - Deletes first:
Import.csand theimport/legacy-censuscommands (the one-shot has run; a reader with no data is a liability);migrate-products(already applied,b8ecfffd); theSave()method (AetherDb.cs:37), since the tool now writes through the cache. - New behavior:
AetherDb.OpencallsAetheriaStores.Open(catalog writable only forclear-boss-hulls apply);census,factions,station-fit,hardpoint-fit,loadout,settings,settings-dumprun over the new cache;savereads the run store; the help text lists every command. - Docs:
cultcache-migration-target.mdstatus line to "done" with the commit range; a short "rejected paths" note stays in this document; thethree-gates-scope.md:61-68"loading writes" paragraph is deleted because the smell no longer exists. - Tests: each command exits 0 against the committed
GameData\Aetheria.cc;censusoutput equals the Cut 0 capture. - Build budget:
dotnet build tools\AetherDb, run each command. - Soul:
rg "legacy|msgpack" tools docsshows only history notes;git ls-files GameDatalistsAetheria.ccand nothing legacy.
Steps needing the operator's Unity recompile: 0, 4 (CultLib's Unity project), 6, 8. The agent cannot perform them.
5. Subtraction ledger
Lines are C# unless noted; estimates are bounded by the measured sizes above.
| Cut | Removed | Added | Targets, dependencies, schemas |
|---|---|---|---|
| 1 | 0 | ~120 doc, ~120 test | 0 |
| 2 | ~45 (deletion line) | ~260 impl, ~350 test, ~40 interop peer, ~20 TS test | 0 new targets; IsReadOnly and the typed AddBackingStore overload are the only new public surface |
| 3 | ~6 | ~40 impl, ~60 test | 0 |
| 4 | ~10 (fallback) | ~400 editor | Studio package 1.0.0 -> 1.1.0; 1 new attribute |
| 5 | 2 doc lines | 2 doc lines, rebuilt DLLs | 2 tags |
| 6 | 1,771 (ServerShared\CultCache) - ~305 kept formatters + 30,088 (MessagePack) + 1,963 (Database Tools) + ~60 (asmdef/csproj lines) ≈ 33,500 | ~60 AetheriaStores, ~200 drawers, ~200 tests, ~40 props/targets, ~400 attribute and reference edits ≈ 900 |
-1 vendored MessagePack, -1 vendored JsonKnownTypes, -1 asmdef; +2 UPM packages, +2 ProjectReferences, +1 test project; 20 [CultDocument] schemas replace 1 union |
| 7 | ~50 (doctor, name-file branch), 2 legacy data files + 12 name files + 32 empty folders |
~300 importer (temporary), 1 .cc |
0 |
| 8 | ~120 (bootstrap, three writers, two readers) | ~90 (SaveRun, open path) |
-3 file formats (PlayerSettings.msgpack, .zone, .loadout, KeyboardLayouts\*.msgpack) |
| 9 | ~300 (importer) + ~60 (dead commands) | ~40 | 0 |
Expected net: CultLib about +1,300 lines, of which ~530 are tests and ~400 is editor tooling that replaces 1,963 lines in Aetheria; Aetheria about -33,000 lines, two vendored dependencies and four private file formats gone, one shared package in.
6. Risks and rejected paths
Risks:
- The Unity compile is only provable by the operator, at Cuts 6 and 8. The
headless build catches
ServerShared; it cannot catchGameplay,UI,Zone Display, orEditorcall sites. Expect one round of fixups after each recompile. - MessagePack moves from a vendored 2.x (no version string;
e9431261quarantined its Unity assembly) to 3.1.7 withMessagePackSecurity.UntrustedData(CultDocumentMessagePackSerialization.cs:55). DeepEntityPackgraphs may hit the untrusted-data depth limit; Cut 8's save test is where that shows. - Unity runs no source generator, so documents serialize through
DynamicObjectResolver. Aetheria's scripting backend is Mono (only Android is set inProjectSettings.asset:660-661), so this works; IL2CPP would not. RarityTierand anything else markedkeyAsPropertyNameserializes as a map and would hash a different canonical schema than its array-shaped neighbors; it lives in Unity settings, not the cache, so it is out of scope, but any such type that turns out to be embedded in a document must be converted to keys.- Any
ReactivePropertyfield reachable from a document breaks without the vendoredMessagePack.ReactivePropertyresolver. The census found none (reactive state is onEntityandEquippedItem, which are not persisted), but Cut 6's Soul grep must confirm. - Schema drift after the cut is governed by CultLib's slot comparison
(
CultCache.cs:947-1027); a type change in a slot is a hard reject. Aetheria field edits that change a slot's type need a new slot or a version bump, which is a discipline the legacy union never asked for. - Cross-runtime byte parity of
.ccfiles is a pre-existing gap (Rust stub catalog and timestamps). This cut does not widen it and does not close it.
Rejected paths:
- Mirrors or replication in C#. No consumer uses them, transactions already refused them, and the sibling mirror semantics are a local convenience the contract never promised.
- A
storeIdor route field in the file header. It would change bytes in every runtime to record a fact each file already implies by existing. - A save converter. The target discards saves; a converter would be a second legacy reader.
- Keeping
DatabaseEntrywith anIDshim. The shim would be the surviving owner of identity and the whole point is to demote it. - Switching
ServerSharedto CultMath. CultMath has no serialization and the math library touches 26,566 lines; that is a separate migration. - Union tags as the
RequireBehaviorencoding, or per-field[MessagePackFormatter]attributes instead of a resolver. Both push encoding knowledge into thirty fields. - A JSON intermediate for the import, or an
extern aliasreference to a pre-cutAetheria.Sharedbuild. A structural rewrite driven by the new types'[Key]metadata is smaller than either and is deleted after use. - Referencing the MessagePack source generator from
Aetheria.Shared. Unity cannot run it, and two bodies serializing by different codecs is exactly the split authority the migration exists to remove. - Persisting agent tasks. They are not persisted today; adding it would be new behavior in a migration that moves the cache and nothing else.