test: a confederation's post end to end with no room anywhere, and the record (confederation-room-removal, Phase 8)

On three real FROST groups with real inboxes, one of Agora's admins
proposes a post; the other eight are asked in their own groups' rooms,
approve, and every device signs it, files it as the confederation's post
and owes it to relays, with no room of the confederation's on any of them.

The plan's header and its table of where the build chose differently;
pointers from confederation.md Phase 13, confederation-without-coordinator.md
D11 and confederation-profile.md D5, D9, Phase 7 and its appendix, whose
rejected idea this plan took up. No device run.

Full jvmTest 2,001, all passing; m3, brand, wallet and Marmot audits pass;
compileDebugKotlinAndroid builds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5.5 committed 2026-11-23 02:39:07 +02:00
1 parent a4b67dc46a
commit 6b5fb76cbe
6 files changed
+69 -4

No files matched your search

@@ -13,6 +13,7 @@ import kotlin.test.assertNotNull
import kotlin.test.assertTrue
import kotlin.time.Clock
import kotlin.time.Instant
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.runBlocking
import mobi.giza.compose.database.GizaDatabase
import mobi.giza.compose.database.builder.getRoomDatabase
@@ -192,6 +193,38 @@ class ConfederationProfileNetworkJvmTest {
network.everyDevice.forEach { assertEquals(null, ConfederationProfileManager.profiles(it.db, confederation.id).newestProfile) }
}
// ---- docs/confederation-room-removal.md, Phase 8: a post, end to end, with no room anywhere ----------
@Test
fun `a post proposed by one role holder is asked of the others in their groups' rooms, signed, and owed to relays`() = runBlocking<Unit> {
val proposer = agora.devices[0]
val attempt = ConfederationSigningManager.propose(
proposer.db, confederation.id, proposer.publicKey, com.vitorpamplona.quartz.nip10Notes.TextNoteEvent.KIND, emptyArray(),
"Three groups, one voice", proposer.secret,
)
pumpConfederationRoom()
// Every other role holder is asked, in their own group's room, by a line that is theirs.
network.groups.forEach { group ->
group.devices.filter { it !== proposer }.forEach { device ->
val asked = device.db.chatMessageDao().getChatMessagesByChatRoomId(group.roomId).map { it.chatMessage }
.filter { it.messageType == ChatMessage.TYPE_CONFEDERATION_SIGNING_ASKED && it.frostSigningSessionId == attempt.id }
assertEquals(1, asked.size, "${device.name} is asked in ${group.name}'s room")
ConfederationSigningManager.approve(device.db, attempt.id, device.secret)
}
}
pumpConfederationRoom()
network.everyDevice.forEach { device ->
assertEquals(null, device.db.chatRoomDao().findChatRoomById(confederation.id), "${device.name} holds no room of the confederation's")
val done = device.db.confederationCeremonyDao().getAttempt(attempt.id)
assertEquals(ConfederationSigningStage.COMPLETE, done?.stage, "${device.name}: ${done?.failureReason}")
val signed = Event.fromJson(done!!.signedEventJson!!)
assertEquals("Three groups, one voice", device.db.confederationDao().getEvent(signed.id)?.toEvent()?.content, "filed as the confederation's post")
assertTrue(device.db.confederationDao().observeUnpublished().first().any { it.id == signed.id }, "${device.name} owes it to relays")
}
}
/** The confederation's charter, signed the direct way its charter still is: proposed by one role holder, approved by the rest. */
private suspend fun signCharter(): Event {
val proposer = agora.devices[0]
+1 -1
View File
@@ -18,7 +18,7 @@ the [retired](./retired/) notes now.
| [confederation.md](./confederation.md) | a group made of groups: a phased plan, built behind a flag that is off in release but for its device run and the room's governance. Agreeing to form (Part A), the key ceremony and room (Part B), and the confederation signing its profile, posts and charter (Part C). Groups with a public nostr profile propose, accept or reject a confederation in public, an acceptance carries the group's admins sealed to the coordinator in a way every signer recomputes, and the confederation's DKG and Marmot room follow. Covers why the public events are regular kinds, why nothing can be encrypted from or to a group's npub, how the coordinator is kept from substituting a roster, and why everything after the agreement waits on upstream publishing the distributed rounds. Its coordinator and its public statements have since been replaced (confederation-without-coordinator.md) |
| [confederation-without-coordinator.md](./confederation-without-coordinator.md) | a confederation nobody coordinates: a phased plan, built but for its device run and behind flags that are off in release. The proposal and every answer travel as NIP-17 messages between the groups' NIP-4E inboxes, each sealed by its group's quorum, so every admin of every group reads every admin list and computes the outcome, and the key ceremony derives its room and session seed and computes the coordinator's broadcast on every device. Covers why a group could be the DKG's coordinator and does not need to be, why the admin lists stop being a payload encrypted to one person, why a confederation names at most twelve groups, how a group that says different things to different groups is caught, and who makes the confederation's room when nobody is in charge |
| [confederation-profile.md](./confederation-profile.md) | a formed confederation's nostr profile, decided by its groups: a phased plan, built but for its device run and behind flags that are off in release. The confederation gets its own screen, reached from each member group's screen, and an edit there is a statement by the editing group, sealed by its quorum and sent to every member group's inbox, which the others endorse or object to by their own quorums. Once `T` groups have endorsed, each group's signed voucher is a role holder's consent, so the confederation signs and publishes the profile with nobody asked again. Covers why the rule is `T` of `N`, why a transferable voucher is needed beside the non-transferable seals, who starts the signing, and how the confederation's room and the key ceremony's room come to say what they are |
| [confederation-room-removal.md](./confederation-room-removal.md) | taking away the confederation's own Marmot room: a phased plan, not built. A role holder's signing messages go into their own group's room, each group's admins carry them between groups through the inboxes, one at a time in order, and the posts, charter and signing attempts the room offered move to the confederation's screen. Covers why the nested signing still has to cross between groups every round, why each message becomes a signed event so it can be carried, why a demoted founder keeps signing and a removed one stops, and dropping the rooms already on devices while refusing a Welcome back into one |
| [confederation-room-removal.md](./confederation-room-removal.md) | taking away the confederation's own Marmot room: a phased plan, built but for its device run and behind flags that are off in release. A role holder's signing messages go into their own group's room, each group's admins carry them between groups through the inboxes, one at a time in order, and the posts, charter and signing attempts the room offered move to the confederation's screen. Covers why the nested signing still has to cross between groups every round, why each message becomes a signed event so it can be carried, why a demoted founder keeps signing and a removed one stops, and dropping the rooms already on devices while refusing a Welcome back into one |
| [confederation-upstream.md](./confederation-upstream.md) | the work below Giza that unblocks the confederation's Parts B and C: a phased plan, not built, across secp256k1-zkp, secp256k1-kmp and bitcoin-kmp. Covers why the one-process DKG and signing cannot simply be exposed step by step (the coordinator derives everyone's key state, acknowledgment is signed before the share is stored, nonce randomness is derived from the session id), why every DKG step can stay stateless, the storage contract a device follows, and Prefractal as an all-groups-must-sign path that needs no upstream work |
| [automatic-key-ceremony.md](./automatic-key-ceremony.md) | joining is the only approval: a phased plan, built but for its device session, that makes a key ceremony run by itself after a member joins. Covers why contributing and confirming were never decisions a person could add to, the resume sweep that replaces the tap, the coordinator's follow-up steps and the one key state a device can sign without asking, and why abandon stays |
| [ceremony-creation.md](./ceremony-creation.md) | one place to start a key ceremony — how joining a subgroup's ceremony opened a second one for the parent room, the screen that showed a ceremony and offered to start one in the same button, and the removal of the nip30303 documents, whose kinds collided with the ceremony's, leaving the member chronicle with nothing to carry and nothing to say |
+7 -1
View File
@@ -238,6 +238,8 @@ is refused (D6).
### D5. A group's endorsement makes a voucher, and a voucher is a role holder's consent
> **Since [confederation-room-removal.md](./confederation-room-removal.md):** a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, and a voucher travels in its group's envelope as itself rather than wrapped in a 30396.
The sealed 9435 and 9436 are good evidence for the groups' admins, but they are not
**transferable**. A seal opens only with the inbox key it was sealed to (D3 of the
coordinator-free plan). The people who must act on an endorsement are the confederation's role
@@ -345,6 +347,8 @@ other lines are quiet.
### D9. The confederation's room shows its groups
> **Since [confederation-room-removal.md](./confederation-room-removal.md):** a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, and its groups, posts, charter and signing are on its own screen.
On a confederation's room, `ChatRoomDetailScreen`:
- labels each member with their groups, from `Plan.seatsOf(member)` named by
@@ -646,6 +650,8 @@ above:
### Phase 7: rooms that say what they are (D9, D10)
> **Since [confederation-room-removal.md](./confederation-room-removal.md):** a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, so this phase's half about the confederation's room is gone; the ceremony room's half stands.
- The confederation's room: members labelled by group, the **Groups** card, and the sentence about
admins who joined later. Phase 0 check 4's second pin is flipped.
- The ceremony's room after formation: the banner links to the confederation, the composer is
@@ -750,7 +756,7 @@ and the one-minute sweep are guesses until a device run says otherwise.
| ask each role holder as well as each group | two questions per change per person. The group's quorum already is the role holders of that group, at its own threshold. Worth an opt-in per role holder if it is missed in practice |
| send the sealed 9436 into the confederation's room instead of a voucher | a seal is not transferable: only the group it was sealed to can open it |
| make the 9435/9436 rumors themselves signed | rumors are unsigned on purpose, and the seal already makes them binding between groups. The voucher is the one transferable statement, kept separate and never published |
| run the confederation's nested signing through the groups' inboxes | nonces, confirmations and partials are high-volume, person-to-person, and must stay in memory. The Marmot room already carries them |
| run the confederation's nested signing through the groups' inboxes | nonces, confirmations and partials are high-volume, person-to-person, and must stay in memory. The Marmot room already carries them. **Since chosen**, by [confederation-room-removal.md](./confederation-room-removal.md): the nonces' memory does not depend on the channel, every round has to reach every group anyway, and once the room was to go its being the channel was no reason. Each group's room carries its own role holders, and its admins carry a batch a round between the inboxes |
| delete the ceremony's NIP-17 room after formation | its messages are the genesis evidence, and a retry needs the room |
---
+24 -2
View File
@@ -20,8 +20,29 @@ room), and [confederation-profile.md](./confederation-profile.md), whose D5 to D
of the room this plan takes apart. Read [group-inbox.md](./group-inbox.md) for the inbox the bridge
writes to.
Written against `9db986c1`, on 2026-11-23. **Being built**, one commit a phase. Paths starting
`K/` are under `composeApp/src/commonMain/kotlin/mobi/giza/compose/`.
Written against `9db986c1`, on 2026-11-23. **Built, Phases 0 to 8, but for the device run and
Phase 0's check 6**, one commit a phase (Phase 5 folded into Phase 2), behind
`ExperimentalFeatures.confederation` and `ExperimentalFeatures.groupInbox`, both off in release.
Nothing here has run on a phone, a desktop client or a real relay. Paths starting `K/` are under
`composeApp/src/commonMain/kotlin/mobi/giza/compose/`.
**Development devices.** Schema 52 changed while it was built (Phases 4 and 7 were folded into it,
as earlier confederation plans folded theirs), so a device that ran a build from between the phases
holds a 52 Room will not open; clear its data. A device at 51 upgrades.
| what the plan said | what it turned out to be |
|---|---|
| Phase 2: sign every message; 30398 from Phase 4 | 30398 from Phase 2, as the envelope in every channel, the confederation's room included: an MLS inner event has no column for a signature |
| Phase 5, its own phase | folded into Phase 2: once every message travels in an envelope of signed events, a voucher -- already its group's signed event -- goes in as itself, and the 30396 wrapper, with the person's key it would have needed, goes |
| Phase 3: write to each seat group's room as well | and an envelope names the room it is written into: the same events in two rooms made one id, and the second row overwrote the first |
| D4: bundles carried out | carried out only when their author holds a seat in that group, or they are its voucher; anything else in the room was carried in, and would bounce |
| Phase 4: the switch | took two writes from later phases with it, both keyed onto the room: the signing's lines into the seat groups' rooms (Phase 6's D9) and no `GroupSignedEvent` under the confederation (Phase 7) |
| Phase 4: an admin who changes a bundle | not built: Phase 2 already drops a changed event on any path. Withholding, and the next admin's turn, was tested instead |
| D9: the composer | not a new screen: `AddGroupPostRoute` takes a `confederationId` |
| D9: an ask that needs attention | its own line type, `TYPE_CONFEDERATION_SIGNING_ASKED`, written as the person's own, as `NEEDS_YOU` lines are; a profile's attempt, which asks nobody, stays quiet |
| Phase 7: delete the room's state, which cascades | Room migrates with foreign keys off, so the migration walks `PRAGMA foreign_key_list` from `ChatRoom` and deletes dependents itself |
| Phase 7: a separate schema 53 if 52 had been kept | folded into 52 |
| Phase 8: `ConfederationPostNetworkJvmTest` | a case in `ConfederationProfileNetworkJvmTest`, on the same three real groups and inboxes, rather than forming them twice |
| phase | result |
|---|---|
@@ -32,6 +53,7 @@ Written against `9db986c1`, on 2026-11-23. **Being built**, one commit a phase.
| 4 | done. `ConfederationBridge`: a message heard in a group's room -- or written there by this device's owner -- is owed out by each of the group's current admins who holds its inbox key, at `k × 20` seconds by their place, but only when its author holds a seat in that group or it is that group's voucher, so nothing carried in bounces back out. Owed out is one 30398 rumor per group, confederation and sweep, sealed as the admin to every member group's announced inbox key and owed through `GroupInboxPublication` under the group's room; owed in is one envelope into the room, only where the group has a seated member who is not its admin. Seeing a copy back (through the group's inbox for out, in the room for in) marks it done on every other admin's device. `ConfederationCarry` keeps the turns, folded into schema 52, and is forgotten after the signing floor. `GroupInboxManager.receive` takes the identity's key, which `LiveSubscriptionManager` passes, and hands a 30398 to `ConfederationSigningManager.receiveFromInbox`; without a key it only files what came. **The switch:** `propose` takes the confederation's id; nothing in signing looks up a `ChatRoom` for the confederation, nor writes to one. Two writes that had a key onto the room moved here from later phases: the signing's lines go into each seat group's room (D9's half, from Phase 6), and `complete` no longer files a `GroupSignedEvent` under the confederation (from Phase 7; Phase 1 already filed it in `ConfederationEvent`). `ConfederationProfileFollowThrough` needs no room. The fixtures carry no confederation room: `ConfederationSigningJvmTest`'s pump ferries group rooms, runs the admins' turns and delivers inbox wraps, holding back an envelope or a wrap by what it carries (opened with the fixture's inbox secrets); `ConfederationTestGroups.pumpConfederation` does the same over real inboxes. `ConfederationSigningJvmTest` 24/24 (new: no room anywhere; each group's messages cross once, carried by its first admin; with the first away, nothing of Agora's crosses until the next admin's turn twenty seconds on; a founder Agora has demoted signs for their seat through Agora's room; one Agora has removed hears nothing and the others sign). Not built as planned: "an admin who changes a bundle" -- Phase 2's tests already drop a changed event on whatever path it comes, so withholding was tested instead. jvmTest 1,996 |
| 6 | done. `ConfederationScreen` gains **Posts** (its signed kind:1s from `ConfederationEvent`, and **Add post** for someone who holds a seat), **Charter** (signed, or **Propose the charter** for a seat-holder, or "no charter yet"), and **Signing** for a seat-holder: their attempts, the ones waiting on them first, then what is running, then the last five ended, each opening `ConfederationSigningScreen`. **Open the confederation's room** goes. The composer is `AddGroupPostRoute` with a `confederationId`, which proposes through `ChatRepository.proposeAsConfederation(confederationId, …)` and bylines the confederation, rather than a new screen. A post or charter the person must answer is a new line, `TYPE_CONFEDERATION_SIGNING_ASKED`, theirs and in `NotificationClassifier.NEEDS_YOU`; the proposer's own and a profile's, which nobody is asked, stay `…_PROPOSED` and quiet. A signed post is owed to relays by every device that signed it (D10). From the room screens: the confederation's card, its members' group labels, `ConfederationRoomInfo`, `confederationRoomInfo`, `confederationOfRoom`, `ChatRepository.proposeCharter`, `ConfederationRepository.holdsRoomOf`, and the confederation branches of the posts, profile and edit-profile view models; four strings, and the ceremony room's banner no longer says "works in its own room". `ConfederationSigningJvmTest` 26/26 (the room-info case replaced: an ask in each role holder's group room that is theirs; a post owed by every signer; the signing list's order), `ConfederationProfileScreensJvmTest` (a seat-holder's posts, add, charter and waiting attempt; a member without a seat offered nothing to sign; no charter said so). jvmTest 2,001; m3, brand, wallet and Marmot audits pass |
| 7 | done. `ConfederationFollowThrough` is deleted, with its launch, `welcomeReplaces`, `heldUnder` and `Confederation.roomCreator`. `ConfederationFormation.isConfederation` (a record, or a charter its key signed) is what a Welcome is refused on in `NostrDao` -- with the flag off too -- and what `MarmotGroupCreation.create` refuses a group id on. Folded into schema 52, `ConfederationRoomRemovalMigration` drops the column and every room whose id is a confederation's, after copying its signed events out. **Phase 0's check 4 was wrong for a migration:** Room runs one with foreign keys off, so deleting a room's row cascades nothing there (the test found its `MarmotRouting` row still standing). The migration therefore walks `PRAGMA foreign_key_list` from `ChatRoom` and deletes every dependent row, children first, besides the four tables that name a room with no key. D1's renames: `roomIdOf` is `idOf`, `Held.roomKey` is `key`. `ConfederationCeremonyJvmTest`'s four room cases become two: no device holds a room under the confederation's id, and nothing makes a group under it while its id reads as a confederation's. `ConfederationRoomRemovalMigrationJvmTest` 2/2: the room, its inner and group events and its routing go; a member group's room and the confederation's record stay. jvmTest 2,000; the audits pass |
| 8 | the record done; the device run not. `ConfederationProfileNetworkJvmTest` 3/3 runs with no room of the confederation's on any device: the profile change, endorsed and signed with nobody asked, and now a post proposed by one of Agora's admins, asked of the other eight in their own groups' rooms, approved, signed on all nine devices, filed and owed to relays. The demoted founder is `ConfederationSigningJvmTest`'s, on the per-person fixture, since the three-group harness has no way to demote. Pointers from confederation.md Phase 13, confederation-without-coordinator.md D11, and confederation-profile.md D5, D9, Phase 7 and its appendix. **Not done:** no device, desktop or relay has carried a round; Phase 0's check 7 is still arithmetic, and twenty seconds a place is a guess until a device run measures it. jvmTest 2,001; the audits pass; `compileDebugKotlinAndroid` builds |
---
@@ -418,6 +418,8 @@ past the newest this device knows is held until the one before it ends.
### D11. The confederation's room: a fixed order of who makes it, and a fallback
> **Since [confederation-room-removal.md](./confederation-room-removal.md):** a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, and what this section says of the room no longer holds.
[confederation.md](./confederation.md) Phase 13 had the coordinator's device make the Marmot room.
MLS needs one creator, so the role is kept, but no single person holds it:
+2
View File
@@ -883,6 +883,8 @@ group, rather than "17 of 21".
## Phase 13: the confederation's room
> **Since [confederation-room-removal.md](./confederation-room-removal.md):** a confederation has no room of its own. Its signing runs in each member group's own room, carried between the groups' inboxes by their admins, and what this section says of the room no longer holds.
> **Since [confederation-without-coordinator.md](./confederation-without-coordinator.md):** the first of the roster's people, sorted, makes the room, and the `k`-th
> after `k` hours with none; a welcome from earlier in the order replaces the room a device holds.