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

Members make, change and end the group's spaces

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

What changes

Members make, change and end the group's spaces. These are new methods in group_spaces.rs:

  • fyi.opensocial.createSpace (needs space.create) makes a space of a type and key, with:
    • its access record: who reads it; who writes in it in their own name (any member, unless it says); which roles write in it as the group;
    • an entry in the members space's index, named.
  • fyi.opensocial.updateSpace (needs space.configure) changes its name, readers, writers or roles.
    • The members space stays readable by member, and who writes in it in their own name, which is joining, can't change.
    • Meta's readers are the group's visibility. A new Host::declare adds the declaration in its public repo when anyone may read meta, and removes it when not.
    • writableBy: [] puts it back to any member. The record's createdAt is kept.
  • fyi.opensocial.deleteSpace (needs space.delete) ends a space:
    • It leaves the index, and its syncers get notifySpaceDeleted.
    • A new Host::end_space / Store::delete_space removes the authority's state: space, grants, writer set, registrations, and the group's own repo in it, with the blobs only that repo referenced.
    • Meta and members refuse with WellKnownSpace.
  • A space kept for chosen people is theirs: nobody who runs the group changes or ends it.

Host::may_do asks any action of a group's records, and put_in puts a group's record in any space. docs/design/groups.md gains "Its other spaces".

Why

This is the next part of 4d, following the prototype's methods/spaces.ts. One change: the prototype's deleteSpace only took the space out of the index. The space went on issuing credentials to whoever its access record let read. Here the host is the space's authority, so it ends it.

checkUserAccess, which the plan listed beside this, serves invite inboxes. It comes with invites.

How it was checked

tests/group_spaces.rs covers:

  • Making a space:
    • its access record, index entry and name;
    • may by it for a member and a stranger;
    • a default key, and no writers meaning any member;
    • every refusal: a non-admin, a taken key, a bad type, missing or malformed readers, no group.
  • Changing a space:
    • name, readers, scopes, writers set and cleared, and a no-op;
    • meta's declaration following its readers both ways, and repeated;
    • every refusal: a non-admin, chosen people, a space in no index, an unknown space, another group's, malformed, missing;
    • the members space losing member, its writers changed, bad writers;
    • the members space changed legitimately.
  • Ending a space:
    • a non-admin refused;
    • the index entry, space, the group's repo and its only blob gone;
    • the syncer told;
    • meta and members refused; a space in no index refused.

just cov is at 100% of lines and functions. Clippy is clean.

Shortcomings

  • Ending a space doesn't revoke credentials already issued for it. They lapse within an hour, and its repo hosts get no notice yet.

🤖 Generated with Claude Code

Approved

This adds createSpace, updateSpace and deleteSpace, with Host::declare, Host::end_space, Store::delete_space, may_do and put_in. It also adds the "Its other spaces" section in docs/design/groups.md and a README update. The test, check, web and lexicons checks pass, the last two skipped because nothing they read changed.

I read the diff and found nothing that must change.

  • Authorization: the authority and ownership checks are sound. The group's authority is checked, people spaces are refused, and meta and members can't be deleted.
  • Ending a space: delete_space removes the space's state and the group's own repo in one transaction, and only blobs nothing else references are unlinked from disk.

Small points, none blocking:

  • updateSpace with readableBy: [] is silently ignored, because of the .filter(|r| !r.is_empty()). createSpace accepts []. If the intent is that an update can't empty the readers, a 400 would be clearer than a quiet no-op.
  • update_space runs declare for meta before it writes the access record. If that write then fails, the declaration and the readers disagree. Declaring after the write would avoid it.
  • createSpace writes the space and then its access record, with the index entry last. A failure in between leaves a space with no access record or index entry. It stays inert, since own_space reports it as SpaceNotFound, but it is not cleaned up.
Merged as 0014024