Commit graph CultLib/src/GameCult.Mesh/CultMesh.cs
Author SHA1 Message Date
Meta Vens
825b4f7d26 Mirror snapshots carry the cache Sequence they reflect
ObserveAsync, ReactiveAsync and RefreshAsync read a snapshot without a
Sequence, so an older change admitted before the read but delivered after it
overwrote the newer value.

CultCache.GetWithSequence(key) returns the document and the cache's Sequence,
read together under the gate. A cache-backed CultMesh handle passes it to its
mirrors; each mirror subscribes first, then adopts the sequenced read under its
own gate and takes that Sequence as applied, so a straggler at or below it
drops. RefreshAsync on both mirrors uses the same adoption path. Public Mesh
surface unchanged. The read is non-generic because the Mesh route needs the
untyped document for same-schema conversion.

Contract: only Watch/WatchRecord changes carry Sequence; OnUpdate-derived
CultNet streams have no ordering or stale protection; schema-alias handles and
removals are not stale-protected; the sequence constructor argument changed
CultCacheDocumentChange<T>'s binary signature.

Tests: ObserveAfterNewerSnapshotIgnoresStraggler and
RefreshIgnoresStragglerOlderThanSnapshot (observed and reactive cases) fail on
4562340; SequencedReadReflectsEveryChangeAtOrBelowItsSequence.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 21:02:49 +02:00
Meta Vens
456234018f Carry order as data: per-cache change Sequence, no delivery scheduler
bcae483 made the cache a delivery scheduler (tickets, _deliveryGate turn
waits, per-thread delivery queues). It deadlocked inside CultLib: a load's
delivery reaching a CultNetDatabaseSubscriptionServer observer that needs
_lifecycleGate, while a subscribe's demand handler holding that gate writes
the cache and waits for the delivery's turn.

The cache now owns order as data. Every admitted change takes the next value
of a per-cache in-memory sequence under the gate, published as
CultCacheDocumentChange<T>.Sequence. Delivery is the 544c087/b653f68 rule:
each call publishes its own changes on its own thread after releasing the
gate; nothing waits on another call's delivery. Cross-thread delivery order is
not guaranteed.

Deleted: ticket counter, _delivered, _deliveryGate, Monitor.Wait turns,
per-thread delivery queues, per-ticket catch-all, and the save-order contract
text with its observer-must-not-block rule.

Consumer: a cache-backed CultMesh document handle hands its observed and
reactive mirrors each snapshot's Sequence; ApplyCanonicalSnapshot drops one
not newer than the last applied.

Tests: SequenceIncreasesInAdmissionOrder,
ObserverWritingTheSameCacheDoesNotWaitOnOtherDeliveries,
SubscriptionDemandHandlerWritingCacheDuringDeliveryDoesNotDeadlock,
WatchRecordIgnoresStaleSequence. The last three time out on bcae483.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 20:43:11 +02:00
Meta Vens
85f2089f0e Delete CultCache wrappers and unused members
Removes FlushBackingStore, both PrepareForReloadOrShutdown overloads,
PullBackingStoreRecordsAsync, TryGet<T>, TryGetByName, TryGetByIndex,
Resolve<T>, the cache and store Logger, and LastSuccessfulFlushAtUtc on the
cache and stores. GetStoredDocuments<T> folds into GetAll<T>.

The soft flag goes from FlushAllBackingStores, ExecuteTransactionAsync,
CommitBatch and PushAll. It stays on FlushAsync(bool) because
CultCacheStudioWindow reflects on that signature until Cut 6.
CultMesh.FlushAsync and CultNetLocal.FlushAsync keep their parameter and
stop forwarding it.

The store's EntryAdded/EntryUpdated/EntryDeleted subjects become
protected internal Loaded/Unloaded callbacks set by the cache at attach.
AddStoredDocumentInternal is synchronous, so the GetAwaiter().GetResult()
bridges on the store subscriptions and the global materializer are gone.

Tests: drop the LastSuccessfulFlushAtUtc asserts; OpenAsync and GetAll tests
read through Get/GetAll; the persisted-global test proves the durable global
loads without staging a default instead of going through selective hydration;
the lease-before-observers test observes through CultCache.Watch; the
PullSelected selective-hydration test is deleted.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 16:44:11 +02:00
Meta Vens
4f6e95bb3d Carry editable field authority in CultMesh bindings 2026-08-22 00:05:57 +02:00
Meta Vens
98bec47d75 Make CultMesh document writes authority-explicit 2026-08-17 19:47:10 +02:00
Meta Vens
a1f25af2e0 Keep exact live subscriptions active before publication 2026-07-19 11:49:18 +01:00
Meta Vens
5587f5c6d1 Add ergonomic live body subscriptions 2026-07-19 10:55:27 +01:00
Meta Vens
4d2ddb5beb Default hot body subscriptions to live delivery 2026-07-19 09:20:40 +01:00
Meta Vens
42402ab64b Deliver reactive subscriptions without replica writes 2026-07-19 08:07:48 +01:00
Meta Vens
743fa3889e Stream exact hot state over negotiated body planes 2026-07-19 05:54:24 +01:00
Meta Vens
267ff356ea Honor schema aliases in store publications 2026-07-13 21:10:54 +01:00
Meta Vens
fb24e30ab6 Centralize CultMesh authority resolution 2026-07-13 14:00:26 +01:00
Meta Vens
c180ec7363 Resolve logical CultMesh RUDP routes 2026-07-13 02:06:22 +01:00
Meta Vens
a58daa54c7 Allow CultMesh RUDP clients on remote routes 2026-07-12 20:18:13 +01:00
Meta Vens
743d7688f0 Add CultMesh distributed asset packages 2026-06-28 07:54:00 +01:00
Meta Vens
e94cd0973d Add C# publication catalog sync 2026-06-27 23:53:35 +01:00
Meta Vens
47a84f5689 Add C# publication document catalogs 2026-06-27 23:48:53 +01:00
Meta Vens
abdfff6f4e Add publication sync and reconciliation coverage 2026-06-27 23:37:15 +01:00
Meta Vens
964a3ff1f8 Add schema-aware collection catalogs 2026-06-27 22:33:50 +01:00
Meta Vens
6218900734 Prefer typed peer snapshot aliases by record key 2026-06-27 22:25:15 +01:00
Meta Vens
8cc147d367 Add node-level reactive document shortcuts 2026-06-27 20:35:59 +01:00
Meta Vens
7bb6d7da8c Add CultMesh multi-document latest helpers 2026-06-27 18:23:26 +01:00
Meta Vens
8b48aa512f Add typed snapshot endpoint surface 2026-06-27 17:45:18 +01:00
Meta Vens
04561a5bd9 Add CultMesh single-file document helpers 2026-06-27 17:28:15 +01:00
Meta Vens
bcf877d87d Add C# configured publication document handles 2026-06-27 17:10:52 +01:00
Meta Vens
a6537a2d93 Add C# store document handles 2026-06-27 17:03:10 +01:00
Meta Vens
bd095a5837 Request peer snapshot documents by record key 2026-06-27 16:40:42 +01:00
Meta Vens
a57fa1113a Add C# peer snapshot document handles 2026-06-27 16:37:44 +01:00
Meta Vens
a08a66a66e Add CultMesh document prediction submissions 2026-06-27 16:20:19 +01:00
Meta Vens
8bb85d7c47 Add document surface diagnostics 2026-06-27 15:35:12 +01:00
Meta Vens
eb52b56088 Add CultMesh collection handles 2026-06-27 15:09:36 +01:00
Meta Vens
df079f2cab Add CultMesh document catalogs 2026-06-27 15:01:23 +01:00
Meta Vens
60a3fa9f82 Add cache-backed CultMesh document handles 2026-06-27 14:43:00 +01:00
Meta Vens
c911eb561d Add CultMesh typed document handles 2026-06-27 14:30:59 +01:00
Meta Vens
5af8ed57f7 Add C# CultMesh connected RUDP clients 2026-06-17 05:16:46 +01:00
Meta Vens
6510419439 Add C# CultMesh RUDP facade helpers 2026-06-16 16:57:35 +01:00
Meta Vens
5428870544 Make SoA cache-managed document storage 2026-06-13 01:44:05 +01:00
Meta Vens
365042ba6d Add CultCache SoA happy path 2026-06-12 20:38:41 +01:00
Meta Vens
f7182159b4 Add C# CultMesh streaming surface 2026-06-02 01:13:08 +01:00
Meta Vens
1a87ac35b4 Add CultMesh game session facade 2026-05-20 07:45:10 +01:00
Meta Vens
06293b3f6e Commit simulation facts from witness quorum 2026-05-20 01:58:36 +01:00
Meta Vens
e5e993e7aa Add CultMesh authority lease checks 2026-05-20 01:49:18 +01:00
Meta Vens
46cb4820ff Add CultMesh peer exchange client 2026-05-20 01:41:12 +01:00
Meta Vens
c612eb4307 Add CultMesh peer exchange catalogs 2026-05-20 01:35:39 +01:00
Meta Vens
b831a8f3bf Add CultMesh Verse discovery contracts 2026-05-19 21:23:11 +01:00
Meta Vens
8fc548e452 Add CultMesh durable shard log defaults 2026-05-19 21:13:33 +01:00
Meta Vens
d73c3d26e8 Add GameCult Mesh package home 2026-05-19 19:08:48 +01:00