chadtmiller.com/group-host
atmosphere group host
Roles are defined and given; members are put out or leave, and read no more
MergedThis adds role definition, role assignment, eject and leave. It also records issued credentials, revokes them when someone is put out or leaves, and makes the index drop writers the space no longer lets write. The structure follows the prototype and the revocation flow reads sensibly. I read only the Rust sources, store.rs, authority_api.rs and the eject_member test calls in tests/members.rs. I did not read the rest of tests/, the lexicon JSON or the docs.
Must fix: eject_member has no LastConfigurer check, although the PR says the last configuring role's last holder stays. If the caller's eject grant lists a configuring role as assignable (the usual admin setup), the only admin can eject themselves. The target is then a role the caller "may give", so the NotAssignable check passes and put_out runs. That leaves a group nobody can configure, which is the state leave_group is written to prevent. The tests cover a moderator being refused and ejecting others, but not self-eject or ejecting the last configurer. Apply the same "no other holder of a configuring role" check as in leave_group before put_out, and add a test.
assign_roles has the same gap in a milder form. A sole admin whose role.assign covers admin can remove admin from themselves, or from the last other holder, and leave the configuring role with no holders. The same check would cover it.
Smaller: put_out deletes the membership before it revokes credentials. If revoke_credentials fails, the call returns an error but the member is already out, and their credentials stay live until they lapse. A retry then gets NotAMember. Consider revoking first, or logging and continuing, so the outcome doesn't depend on that error.
crates/group-host/src/group_members.rsline 430Outdated
These lines can no longer be read.
No last-configurer guard here: the only admin can eject themselves when their grant makes admin assignable for eject. Check that another member holds a configuring role, as leave_group does.
crates/group-host/src/group_members.rsline 397Outdated
These lines can no longer be read.
The membership is already deleted when this can fail, so an error leaves the member out with live credentials and a retry gets NotAMember.
Changed:
- ejectMember and assignRoles now run the same check as leaveGroup, through one helper (keeps_a_configurer): after the change, someone must still hold a role that configures the group. A sole admin can no longer eject themselves or strip admin from the last holder. A test covers both refusals, and both succeeding once a second admin exists.
- put_out revokes credentials before it deletes the membership. A failed revocation leaves the member in, and the call can be made again.
Both items from my earlier review are addressed. I read only the Rust in group_members.rs, not the new tests.
- Last configurer:
keeps_a_configureris now called fromassign_roles,eject_memberandleave_group. It passes if the affected member keeps a configuring role, or if some other member holds one. A sole admin can no longer eject themselves or stripadminfrom the last holder. - Revoke order:
put_outnow revokes credentials before it deletes the membership. If revocation fails, the member stays in and the call can be retried.
One small leftover: if space_write for the delete fails after revocation, the member stays in with revoked credentials. That is harmless and a retry works.
What changes
Roles are defined and given; members are put out, or leave. These are new methods in
group_members.rs:fyi.opensocial.putRole(needsgroup.configure) defines or changes a role:fyi.opensocial.deleteRole(needsgroup.configure) takes away a role nobody holds, elseRoleInUse.fyi.opensocial.assignRoles(needsrole.assign) gives a member the roles named:NotAssignable), and each must be defined.NotAMember).membergoes only by ejecting or leaving (MemberRole).fyi.opensocial.ejectMember(needseject) puts out a member each of whose roles the caller may give or take.fyi.opensocial.leaveGroup: anyone but the last member able to configure the group may leave.LastConfigurer).Out is out. A member put out, or leaving, reads the group's spaces no more:
issued_credential), to whom, until it lapses.notifyCredentialRevoked, signed by the group, best effort.The lexicons gain the errors these methods return.
docs/design/membership.mdis new, and the plan marks this part of step 5 done.Why
This is step 5's first part, following the prototype's
methods/roles.ts,methods/membership.tsandleaveGroup. It changes these:assignRolesrefuses a non-member. The prototype wrote them a membership, which admitted them past any admit.deleteRolerefuses a held role, as the lexicon'sRoleInUsesays.How it was checked
tests/members.rscovers:LastConfigurer.RoleInUse,LastConfigurer, a non-configurer, no role.MemberRole,NotAMember, an undefined role,Forbidden, missing fields.NotAMembertwice;The address backfill test now finds its migration by what it does, as more migrations come after it.
just covis at 100% of lines and functions, and clippy andjust lexare clean.Shortcomings
revokeMemberTokensin the prototype) come with signing in.🤖 Generated with Claude Code