From 9a27814c3bffecc2ac4199e0e762a667b4e0abb3 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 13 Sep 2026 19:59:28 +0200 Subject: [PATCH] Guarantee observer delivery in save order Operator decision: changes reach observers in the order they were saved, across threads, so latest-value consumers such as CultMesh's WatchRecord never apply a stale record. Also records per-call publication on the caller's thread and that only OnUpdate handler exceptions are rethrown to the caller. Co-Authored-By: Claude Opus 5 --- docs/cultcache-migration-cut.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/cultcache-migration-cut.md b/docs/cultcache-migration-cut.md index 2ca50a203..bb8e73229 100644 --- a/docs/cultcache-migration-cut.md +++ b/docs/cultcache-migration-cut.md @@ -591,6 +591,14 @@ home store, before `_entries` changes. the cache would otherwise deadlock. A store adopts its loaded view before anything is published, so a throwing handler cannot leave the store holding records the cache dropped. +- Each call publishes only the changes it admitted, on its own thread, after + the gate is released and before it returns (CultLib `544c087`). Deliveries + across threads arrive in save order (operator decision 2026-09-13), so a + consumer that keeps the latest value (`CultMesh.WatchRecord` into + `ApplyCanonicalSnapshot`) never applies a stale one; an observer that writes + the same cache must not deadlock against a concurrent writer, which a test + proves. Only `OnUpdate` exceptions reach the caller; `Watch` subscriber + exceptions follow R3's unhandled-exception handling. - One key lives in one store: a write or load that would put a key already held from another store throws and changes nothing. - `OnUpdate` fires for loads only, as before the migration; writers publish