Files
giza-kmp/composeApp/src
Kgothatso NgakoandClaude Opus 5 0b3780c604 feat(marmot): nothing goes out against a state that may lose
docs/marmot-v2.md, Phase 5, the last line of "Welcome and outbound", which the
phase's commit left out: before encrypting or committing, read
`convergenceStatus(groupId).allowsOutboundWork`. While a convergence pass is
open the room's canonical state is provisional -- two members committed
against the same epoch and the pass has not picked between them -- and a
message keyed under the branch that loses is one no peer will ever read,
while a commit against it makes a three-way fork out of a two-way one. The
library defines the flag and nothing in it reads it; the app is where the
outbound work is, so the app reads it.

`MarmotEngine.awaitSettled(routingId)` is the read. It is a short wait rather
than a refusal because a pass settles at the quiescence window -- one quiet
second, five at the outside -- so a caller that waits gets its work done in
order, whereas one that threw would hand its row back to a queue that
re-emits only when its table changes, which a pass settling does not do. The
wait ticks `settleDueConvergence` itself rather than relying on `settleLater`
having been armed, and gives up after three ticks with
`MarmotConvergencePendingException`, whose message the add-member screen
shows like the other two refusals; the bound is short because most of the
callers hold a Room transaction while they wait.

Five callers: the message send in `encryptAndSendMarmotInnerEvent` (the
current-profile branch; a legacy room has no convergence to wait for), the
invite past the founding Add, `publishGatedCommit` (so removal and both
disband steps), and `leave`, each after the publish gate's own check and
before the manager stages anything.

The observer fork test now settles the app's side through `awaitSettled`
instead of resolving it directly -- asserting outbound work is refused before
and allowed after -- and finishes with what settling is for: a message the
app sends once settled is an `ApplicationMessage` on Dana's side. 1186 tests
green, Android debug compile, M3 audit.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 00:04:39 +02:00
..