fix: a rotation reads the admin policy alone, now the founding-admins check is gone
giza deleted FoundingAdmins.check (remove-founding-admins-card): it cannot tell a founder left out by a buggy creator from one the group demoted, and every founder is an admin when the room is made. RoomAdmins drops its missing-founders guard, and A4 says why. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d072fa7f90
commit
d6c34a7762
5 files changed
+14
-21
No files matched your search
@@ -180,8 +180,7 @@ object AdminGovernance {
|
||||
if (adminChangeHold(database, localChatRoom) != null) return ROTATION_PENDING_REFUSAL
|
||||
|
||||
val adminsAfter = (change.admins ?: currentAdmins) - change.removes
|
||||
val missing = RoomAdmins.of(database, localChatRoom.chatRoom.id)?.missingFounders.orEmpty()
|
||||
val retire = holders - adminsAfter - missing
|
||||
val retire = holders - adminsAfter
|
||||
// Only a change that itself takes a share away owes a rotation.
|
||||
if (retire.none { it in change.removes || it in currentAdmins }) return null
|
||||
return ShareRefreshManager.owedRotationRefusal(key, shares, retire)?.let {
|
||||
|
||||
@@ -6,22 +6,20 @@ import mobi.giza.compose.database.GizaDatabase
|
||||
|
||||
/**
|
||||
* Who a keyed room's live admin policy names, as far as the share work reads it
|
||||
* (docs/admin-change-rotation.md): the admins, whether the group's signature
|
||||
* governs the room -- so that the policy changes only by a signed commit -- and
|
||||
* any founding member [FoundingAdmins.check] finds the policy missing, whose
|
||||
* absence the group never signed.
|
||||
* (docs/admin-change-rotation.md): the admins, and whether the group's signature
|
||||
* governs the room, so that the policy changes only by a signed commit. Every
|
||||
* founding member is an admin when the room is made (docs/robust-group-admins.md),
|
||||
* so a holder a governed room's policy does not name is one the group took out.
|
||||
*/
|
||||
data class RoomAdmins(
|
||||
val admins: Set<HexKey>,
|
||||
val governed: Boolean,
|
||||
val missingFounders: Set<HexKey> = emptySet(),
|
||||
) {
|
||||
/**
|
||||
* Whether [member] is someone the group's signature took out of the admins:
|
||||
* the room is governed, the policy does not name them, and they are not a
|
||||
* founder it has been missing from the start.
|
||||
* the room is governed and its policy does not name them.
|
||||
*/
|
||||
fun removedBySignature(member: HexKey): Boolean = governed && member !in admins && member !in missingFounders
|
||||
fun removedBySignature(member: HexKey): Boolean = governed && member !in admins
|
||||
|
||||
companion object {
|
||||
/**
|
||||
@@ -36,8 +34,7 @@ data class RoomAdmins(
|
||||
override?.let { return it(chatRoomId) }
|
||||
val room = database.chatRoomDao().findChatRoomById(chatRoomId) ?: return null
|
||||
val group = runCatching { database.marmotEngine.groupFor(room.routingId) }.getOrNull() ?: return null
|
||||
val missing = (FoundingAdmins.check(database, chatRoomId) as? FoundingAdmins.Check.Missing)?.publicKeys.orEmpty()
|
||||
return RoomAdmins(group.currentAdminIdentities().toSet(), GovernanceGate.isGoverned(group), missing)
|
||||
return RoomAdmins(group.currentAdminIdentities().toSet(), GovernanceGate.isGoverned(group))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -149,8 +149,7 @@ object ShareRefreshManager {
|
||||
* A3 and A4): every admin holds a share (R1), so no rotation deals a new one
|
||||
* to somebody who is no longer an admin -- whichever rotation runs first after
|
||||
* a demotion takes their share away, the one it owes or anybody's. Only in a
|
||||
* governed room, whose admins change only by a signed commit, and never for a
|
||||
* founder the policy has been missing from the start.
|
||||
* governed room, whose admins change only by a signed commit.
|
||||
*/
|
||||
private suspend fun removedBySignature(database: GizaDatabase, localChatRoom: LocalChatRoom, shares: ShareGenerations.Shares): Map<Int, ShareStanding> {
|
||||
val admins = RoomAdmins.of(database, localChatRoom.chatRoom.id) ?: return emptyMap()
|
||||
|
||||
Reference in new issue
Block a user