Files
mantra-kmp/composeApp
Kgothatso Ngako 7bccf2438c feat(subgroups): say what a ceremony is for, and stop rooms arriving nameless
Phase 4 of docs/subgroups.md. Two tags on the ritual proposal, and only on the
proposal. Neither is believed by anything.

**`parent_group` says the ceremony is opening a subgroup.** `acceptProposal`
files it on `DkgSession.parentChatRoomId` and the ritual screen will read it.
Anybody can claim any parent and nothing is granted on the claim -- the
participant set is still the p-tags, the threshold is still the threshold, and a
proposal naming a group the receiver has never heard of opens exactly the ceremony
it would have opened without the tag. The claim that decides anything is the birth
certificate two steps later, which the parent's own quorum signs and which any
device can check against the parent's room id alone.

Carrying it is still worth it. Without it a member selected for a subgroup watches
a shared key ceremony open in a room they did not ask for, with nothing saying
what it is for. Being told is worth having even when the telling is not evidence,
and the KDoc on the parser, the column and the `acceptProposal` call site all say
so, because this is exactly the sort of field somebody later reaches for as if it
meant something.

**`subject` fixes a bug that predates subgroups.**
`NostrDao.getOrCreateNip17ChatRoom` has always built the receiving side's room
with `subject = decryptedGiftWrapPayload.parseSubject()`, and nothing on the
ritual path ever wrote a subject tag. Standing up a NIP-17 room sends nothing to
anybody, so the ritual proposal is routinely the first anyone hears of the room --
which meant the member who typed the name saw it and every other member got an
untitled chat with a key ceremony already running in it. `SelectChatRoomTypeViewModel`
has been passing a subject to `createNip17ChatRoom` that reached the creator's own
device and stopped there.

`broadcast` now reads `localChatRoom.chatRoom.subject` for the proposal, so every
robust group created from here on names itself on the way out. Read and written
through quartz's own `SubjectTag`, because it is the same tag and the same field
it lands in.

**Both are on the proposal alone.** Every later message belongs to a session the
receiver already has both facts for, so repeating them would be bytes per round to
restate something settled -- and would give a later message a say in what an opened
ceremony is for. `includeParent` and `subject` are parameters of `broadcast`
alongside the existing `includeThreshold`, which already works this way.

`proposeRitual` and `DkgRepository.proposeRitual` take an optional
`parentChatRoomId`; every existing call site is unchanged and gets null.

Three tests in `RobustRoomKeyCeremonyTest`, which already stands up a real NIP-17
room and a real ceremony: the proposal carries the room's name and no later
message repeats it; an ordinary ceremony claims no parent on any message; and a
subgroup ceremony names its parent on the proposal alone, records it on the
session, and changes nothing about the threshold or the participant count. Each
walks every queued payload rather than checking the proposal alone, since the
failure worth catching is a tag written on the wrong message. 396 common tests and
686 jvm tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-08 23:25:24 +02:00
..
2026-09-08 09:11:13 +02:00