docs/marmot-v2.md, Phase 6: "a terminal rejection resolves FAILED, discarding
the pending state with the live group already correct." The phase's commit
built the CONFIRMED half and left every other outcome pending, on the
grounds that the broadcast queue reported a timeout and a relay's refusal
the same way -- both were "failed" -- and a timeout must stay pending, since
its retry re-sends the same bytes and may yet be accepted. The cost of that
was a room whose commit a relay refused outright: its obligation never
resolved, `canPrepareLocalCommit` stayed false, and every later invite,
removal or disband was refused with "try again in a moment" for as long as
the room existed. The refusal was re-sent on every launch and refused again.
The two are distinguishable, and now are. `RelayPool` already surfaces an
`["OK", id, false, reason]` as a `NostrPublishException` carrying the relay's
reason, apart from socket errors and timeouts; `BroadcastStatus.of(error)`
turns that into a status. A reason a relay will keep giving -- `blocked:`,
`invalid:`, `pow:`, `restricted:` -- is the new "rejected", which the requeue
on launch leaves alone: the same bytes to the same relay get the same answer.
A `rate-limited:` or `error:` refusal is "failed" like a timeout, because
those change. And a `duplicate:` refusal is "published": the relay is saying
it has the event, which is what published means, and it is the answer a
byte-identical retry gets from a relay that took the first copy. The four
statuses that were string literals across the sync pump, the navigation gate
and the DAO are named on the same object.
`DatabaseNostrRepository.broadcastProcessed` gains the relay's reason and a
"rejected" branch. One relay's refusal decides nothing -- another may still
accept, and a timeout on another is retried -- so the obligation is
discarded only when every request row for the event is "rejected":
`MarmotEngine.discardRejected` resolves it FAILED, the gate drops the clone,
the live group having never advanced, and the room can prepare a commit
again. Nothing is told to convergence, since a commit no relay carries is not
a branch any member will see. The room says what happened, in the relay's
words, because the screen that asked closed when the commit was made: an
invite gets the existing `TYPE_MEMBER_INVITE_FAILED` line, and a removal or
a disband step gets a new `TYPE_CHANGE_REJECTED` line, since the caption
written when it was asked for would otherwise stand uncorrected.
`PublishBeforeApplyJvmTest` gains the plan's third case: with a two-relay
scope, one refusal leaves the obligation, a timeout on the other leaves it,
the other's refusal discards it -- epoch unchanged, the peer not a member,
the line naming the reason -- and the same peer can be invited again. 1187
tests green, Android debug compile, M3 audit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>