CultNet: release cache changes in Sequence order and match door contexts by change shape

The handler now parks a change ahead of a gap and drains one thread at a time, so
the log and stream follow cache admission order and a subscriber that writes the
cache queues behind the change it handles. A door context matches only a change of
its own shape: a put door wrote an instance no cache held, a removal door removes
it, so neither a plain removal nor an in-place re-upsert can wear it. A replica
records every primary entry even when the key is absent, so chained replicas see
no gap. Predictions are locked and cleared by the handler before publication.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Meta Vens 2026-09-29 14:06:05 +02:00
commit fb5ffc7483
2 changed files with 182 additions and 25 deletions

View file

@ -52,8 +52,9 @@ which route wrote it.
database-backed Mesh handles) from `Watch`, so a load, a commit and a variant
dependent's re-resolution all reach subscribers and the mutation log through
one handler over `Watch`; a database write door only hands that handler the
wire message or replicated entry for the change it admitted. A replica
publishes but never mints log sequences. The
wire message or replicated entry for the change it admitted. That handler releases
changes in cache `Sequence` order, so the log and the stream agree with the
cache. A replica publishes but never mints log sequences. The
streams carry no `Sequence` and have no stale protection.
- `GetWithSequence(key)` returns the document and the cache's current
`Sequence`, read together under the gate: every change with a `Sequence` at