CultLib/tests/GameCult.Caching.Tests
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Meta Vens ea5a07b37a Own serialization options by the document's assembly
The static UntrustedData options are gone. An assembly declares its formatter
resolvers with [assembly: CultCacheFormatterResolver(typeof(R))];
CultDocumentMessagePackSerialization.OptionsFor(assembly) composes them ahead
of CultDocumentResolver and StandardResolver, once per assembly, and hands
assemblies that declare nothing the base Options. Generated codecs and the
reflective SerializeUntyped/DeserializeUntyped path both read
OptionsFor(typeof(X).Assembly). No registration call, no mutable options, no
load order.

CultMessagePackSecurity copies UntrustedData and supplies a collision-resistant
comparer over CultRecordRef<T>.Key.Value, so ref-keyed dictionaries
deserialize.

Tests: RefKeyedDictionaryRoundTrips failed on 825b4f7 ("No hash-resistant
equality comparer available"); DeclaredResolverEncodesValueTypeAsPositionalArray
and UnknownAssemblyGetsBaseOptions did not compile there (new API);
InteropNoteBytesUnchanged is a pin whose payload constant was captured on
825b4f7. BenchItem, the one unkeyed [CultDocument] in any consumer (in-memory
benchmark, no store), gains [Key]s in its existing slot order.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 21:12:53 +02:00
..
Fixtures Mark pre-Cut 2 store fixtures binary 2026-09-13 17:17:49 +02:00
AssemblyInfo.cs Own serialization options by the document's assembly 2026-09-13 21:12:53 +02:00
BackingStoreTests.cs Route each document type to one home store; attach hydrates; commit explicit batches 2026-09-13 17:57:58 +02:00
ConditionalCommitTests.cs Mirror snapshots carry the cache Sequence they reflect 2026-09-13 21:02:49 +02:00
CultDocumentRegistryTests.cs Make CultCache hydration subscription-shaped 2026-07-20 01:48:56 +01:00
DirectoryStoreDurabilityTests.cs Refuse a key in two stores, stop reporting reader contention, prove lock waits and page order 2026-09-13 18:21:19 +02:00
GameCult.Caching.Tests.csproj Pin stores written before Cut 2 with checked-in fixtures 2026-09-13 17:17:14 +02:00
PreCut2FixtureDocuments.cs Pin stores written before Cut 2 with checked-in fixtures 2026-09-13 17:17:14 +02:00
PreCut2StoreFormatTests.cs Route each document type to one home store; attach hydrates; commit explicit batches 2026-09-13 17:57:58 +02:00
README.md Pin CultNet publish-after-commit, add write-routed interop, update contract status 2026-09-13 17:58:00 +02:00
SerializationOptionsTests.cs Own serialization options by the document's assembly 2026-09-13 21:12:53 +02:00
StoreRoutingTests.cs Route every admitting gate entry through a hold 2026-09-13 20:01:36 +02:00

GameCult.Caching.Tests

GameCult.Caching.Tests contains NUnit tests for the caching library and its MessagePack persistence stores.

Scope

The tests currently cover:

  • 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)
  • CultCache.Commit batches on a directory store: visibility after the store commits, abandoned stages, sealed batches, observers committing again
  • explicit Cult document payload codecs, generated metadata, canonical schema fixtures, and schema drift reports
  • hand-written MessagePack snapshot and record serialization
  • 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

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).

Run

dotnet test tests\GameCult.Caching.Tests\GameCult.Caching.Tests.csproj