Brings in a keyed room's step-down by request (bb35d73c) and keyed rooms born needing the group's signature, with the switch gone (1ccd8c7f). Resolved: AdminGovernance keeps giza's canAskToStepDown and stepDownProposer beside the policy-backed memberActions; the repositories keep memberActionOptions and lose requireSignatures; the loader no longer asks GovernanceSupport whose devices a room waits on. Reconciled: the policy offers your own row Step down as admin in a keyed room on canAskToStepDown's terms -- governed, rotation on, above the floor, another admin to ask -- so the menu matches the request giza added. SignaturesNotRequired carries no data and says the group was made before signed changes and keeps its admins, since nothing switches the rule on any more. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
26 KiB
Every member row offers every action, and says why one is not open
A phased plan for the member rows on the group detail screen. Every row but the viewer's own gets the overflow menu that only an admin sees today. The menu lists every action that applies to that member, whether or not the viewer can take it right now. An action that cannot be taken stays in the menu. Choosing it opens a screen that says what stands in the way and what would change that.
Built, one commit per phase on claude/group-member-row-actions-1016b2, in the
order 1, 2, 4, 3, 5, 6. Phase 4 came before Phase 3 so that no commit has a menu item
leading to a route that does not exist yet. The plan was written against 151f15ca
on giza, after member-admin-promotion.md Phase 11
put the menu on the row. Not run: nothing here has been on a device. What the
build did differently from the plan is listed in the next section.
Where the build chose differently
| plan | built | why |
|---|---|---|
D5: the route carries action: MemberAction |
It carries the action's name, a String. MemberActionUnavailableRoute.memberAction reads it back, and a name no build knows reads as null, which the screen shows as "no longer applies" |
The multiplatform navigation-compose 2.9.2 has no NavType for an enum. The route test caught this on its first run, which is what D5 asked of it |
D3: onClickLabel = "See why" on an unavailable item |
The item gets stateDescription = "Unavailable", plus the trailing info icon's description, "Why this is unavailable" |
The merged node reads as the action, why it is unavailable, and the state. Giving a second click label to a node whose click DropdownMenuItem already owns depends on which semantics modifier wins, and nothing here tests that order |
| D6: Only admin and Below the floor as separate reasons | The only admin is the floor of one, so one reason, OnlyAdmin. BelowFloor names a higher floor |
The first test run listed both for the same member |
D6: OfferPending for an offer from this account |
For an unanswered offer by anyone (PromotionManager.unansweredOfferTargets) |
A second admin asking again is the same duplicate |
D6: SignaturesNotRequired(waitingOn), "an admin turns that on", with Back to the group |
SignaturesNotRequired carries no data. It says the group was made before signed changes and keeps its admins, and it has no button |
Merged from giza: a keyed room is now born needing the group's signature, and the switch, the automatic switch and the waiting on devices are gone (1ccd8c7f). A keyed room without the rule is one made before that, and nothing turns it on |
D1: your own row shows Step down as admin when canDemote(me, me), never in a keyed room |
In a keyed room it is also shown when AdminGovernance.canAskToStepDown holds: the room needs the group's signature, rotation is on, you are above the floor, and another admin with a leaf is there to ask |
Merged from giza (bb35d73c): an admin of a keyed room steps down by asking another admin's device to propose it. D1 itself stands: your own row still lists only an open step-down |
| Phase 2: a view model test | A repository test in AdminChangesJvmTest, through the real database and group |
That is the loader both screens read, so testing it covers both |
What the row does today
ChatRoomDetailScreen.kt draws one Card per localChatRoom.localParticipants. The
card's onClick opens ProfilePreviewRoute. The trailing slot is one of two things:
MemberActionsMenu(MemberAdminControls.kt), whenchatRoomDetailUIState.memberActions[member]is non-empty. That is aMoreVertIconButtonwith aDropdownMenuof the allowed actions, inMemberAction.entriesorder.Icons.Default.ChevronRightwith the description "View profile", a hardcoded string, in every other case.
memberActions comes from AdminGovernance.memberActions(group, me, floor). The view
model calls it only when canGovern is true, meaning the room is on the current Marmot
profile, this device is an admin, and the room is neither disbanded nor left. The
function returns only the allowed actions and drops members with none. So:
| viewer | what a row shows today |
|---|---|
| not an admin, or any NIP-17 or legacy room | a chevron on every row; no actions, and no hint that any exist |
| an admin | the menu on rows where something is allowed, a chevron on the rest, with no explanation of the difference |
| an admin, own row | Step down as admin when canDemote(me, me), otherwise a chevron |
The reasons an action is refused already exist, but only as exception messages from
MarmotOutboundDao.promote/demote/removeMember, shown in a snackbar after the
fact. Nothing tells a person before they try.
Every reason an action can be refused, from the code
Read from AdminGovernance, MarmotGroupPermissions (marmot-kmp 2.2.1), the view
model's canGovern, and the refusals in MarmotOutboundDao:
| # | reason | where it is decided today | affects |
|---|---|---|---|
| 1 | The room is a NIP-17 room: it has no admins of its own; its members administer the room its key made | mlsGroupState == null; adminRoomId |
all |
| 2 | The room is on the legacy Marmot profile | marmotProfile() != CURRENT → group == null |
all |
| 3 | The group has been disbanded | currentGroupState().isDisbanded |
all |
| 4 | This device has left the group | chatRoom.leftGroupAt != null |
all |
| 5 | The viewer is not an admin | MarmotGroupPermissions.canManage |
all |
| 6 | A keyed room that does not require the group's signature yet | GovernanceGate.isGoverned inside keyedChangesAllowed |
make admin, remove as admin |
| 7 | A keyed room in a build without share rotation | ExperimentalFeatures.shareRefresh inside keyedChangesAllowed |
make admin, remove as admin |
| 8 | The member holds no leaf in the group (still being added, or already being removed) | target in members(group) in canPromote; the participant row exists without a leaf |
make admin, remove from group |
| 9 | They are the only admin among the members | MarmotGroupPermissions.canDemote (admin depletion) |
remove as admin |
| 10 | It would leave a keyed room below its admin floor max(3, t) |
AdminGovernance.keepsFloor with adminFloor |
remove as admin, remove from group |
| 11 | An earlier change to the room is still waiting for a relay | engine.gate.canPrepareLocalCommit → MarmotCommitPendingException |
all (transient) |
| 12 | They have already been offered admin and have not accepted | PromotionManager offers |
make admin (transient) |
Reasons 1 to 10 are facts about the group's state and can be computed when the screen loads. Reasons 11 and 12 are about work in flight; Phase 5 handles them separately.
The decisions
D1. The row's trailing control is the menu on every row but the viewer's own
Every other member gets the MoreVert overflow button whatever the viewer's role and
whatever the room kind. The chevron is removed from those rows.
The viewer's own row keeps what it has today: the menu with Step down as admin when that is allowed, the chevron otherwise. "Except the current user" asks for no always-on menu on that row. It does not ask to take away step down, which is the only place that action lives.
Decided: your own row is unchanged by this plan. The alternative was a full menu there too, with Step down explained when it is unavailable (a keyed room, or being the only admin). It was turned down to keep the request as worded: your own row lists nothing it cannot do.
D2. "All possible actions" means every action that applies to this member's role
A menu that offers Make admin on somebody who is already an admin makes no sense. That is a category error, not an action that is "disabled for the time being". Whether a member is an admin decides which of the two role actions appears:
| member | items, in this order |
|---|---|
| not an admin | Make admin, Remove from group |
| an admin | Remove as admin, Remove from group |
The order is fixed (MemberAction.entries), so an item never moves when it becomes
available. Whether a member is an admin comes from adminPublicKeys, the group's
state, as D1 of member-admin-promotion requires. Where there is no group to read (a
NIP-17 or legacy room), it comes from participant.adminAt, the only source those
rooms have.
The member-admin-promotion table's Retry enrollment and Rotate shares rows
were never built as MemberActions and are out of scope here (see Out of scope).
D3. An action the viewer cannot take now is listed, marked, and explains itself
An unavailable item is not enabled = false. M3's disabled DropdownMenuItem
takes no click, so the explanation screen could never be reached from it. Instead:
- The text uses
MaterialTheme.colorScheme.onSurfaceVariantthroughMenuDefaults.itemColors(textColor = …), a role, with no.copy(alpha = …). - A trailing
Icons.Outlined.Infoicon with a decided description, "Why this is unavailable", from the catalogue. - Semantics:
stateDescription = "Unavailable"andonClickLabel = "See why", so a screen reader says what the visual does.
Choosing it closes the menu and navigates to the explanation screen (D5). An available item behaves exactly as it does now: the confirm dialog for an admin change, and the direct call for Remove from group.
D4. One function decides, and it returns reasons, not a set
Today memberActions returns Set<MemberAction>, which can say yes but not why not.
It is replaced at the source by a function that returns, for each member, each
applicable action together with an ordered list of what blocks it:
data class MemberActionOption(
val action: MemberAction,
val blockers: List<MemberActionBlocker>, // empty = available
)
AdminGovernance.memberActions stays as a thin filter over it (blockers.isEmpty()).
Every caller and test that relies on it, including AdminChangesJvmTest and
GovernanceGateJvmTest, keeps passing unchanged. That is the proof the new function
agrees with the old one where the old one had an answer.
The rules stay in one place, as the comment on AdminGovernance asks. The screen
never decides an action itself, and neither does the explanation screen.
Order of blockers. Room-wide reasons come first, then the viewer's role, then the room's rules, then the member, then work in flight. The screen leads with the first blocker and lists the rest under it. That way a non-admin in a disbanded room hears "the group was disbanded" rather than "you're not an admin".
D5. The explanation is a pushed screen, and it recomputes its reason
A new route:
@Serializable
data class MemberActionUnavailableRoute(
val activeUserPublicKey: String,
val chatRoomId: String,
val memberPublicKey: HexKey,
val action: MemberAction,
) : Route()
The route carries what was asked, not the answer. The screen's view model reloads the room and runs the same D4 function. That has three consequences:
- The reasons cannot be stale, and they cannot be forged by whatever built the route.
- If the blocker clears while the screen is open, for example when a relay accepts the pending commit, the screen says so instead of explaining something no longer true.
- The route has no list of sealed classes to serialise.
navigation-compose 2.9.2 serialises an @Serializable enum in a type-safe route. A
route test pins this, so a regression fails in the test and not on a device.
It is a screen rather than a dialog because the request says "open a screen", and
because some reasons need room. Reason 6 names who has not updated Giza. Reason 10
explains a floor and points to the fix. A pushed screen also gets
NavigateBackButton, which the desktop target needs (CLAUDE.md, "A pushed screen has
a way back").
D6. Each reason says what is in the way and what would change it, with the one action that helps
| blocker | title | what would change it | the screen's one action |
|---|---|---|---|
NoAdminsInThisRoom |
This room has no admins | Its members administer the group's admin room. Make the change there. | Open the admin room (when adminRoomId is known) |
LegacyRoom |
This group uses an older format | Groups made before the current format can't change who runs them. A new group can. | — |
Disbanded |
This group was disbanded | Nothing can change a disbanded group. | — |
YouLeft |
You've left this group | Only members can make changes. | — |
NotAnAdmin(admins) |
Only admins can do this | Ask one of the group's admins: {names}. | — |
SignaturesNotRequired |
This group was made before signed changes | Who runs a group with a shared key changes only with the group's signature. This one was made before Giza asked for one, so its admins stay as they are. A new group can. | — |
ShareRotationUnavailable |
Not in this version of Giza yet | Changing the admins of a group with a shared key moves a share of the key, and this version can't do that yet. | — |
NotInGroupYet |
{name} isn't fully in the group | They're still being added, or they're already being removed. Try again once that has landed. | — |
OnlyAdmin |
{name} is the only admin | A group always needs an admin. Make someone else an admin first. | — |
BelowFloor(floor) |
A group with a shared key needs at least {floor} admins | Make someone else an admin first, then try again. | — |
ChangePending |
An earlier change is still on its way | A relay hasn't accepted the last change to this group. This clears by itself. | — |
OfferPending |
{name} has already been asked | They've been offered admin and haven't answered yet. | — |
These lines are drafts. They go into strings.xml in sentence case, interpolated
with %1$s and never "${…}", and they keep the apostrophes CLAUDE.md warns
Compose Resources does not unescape. StringCatalogueJvmTest gains a case for any
escape the new strings rely on.
When the screen recomputes and finds no blocker, it shows "You can do this now" and a Back to the group button, which pops back. It does not perform the action itself: the confirm dialogs and their wording live on the detail screen, and two copies of them would drift apart.
D7. The row still opens the profile, and says so
Removing the chevron removes the only visual hint that the card is a target. The
Card keeps its onClick to ProfilePreviewRoute and gains
Modifier.semantics { onClick(label = "View profile", …) } from the catalogue, so
assistive technology keeps the information the chevron's description used to carry.
This also replaces one of the hardcoded contentDescription literals.
Phase 1 — the reasons, as a pure function
One day. No UI change.
-
ui/view/state/MemberAction.kt: addMemberActionOptionand asealed interface MemberActionBlockerwith the cases in D6. The ones that carry data areNotAnAdmin(admins: Set<HexKey>)andBelowFloor(floor: Int); the rest aredata objects. -
managers/MemberActionPolicy.kt, new: a pure function over a plain context, so every case can be tested without building an MLS group:data class MemberActionContext( val room: RoomKind, // NIP17, LEGACY, CURRENT val isDisbanded: Boolean, val hasLeft: Boolean, val me: HexKey, val admins: Set<HexKey>, // the group's, or adminAt-derived (D2) val members: Set<HexKey>, // holders of a leaf; empty off-CURRENT val isKeyed: Boolean, val governance: GovernanceStatus?, val shareRefresh: Boolean, val floor: Int, ) object MemberActionPolicy { fun options(context: MemberActionContext, rows: List<HexKey>): Map<HexKey, List<MemberActionOption>> }The function defers to
MarmotGroupPermissionsfor the library's rules (D4: one place). It checks blockers in D4's order. It returns an entry for every row exceptme, plusmewithSTEP_DOWNonly when step down is available (D1). -
AdminGovernance: addcontext(group, me, floor, …), which builds the context from anMlsGroup. Re-expressmemberActionsasMemberActionPolicy.options(...)filtered to available, with the same signature.
Tests, MemberActionPolicyTest (commonTest, no fixtures):
- one test per blocker, for each action it affects, asserting it is present and first where D4's order says it should be;
- the D2 table: which of make/remove-as-admin appears per role, in fixed order;
- no entry for
meexcept step down; - the equivalence:
AdminChangesJvmTestandGovernanceGateJvmTestrun unchanged against the re-expressedmemberActions.
Phase 2 — the state, for every viewer and every room kind
Half a day.
ChatRepository/DatabaseChatRepository: addsuspend fun memberActionOptions(localChatRoom): Map<HexKey, List<MemberActionOption>>. It builds the context the wayChatRoomDetailViewModel.initiateChatRoomDetaildoes today: group,isDisbanded,leftGroupAt,adminFloor,governanceStatus. It is the one loader both screens use, so the detail screen and the explanation screen cannot disagree. Give theNO_OPrepository an empty map.ChatRoomDetailUIState.Loaded: replacememberActions: Map<HexKey, Set<MemberAction>>withmemberActions: Map<HexKey, List<MemberActionOption>>, and fix the KDoc.ChatRoomDetailViewModel: drop thegroup?.takeIf { canGovern }guard and fill the field from the repository call for every room.canGovernstays as it is for disband and the other admin controls.
Tests: extend the view model's existing loaded-state tests, or add a small one, for
a non-admin viewer (every row has options, all blocked by NotAnAdmin) and a NIP-17
room (every row blocked by NoAdminsInThisRoom).
Phase 3 — the row
One day.
MemberActionsMenutakesoptions: List<MemberActionOption>and two callbacks:onAction(MemberAction)for available items andonExplain(MemberAction)for the rest. Unavailable items are styled as D3 says.ChatRoomDetailScreen'strailingContent:- another member → always
MemberActionsMenu; - the viewer's own row → the menu when it has
STEP_DOWN, otherwise the chevron (D1), with its description moved to the catalogue; onExplain→onNavigateToRoute(MemberActionUnavailableRoute(...)).
- another member → always
- The card's
onClicksemantics label (D7). - Strings:
why_this_is_unavailable,unavailable,see_why,view_profile.
Tests, ChatRoomMemberRowJvmTest:
- update
onAllNodesWithContentDescription("Member actions").assertCountEquals(1). With both fixture rows being other members, the count is now 2, and that is the point of the change; - a non-admin viewer opens the menu on each row and sees Make admin and Remove from group, both marked unavailable;
- choosing an unavailable item navigates to
MemberActionUnavailableRoutewith the member and the action, and opens no dialog; - an available item still opens "Make Nomvula an admin?" (the existing test, with the new state shape);
- the viewer's own row has no menu unless step down is available;
- tapping the row body still opens
ProfilePreviewRoute, as both existing tests require.
Phase 4 — the explanation screen
Two days.
-
routes/MemberActionUnavailableRoute.kt(D5), and itscomposable<…>inGizaNavHost.kt, next toProfilePreviewRoute. The host passespopBackStack()asonNavigateBack, and passesonNavigateToRoutefor Open the admin room. -
MemberActionUnavailableViewModel: loads the room, callschatRepository.memberActionOptions, picks the option for(member, action), and exposes:sealed interface MemberActionUnavailableUIState { data object Loading data class Error(val message: String) // room or member gone data class Blocked(val memberName: String, val action: MemberAction, val blockers: List<MemberActionBlocker>, val adminNames: …, val adminRoomId: String?) data class NowAvailable(val memberName: String, val action: MemberAction) }It re-runs on
observeSharesInputs(chatRoomId)and on a room change, so a blocker that clears while the screen is open is reflected there (D5). -
MemberActionUnavailableScreen:TopAppBartitled with the action ("Make Nomvula an admin"), withNavigateBackButton(onNavigateBack);- content root
Modifier.padding(innerPadding).readableContent(); ScreenStateTransitionover thewhen, which is the composable's whole body (CLAUDE.md);LoadingDataIndicator,ErrorState(onRetry = viewModel::reload), and the two loaded states. InBlocked, the first blocker's title isheadlineSmallwith its body and its D6 action below. Any further blockers follow as a list under "Also in the way".NowAvailableshows the D6 "You can do this now" layout;- spacing only from
MaterialTheme.spacingsemantic names, and colour only from roles; - a leading icon per blocker family (lock for role, group for room, schedule for
transient), each
Decorativebecause the title beside it says the same thing.
-
Strings: every D6 title and body, "Also in the way", "You can do this now", "Back to the group", "Open the admin room".
Tests, MemberActionUnavailableScreenJvmTest, rendered the way
ChatRoomMemberRowJvmTest renders (runDesktopComposeUiTest, GizaTheme):
- each blocker renders its title and body, with names and the floor interpolated;
- Open the admin room navigates to the admin room's route and appears only for
NoAdminsInThisRoomwith a knownadminRoomId; - two blockers: the first leads and the second is under "Also in the way";
NowAvailableshows its message and Back to the group callsonNavigateBack;- the back button exists (desktop has no system back);
- a route round-trip test:
MemberActionUnavailableRouteencodes and decodes with eachMemberAction(D5's pin).
Phase 5 — reasons about work in flight
One day. These two need a query each, and they change without the group's state changing, so they ship after the screen works for the eight structural reasons.
ChangePending: the repository asksengine.gate.canPrepareLocalCommit(routingId)when it builds the context. Two cases: a room with no live engine group, which is not this blocker, and a gate that clears, which the explanation screen's observer has to see.OfferPending: aPromotionManagerquery for an open offer from this account to the member. TodaypendingOfferanswers only for an offer tome, so this is a new query over the same rows.- Both go last in D4's order, and both say "this clears by itself".
Tests: policy cases for both. A repository-level test with a gate held by an
unconfirmed commit shows ChangePending, and confirming the commit clears it.
Phase 6 — docs and the audits
Half a day.
- Set this note's status line to built, with any choice the build made differently.
- Add an entry in README.md.
- In member-admin-promotion.md Phase 11, add a line pointing here: its "the view model hides an action that would break [the floor] and says why" (D8) is now done by explaining instead of hiding.
- Run
./gradlew :composeApp:m3Audit. It must stay at 0 spacing.dp, 0 hardcoded colours, 0 title-case strings, 0 unguarded.clickableand 0 untriagedcontentDescription = null. The two literals this work removes ("View profile" on the chevron, and the row's implicit one) may lower the reported count of literals in composables. ./gradlew check, which also runs the brand and wallet audits. The new strings say Giza, never Bennu, and none of them mentions a wallet.
Ship order
| commit | phases | users see |
|---|---|---|
| 1 | 1 | nothing; the rules gain reasons, with old behaviour pinned |
| 2 | 2, 3, 4 | the menu on every other member's row; every unavailable action explains itself |
| 3 | 5 | "an earlier change is still on its way" and "already asked" instead of a snackbar after the fact |
| 4 | 6 | — |
Phases 2, 3 and 4 ship together. A menu whose unavailable items navigate to a route that does not exist yet is worse than today's chevron.
Checking the work
./gradlew :composeApp:compileDebugKotlinAndroid :composeApp:jvmTest
./gradlew check
By hand, on the desktop target, which has no system back:
- As a non-admin in a robust group: every other row has the menu, both items are marked, and each opens a screen naming the admins. Back returns to the group.
- As an admin of a robust group at its floor of three: Remove as admin on another admin explains the floor. Make a fourth member an admin. Once the change lands, the open explanation screen switches to "You can do this now".
- As an admin of a keyed room made before signed changes: Make admin explains that the group keeps its admins. In one born needing the signature, with four admins, your own row offers Step down as admin, and the request goes to another admin.
- In the group's NIP-17 room: every row explains that the room has no admins, and Open the admin room goes there.
- With TalkBack/VoiceOver: an unavailable item reads as "Make admin, unavailable, double-tap to see why", and the row body reads as "View profile".
Estimate
| phase | size |
|---|---|
| 1 — the reasons | one day |
| 2 — the state | half a day |
| 3 — the row | one day |
| 4 — the explanation screen | two days |
| 5 — work in flight | one day |
| 6 — docs and audits | half a day |
About six days. Nothing waits on marmot-kmp or mls-kmp; every rule it reports already
exists in this repository or in MarmotGroupPermissions.
Open questions
- Q1. "View profile" in the menu. D7 relies on the row body. Adding View profile as the menu's first item would make the menu a complete list of what can be done to a member, at the cost of a duplicate target.
Out of scope
- Retry enrollment and Rotate shares as row actions (member-admin-promotion's
Phase 11 table). They are not
MemberActions. Rotation is already offered from the Shares section, and enrollment retries are driven by the ceremony. - Performing an action from the explanation screen (D6).
- Direct-message rooms, whose detail screen has no member rows.