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 <noreply@anthropic.com>
This commit is contained in:
Kgothatso NgakoandClaude Opus 5.5 committed 2026-11-20 08:35:21 +02:00
1 parent c64ba8aae4
commit b17a2b1ac5
2 files changed
+19 -19

No files matched your search

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