2026-04-18 13:01:24 +01:00
|
|
|
# GameCult.Caching.Tests
|
|
|
|
|
|
2026-05-08 02:42:11 +01:00
|
|
|
`GameCult.Caching.Tests` contains NUnit tests for the caching library and its
|
2026-09-13 16:57:07 +02:00
|
|
|
MessagePack persistence stores.
|
2026-04-18 13:01:24 +01:00
|
|
|
|
|
|
|
|
## Scope
|
|
|
|
|
|
|
|
|
|
The tests currently cover:
|
|
|
|
|
|
2026-09-13 16:57:07 +02:00
|
|
|
- `SingleFileMessagePackBackingStore` round-trips, external pulls, and the
|
|
|
|
|
dirty-pull guard
|
|
|
|
|
- `DirectoryMessagePackBackingStore` with the
|
|
|
|
|
`cultcache.store.v4.directory-content-addressed-pages` manifest: page writes,
|
|
|
|
|
clean flushes, concurrent writers under the commit lease, external deltas,
|
|
|
|
|
unflushed local keys, orphaned pages, and observers running after the lease
|
|
|
|
|
is released
|
|
|
|
|
- `CultCacheMessagePack.OpenAsync`, persisted globals, dirty state, and flush on
|
|
|
|
|
dispose
|
|
|
|
|
- cache lookups (`Get`, `GetAll`, runtime-type upserts)
|
Pin CultNet publish-after-commit, add write-routed interop, update contract status
- NetworkingTests.CultNetPutInsideCommitPublishesOnlyAfterCommit: a record
staged in a batch reaches no CultNet observer before the store commits; a
put made while staging is its own write. Chosen over refusing CultNet writes
inside a batch, which would need ambient "inside a batch" state.
- Interop peer mode write-routed <catalog.cc> <run.cc>: cultcache.interop-note
routes to the catalog file, cultcache.interop-run-note to the run file, one
record each.
- store-composition contract: the C# column reads implemented for routing,
attach, schema, lookups, globals, batch and conditional commit; overwriting
a store is open, remove, upsert, flush. persistence-format: C# implements
batch and conditional commit.
- tests README lists the new suites.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 17:58:00 +02:00
|
|
|
- `CultCache.Commit` batches on a directory store: visibility after the store
|
|
|
|
|
commits, abandoned stages, sealed batches, observers committing again
|
Delete the CultCache MessagePack source generator
The reflective CultDocumentRegistry is now the only descriptor authority,
and payloads always go through MessagePackSerializer with
OptionsFor(document assembly). No consumer builds AOT, IL2CPP or trimmed,
Unity always ran the reflective path, and no benchmark showed a gain,
while the generator duplicated the registry's shape rules.
Removed: GameCult.Caching.MessagePack.Generator and .Analyzers (solution,
project and analyzer references, NuGet pack list), CultGeneratedDocumentMetadata
(provider attribute, interface, definitions, loader), the generated descriptor
and codec branches in CultCache and CultDocumentMessagePackSerialization,
DocumentShapeSweepTests and the generator half of the unkeyed test, the
Microsoft.CodeAnalysis.CSharp test reference and InternalsVisibleTo.
The registry rejects, with a message naming the fix, what MessagePackSerializer
cannot serialize and what the generator used to paper over: a document without
[MessagePackObject], a non-public document without AllowPrivate = true, and a
non-public member of an AllowPrivate document that is not [IgnoreMember].
DocumentShapeTests pins every rejection message and the accepted shapes'
round trips against MessagePackSerializer bytes (keeps the 93A16E0305 pin).
Rejected shapes are emitted into a dynamic assembly, which registry
discovery skips.
Nested member type names use reflection's Outer+Inner form, not the
generator's dot form, so ReferenceHolderEntry's fixture id is re-pinned
(bd8506... -> 4ec0c5...). A scan of the schema catalogs in all 2786 .cc
stores under F:\Projects (AetheriaEve and CultLib-* worktrees, bin and obj
excluded) found no member type name naming a nested type in either form.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 23:38:08 +02:00
|
|
|
- Cult document payloads, registry shape rejections, canonical schema fixtures,
|
|
|
|
|
and schema drift reports
|
2026-09-13 16:57:07 +02:00
|
|
|
- hand-written MessagePack snapshot and record serialization
|
Pin CultNet publish-after-commit, add write-routed interop, update contract status
- NetworkingTests.CultNetPutInsideCommitPublishesOnlyAfterCommit: a record
staged in a batch reaches no CultNet observer before the store commits; a
put made while staging is its own write. Chosen over refusing CultNet writes
inside a batch, which would need ambient "inside a batch" state.
- Interop peer mode write-routed <catalog.cc> <run.cc>: cultcache.interop-note
routes to the catalog file, cultcache.interop-run-note to the run file, one
record each.
- store-composition contract: the C# column reads implemented for routing,
attach, schema, lookups, globals, batch and conditional commit; overwriting
a store is open, remove, upsert, flush. persistence-format: C# implements
batch and conditional commit.
- tests README lists the new suites.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 17:58:00 +02:00
|
|
|
- `StoreRoutingTests`: the store-composition contract (routing, attachment is
|
|
|
|
|
hydration, read-only stores, global singletons, assignable lookups, batches,
|
|
|
|
|
all-or-nothing loads)
|
|
|
|
|
- `ConditionalCommitTests`: `Expect`, `ExpectUnchanged`, `TryCommit`, the
|
|
|
|
|
single-file lock, strictly increasing `storedAt`, and the same conditions on a
|
|
|
|
|
directory store
|
|
|
|
|
- `DirectoryStoreDurabilityTests`: failed manifest replace, content-addressed
|
|
|
|
|
pages, the commit lease, orphan pages and tampered pages, with faults from
|
|
|
|
|
real file locks
|
|
|
|
|
- `PreCut2StoreFormatTests`: stores written before Cut 2 still open
|
2026-09-13 16:57:07 +02:00
|
|
|
|
|
|
|
|
Selective hydration, the directory store's stage probes, pre-v4 directory
|
|
|
|
|
formats, and the SoA table are no longer in the tree; the SoA table is parked
|
|
|
|
|
at `parked/cultcache-soa` (`docs/parked-features.md`).
|
2026-04-18 13:01:24 +01:00
|
|
|
|
|
|
|
|
## Run
|
|
|
|
|
|
|
|
|
|
```powershell
|
|
|
|
|
dotnet test tests\GameCult.Caching.Tests\GameCult.Caching.Tests.csproj
|
|
|
|
|
```
|