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

Each role carries its own grant, and admins may give every role

Merged
Merged chadtmiller.com asked to merge into feature/proposal-nov from chadtmiller.com/group-host:roles/grants

What changes

Roles carry their own grants. The members space keeps no fyi.opensocial.permissions record any more: each fyi.opensocial.role record holds its group-wide scopes[] (strings of 1 to 2000 characters, at most 100) and assignable[] (role keys, or * for every role, at most 100), as the opensocial proposal's group.opensocial.role does. defs#groupGrant and defs#roleId go with it; the members space lists no permissions collection (retired in harness/lexicons.mjs), and the configure permission set names role alone in the members space.

* gives every role, those made later too. A writer whose roles' assignable union holds * may give, take and eject over any role, and only such a writer may put * in a role's list.

A role write is held to what the writer holds. In a role write the writer changes the grant (scopes or assignable) only of a role in their assignable union, or one the same batch makes; adds only scopes their roles hold, permission sets expanded; and adds to assignable only roles already in their union. A role goes once nobody holds it (RoleInUse); LastConfigurer, MemberRole and the rest of the membership rules carry over.

A new group's roles. admin holds every action's scope and repo:*, with assignable: ["*"], and the founder and stewards hold it; member is the default.

Memberships drop member. A membership is keyed by its member's DID and its roles are plain record keys, as upstream's; the host reads the member from the key.

Console, command and tools. Creating a role in the console writes the one role record with its scopes and assignable roles (with "Any role, even ones made later" for one who may give every role); the group page lets a * holder give every role. role set and role_set take --scopes/scopes and --assignable/assignable; role grant/role_grant add to or take from the role's own record, refusing a role the group does not have; role delete deletes a role nobody holds.

Why

The proposal of 16–19 Nov 2026 folds the permissions record into roles (part 2 of the catch-up) and drops a membership's member (part 6). A grant kept beside its role means a role and what it may do are written, read and deleted together, and * lets a group's admins give roles made after them without rewriting their own.

How it was checked

  • members.rs: * covers a role made after the group; a writer without * may not add it, to a role of theirs or a new one; escalation refusals on role writes (another's grant, giving a role or * they cannot, a scope they lack, a new role's grant beyond what they hold); a role they make is theirs to grant but not to give; a role goes once nobody holds it.
  • groups.rs: a new group's admin and member role records and the stewards' memberships.
  • rbac.rs: role records read as grants, assigns, and a membership key read back as its DID.
  • MCP (protocol.rs, mcp.rs) and command (commands.rs) tests for the role tools on role records.
  • The rest is left to CI: the coverage gate, just lex, the console's checks and e2e.

Shortcomings

  • A role made by a writer without * is theirs to grant but nobody's to give until someone who may give it lists it, as the proposal has it.
  • Space access records (fyi.opensocial.access) are untouched here; space policies come in their own pull.
Approved

This folds the permissions record into each role record. assignable can now hold *, and a membership is keyed by its member's DID with no member field. I read the core of it: member_writes.rs, rbac.rs, group.rs, group_config.rs, group_members.rs, and the role and membership lexicons. The rest of the 51 files I did not read: the console, the command and MCP tools, and the tests. They follow the same change, and I left them to CI.

The role-write checks hold up. A writer can change a role's grant only if it is in their assignable union or the same batch creates it. A scope they add must be covered by what they hold, with permission sets expanded. A role they add to assignable must be in their union, and only a * holder can add *. * is filtered out of the roles checked for existence, and RoleInUse, LastConfigurer and the membership rules carry over. The founder and stewards still get admin, whose scopes cover every action.

Two small things that don't block the merge. Neither is checked, and I don't think either is a hole:

  • Removing scopes or assignable entries from a role takes only the assignability check, with no check on what is removed. A writer who may assign admin could therefore drop * from it. This matches how the old permissions record behaved.
  • rkey_did turns a record key back into a DID by guessing at the %3A port encoding for did:web. A test with a did:web port and path would pin it down, if one isn't there already.
Approved

My approval at 00bfe32 stands. Since then the pull added a docs commit for the new role model and a test change. The test now has joining admit a member with a role made after the group, which fits * covering later roles. It also merged the base, whose changes are not this pull's. Nothing since touches the role-write checks I reviewed. I did not read the docs diff line by line.

Earlier I raised two small points, and neither blocks the merge. They were that removals from a role's grant are only checked for assignability, and that rkey_did has no did:web port test. They are still open.

Merged as 6fa1c4a