[client] Reactions and replies: messages named by author and seq, a reply's reference, reactions, Unsupported for newer kinds #21
Reference in New Issue
Block a user
Delete Branch "feature/reactions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Reactions and replies: messages that can be named, inside MLS. Amicitia F27 (step 2 of its full-chat plan). Analysis:
.agents/features/reactions-replies.md.docs/PROTOCOL.md§4 and §7 updated. The relay does not change: no route, no column.authoris the 16 random bytes already in the author's MLS credential (Authorin the protocol crate, 22 characters of base64url),seqthe author's own count.textgains an optionalreplyTo; without it the JSON is unchanged. New payloadreaction{to, emoji?}: an emoji sets the sender's one reaction, none removes it. 1–32 bytes, no control characters.seqbecomesEvent::Unsupported(the app shows update to see this message) and counts for receipts. Today it vanishes without a trace. New fields go into new kinds (§4).Event::Messagegainsseqandreply_to; newEvent::ReactionandEvent::Unsupported;compose_text,react,author,contact_author;ClientError::BadReference.composeis unchanged.Adversarial self-review — reactions and replies
Evidence
cargo test --workspace-D warnings,cargo fmt --checkmutate_react.py)seqshown; known kinds taken for unknown; Unsupported not counted for receipts; Unsupported from a blocked contact;replyToalways written; our own author taken for the peer'sreplyTo/reactionkey and no author's wire spellingFindings
R1–R8 are on their lines.
Not verified
cargo fuzzis not set up here; the proptest parsers cover the protocol types, notPayload).Verdict
Merging. Amicitia's app part (storing names, the picker, the quote) is the next PR, in Amicitia.
@@ -44,2 +44,4 @@/// The longest text message, in bytes; well under a blob's limit once encrypted.pub const MAX_TEXT_BYTES: usize = 64 * 1024;/// The longest reaction, in bytes of UTF-8: the longest emoji ZWJ sequences are 28.pub const MAX_EMOJI_BYTES: usize = 32;R6 — scope. The client checks size and control characters only; it does not check that the text is an emoji. A peer could react with LOL. Accepted: a newer app's emoji must still arrive, and the app can decide how to draw what is not in its picker.
@@ -46,0 +46,4 @@/// The longest reaction, in bytes of UTF-8: the longest emoji ZWJ sequences are 28.pub const MAX_EMOJI_BYTES: usize = 32;/// The payload kinds this client knows; any other kind that carries a `seq` is `Unsupported`.const KNOWN_KINDS: [&str; 5] = ["hello", "text", "receipt", "inbox", "reaction"];R7 — test honesty. A variant left out of
KNOWN_KINDSwould arrive as Unsupported at a client of the same version, silently.every_payload_kind_is_knownround-trips every variant throughparse_payload, so a new variant without its kind fails the test (added after this finding).@@ -487,0 +591,4 @@.ok_or(ClientError::UnknownContact)}fn peer_author(&self, index: usize) -> Option<Author> {R2 — correctness, for later. The peer is the member that is not us: right for 1:1 groups only. F32 (groups) must replace this with a member lookup by author, or any member's message would pass as the peer's. Noted for F32's analysis.
@@ -487,0 +603,4 @@/// Whether `r` names a message that exists in this conversation: ours up to our last `seq`,/// theirs up to the highest `seq` received from them.fn names_a_message(&self, index: usize, r: &MessageRef) -> bool {R3 — correctness, accepted. "Exists" means at most the highest seq received, not received: a blob dropped as malformed leaves a hole that a reference can name. The app then shows A message you don't have (full-chat §5.2). A set of every received seq would be exact but grows for ever in the snapshot.
@@ -853,1 +991,4 @@}// Checked before this text counts, so a text cannot answer itself. The words are// real even when the reference is not: the text stays, the reference goes.let reply_to = reply_to.filter(|r| self.names_a_message(index, r));R4 — people / correctness. A text with a bad reference keeps its words: the words are real; only the quote is not. Checked before the text counts, so a text cannot answer itself (planted bug caught).
@@ -858,0 +1001,4 @@reply_to,}))}Payload::Reaction { to, emoji } => {R5 — correctness. No ordering field: the last reaction received from a person wins. One sender's blobs arrive in order (one mailbox, fetched in order, MLS generations), so last received is last sent. A restart between receive and finish replays the same blobs in the same order.
@@ -151,0 +151,4 @@fixed_bytes!(/// A message's author: the 16 random bytes in their MLS credential, made on their device, never/// a name. With the author's `seq` it names a message (`PROTOCOL.md` §4, reactions and replies).Author,R1 — privacy.
Authorexposes no new fact to anyone: it is the credential identity the peer's MLS already authenticates every message with. It travels only inside MLS (canary: its wire spelling is not on the relay). One identity is shared across all of a person's conversations, as the credential already is: two contacts who compare notes could already tell it is the same app. Stated in the analysis §3.@@ -58,0 +63,4 @@two members, a `seq` from 1 up to the last one sent or received); a reaction that names anythingelse is dropped, and a text keeps its words but loses the reference.**Kinds a client does not know** *(2026-11-21)*: one with a `seq` of at least 1 is shown as *updateR8 — compatibility. A client from before this change drops replies and reactions (
deny_unknown_fieldsontext, noreaction). Nobody runs Amicitia outside development yet. From now on new fields go into new kinds, so older clients show Unsupported instead of losing a message.Merged into
mainwith--no-ffas056a68de17(remote hash verified).Pull request closed