From b17a2b1ac5c80ae5b7d92667034d1e7bcbb60d28 Mon Sep 17 00:00:00 2001 From: Kgothatso Ngako Date: Fri, 20 Nov 2026 08:35:21 +0200 Subject: [PATCH] feat: new rooms are made on the Marmot current profile (marmot-v2, Phase 9, the flip) MarmotProfile.DEFAULT_FOR_NEW_ROOMS goes from LEGACY to CURRENT, so every creation site -- direct messages, convenient rooms, keyed rooms -- makes a current-profile group, and the pickers ask peers for current-profile KeyPackages. Rooms made before stay legacy for good. Two creation tests read the legacy 0xF2EE extension directly; they now read the room id, name and admins through the accessors that work on both profiles. Co-Authored-By: Claude Opus 5.5 --- .../mobi/giza/compose/nostr/MarmotProfile.kt | 15 ++++++------ .../managers/MarmotGroupCreationJvmTest.kt | 23 ++++++++++--------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/composeApp/src/commonMain/kotlin/mobi/giza/compose/nostr/MarmotProfile.kt b/composeApp/src/commonMain/kotlin/mobi/giza/compose/nostr/MarmotProfile.kt index dd36682e..7bb36f8a 100644 --- a/composeApp/src/commonMain/kotlin/mobi/giza/compose/nostr/MarmotProfile.kt +++ b/composeApp/src/commonMain/kotlin/mobi/giza/compose/nostr/MarmotProfile.kt @@ -34,14 +34,13 @@ enum class MarmotProfile( fun fromWireName(name: String?): MarmotProfile = entries.firstOrNull { it.wireName == name } ?: LEGACY /** - * The profile new rooms are created on. - * - * Legacy until the rollout flips it -- docs/marmot-v2.md, Phase 9. A - * current-profile room admits only leaves carrying an identity proof, which - * only a build past Phase 3 can make, so flipping this is the moment this - * app's users stop being able to make rooms for members who have not - * upgraded. One constant, read only by the two creation sites. + * The profile new rooms are created on: the current one, since the rollout + * flipped it -- docs/marmot-v2.md, Phase 9. A current-profile room admits only + * leaves carrying an identity proof, which only a build past Phase 3 can make, + * and refuses an older build's KeyPackage at the add step with words it can + * act on. Rooms made before the flip stay legacy for good. One constant, + * read only by the creation sites. */ - val DEFAULT_FOR_NEW_ROOMS: MarmotProfile = LEGACY + val DEFAULT_FOR_NEW_ROOMS: MarmotProfile = CURRENT } } diff --git a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/managers/MarmotGroupCreationJvmTest.kt b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/managers/MarmotGroupCreationJvmTest.kt index 1285b919..3fc1c19d 100644 --- a/composeApp/src/jvmTest/kotlin/mobi/giza/compose/managers/MarmotGroupCreationJvmTest.kt +++ b/composeApp/src/jvmTest/kotlin/mobi/giza/compose/managers/MarmotGroupCreationJvmTest.kt @@ -118,18 +118,19 @@ class MarmotGroupCreationJvmTest { ) val room = assertNotNull(db.chatRoomDao().findChatRoomById(groupId)) - val data = assertNotNull( - room.chatRoom.toMlsGroup()?.currentMarmotData(), - "a room created here has to be able to read its own group data back", + val group = assertNotNull( + room.chatRoom.toMlsGroup(), + "a room created here has to be able to read its own group back", ) // The source the guard reads, and the one that is right from epoch 0 on - // every device. `nostrGroupId` has to be the 32-byte derived id: a - // 33-byte value there produces an extension that reads back as null, - // silently, taking the admin list with it. - assertEquals(groupId, data.nostrGroupId) + // every device, on whichever profile new rooms are on. The room id has to + // be the 32-byte derived id: on the legacy profile a 33-byte value in + // `nostr_group_id` produced an extension that read back as null, silently, + // taking the admin list with it. + assertEquals(groupId, group.roomId()) assertEquals(64, groupId.length) - assertTrue(data.adminPubkeys.contains(user)) + assertTrue(user in group.currentAdminIdentities()) } @Test @@ -153,12 +154,12 @@ class MarmotGroupCreationJvmTest { ) val room = assertNotNull(db.chatRoomDao().findChatRoomById(groupId)) - val data = assertNotNull(room.chatRoom.toMlsGroup()?.currentMarmotData()) + val group = assertNotNull(room.chatRoom.toMlsGroup()) // Both, and the same string in each: the row is what this device draws in - // its room list, and the group data is what every other member reads. + // its room list, and the group's own name is what every other member reads. assertEquals("#Ekklesia", room.chatRoom.subject) - assertEquals("#Ekklesia", data.name) + assertEquals("#Ekklesia", group.roomName()) } /**