~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

Someone always runs a group, admitting takes admit, and every member holds member

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:host/membership-fixes

What changes

Someone always runs a group. putRole refused to take group.configure from a role only when it was the one role that configured, counting roles rather than who holds them. With a second configuring role nobody held, an admin could give it up and lock the group. Now a role may give up configuring only while some member holds another role that does. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdbys3zdnz.

Admitting takes admit. admitMember checked the roles it gives against the caller's role.assign grants, so a role with admit alone could admit nobody. It now uses what the caller's admit grants may assign, as ejectMember uses eject's. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdcjogjhrs.

Every member holds member. Joining with default roles that leave out member, or being admitted with named roles that do, made a member who could not read the members space. Every membership the host writes now holds member. Fixes at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjdclbkeku6.

docs/design/membership.md says admit limits what an admitter gives.

How it was checked

New tests, each failing before the change: a_role_nobody_holds_keeps_nobody_running_it (members), and admitting_takes_admit_and_gives_member (joining), which admits with a role holding only admit, with named roles that leave out member, and with defaults that leave it out. The members, joining and invites tests pass; clippy is clean. The coverage gate is left to CI.

🤖 Generated with Claude Code

Approved

This pull makes three fixes and I found nothing that must change.

  • put_role: a role can give up group.configure only while some member holds another role that still configures. That counts holders instead of roles, which closes the lockout. held reads the membership records, and the new error text matches the new rule.
  • admit_member: it now checks the roles against assignable(&mine, "admit"), the same way ejectMember uses eject.
  • put_membership: it adds member to every membership it writes, so no path can create a member who can't read the members space.

The tests cover the three cases, and the docs line in membership.md matches the new behaviour. I read the diff and group_members.rs but didn't run the tests.

Two points to be aware of, neither blocking:

  • Every membership write now adds member, including role changes. A later role edit can't drop member from someone, which fits "everyone holds it" but is a behaviour change.
  • An admitter whose admit grant doesn't list member as assignable can still hand it out, because put_membership adds it. That seems intended.

CI will run the 100% coverage gate.

Merged as 5cabe0c