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()) } /**