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

A group's profile and rules are written as the group

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:proposal/writes-meta

What changes

Records written as the group. A group's profile (fyi.opensocial.profile, at self) and rules (fyi.opensocial.rule) change only by an app writing them in meta with com.atproto.space.* (createRecord, putRecord, deleteRecord, applyWrites), using a token for the group, as the opensocial proposal's "Writing as the Group DID" has it. The token's scope must cover the write and the approving member must hold group.configure, as before. What updateProfile and putRule held now holds for the records themselves, in group_config.rs, called from the write path in token_writes.rs:

  • a profile needs a display name that is more than spaces, a join policy of open, approval or invite, a location of one of community.lexicon.location's kinds, a site on http or https, topics and languages each listed once and none blank; it stays at self and is never deleted;
  • a picture must be a blob the group uploaded, a PNG, JPEG or WebP of at most 2,000,000 bytes, named with the type and size the host kept (a record saying otherwise is refused, where updateProfile used to correct it);
  • a rule needs a title that is more than spaces, and is kept at a TID, so a label citing it keeps its URI;
  • the group's declaration, written in its public repo, is kept only at self, naming the group's own meta, and only while anyone may read meta; deleting it is always allowed.

Methods removed. updateProfile, uploadImage, putRule and deleteRule go: routes, handlers, lexicons and MCP tools. Pictures are uploaded with com.atproto.repo.uploadBlob, which a token for meta may do for images.

Lexicon. fyi.opensocial.rule's title is the proposal's length: 64 graphemes, 640 bytes (it was 100 and 1,000). createdAt stays, optional.

Console. The settings page writes the profile, pictures and rules as the group, through web/src/lib/asGroup.ts, which now gives a form's action a session for one space (withGroup): several writes and an upload with one getGroupAuth token, ended at /oauth/revoke once they are made, so the console's tokens no longer linger among the group's sessions (invites use it too). A put replaces the profile whole, so it rebuilds the record from getGroup, taking each picture's type and size from what /img serves.

MCP. updateProfile becomes putProfile; putRule and deleteRule stay by name but now write the records. Each is the write a group session the member approved for meta would make, inside the host: a grant for the member, its scope what getGroupAuth would give them at that moment (Host::group_scope, which getGroupAuth uses too), checked and logged as any token write is. Their input schemas are the record lexicons (RECORDS in group-host-mcp, a Kind::Record beside Query and Procedure); putRule takes an optional rkey.

Command. opensocial seed writes its two rules as the group, with the command's GroupSession.

Why

The proposal has apps write the group's records directly as the group, with the host checking each write's semantics and the session's permissions, and no method of its own for these. Nobody uses this host yet, so the methods it replaces go rather than stay beside it.

How it was checked

  • tests/group_config.rs rewritten as record writes with a console token: each case updateProfile, uploadImage, putRule and deleteRule held (blank name, unknown or old-style join policy, bad location, images not the group's, of the wrong type, too large, or named with another type or size; blank or over-long titles, negative order, missing text, a key that is no TID; deletes, twice), plus the declaration following meta's readers and the image serving test.
  • tests/assistants.rs: the record tools put the profile, make, change and delete a rule, refuse what the host refuses, and log as the assistant. tests/tokens.rs: the labeler's put and refusals.
  • group-host-mcp protocol tests for the record tools' kinds and schemas; the opensocial seed test checks the rules are in meta.
  • Tests that set a picture up (actors, authorization, migration) do it through a token now.
  • CI: check, test (the coverage gate), web, lexicons, docs and e2e all pass.

Shortcomings

  • The console rebuilds the profile from getGroup and /img, as there is no simpler read of the record for it; a profile's createdAt, which getGroup does not show, is dropped on the console's first write.
  • Through MCP a picture cannot be uploaded; a profile put keeps one only by naming a blob the group already holds.
  • The labeler stays as it was: writable at self in meta, never deleted. Roles, permissions, memberships and access records are the next stages'.

Review

Start at Host::face and Host::declaration in crates/group-host/src/group_config.rs, then record_as in assistants.rs.

🤖 Generated with Claude Code

Asked for changes

This pull moves the group's profile, pictures and rules onto ordinary record writes as the group. Host::face and Host::declaration hold the semantic checks that updateProfile and putRule used to hold. The four old methods and their lexicons are gone. The console, the MCP tools (record_as) and opensocial seed now write through tokens.

I'm asking for changes because the head no longer merges. At 07008815 every check on the pull fails with "conflicts with main at b4f5b68b" before it runs. The conflicting files are group-host-mcp/src/lib.rs, group-host-mcp/tests/protocol.rs, assistants.rs, group_tokens.rs, token_writes.rs, tests/common/oauth.rs, opensocial/src/lib.rs, docs/design/signing-in.md and docs/reference/mcp.md. These overlap with the code I reviewed: write_as, group_scope and record_as. Please merge main into the branch and resolve them. After that the test (100% gate), web, e2e and docs checks need to pass on the merged head. The earlier head, 31f39892, failed test and web (svelte-check), and I can't tell from here whether the newer commit fixed those.

What I read in group_config.rs, token_writes.rs, group_tokens.rs and assistants.rs looks sound. The checks are applied on the token path, and a profile can't be deleted or moved off self. A rule must be at a TID and have a title. A picture must be the group's own blob, with the type and size the host kept. The declaration is kept only while meta is public. I did not read the console, the CLI, the tests, the docs or the lexicon files in this pass, and I'll go through them once the branch is rebased.

Approved

The merge conflict I asked you to fix is fixed. The merge commit bf807105 brings in main, and the pull is now a fast-forward. Every check passes on this head: check (fmt and clippy), test (with the coverage gate), web (svelte-check and build), e2e, lexicons and docs. The earlier test and web failures at 31f39892 are gone.

The review path I read last round (group_config.rs, token_writes.rs, group_tokens.rs, assistants.rs) looked sound. I did not re-read it for the merge resolution, because the checks cover that code. This round I read web/src/lib/asGroup.ts. withGroup ends the token in a finally, so a refused write does not leave a session behind. GroupSession.write and upload return the host's refusal as the form's failure. I did not read the rest of the console, the CLI, the tests, the docs or the lexicon files line by line. The passing checks cover the tests and docs, and I have nothing to add there.

One thing to watch: in GroupSession.end, a network error from /oauth/revoke would throw out of the finally and replace the result of the writes. Catching it there would keep a completed write from showing as an error. It's minor, so it doesn't block this approval.

Merged as 858331d