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

Labels are the proposal's com.atproto.label.label, written as the group

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:moderation/label-record

What changes

Labels are records written as the group. A label is the proposal's com.atproto.label.label (uri, optional cid, val, cts, exp). Apps, the console, the CLI and MCP write it with com.atproto.space.createRecord and the rest, using a token for the group. It goes beside its subject: a record's label in that record's space, an account's in the members space. The host refuses a label whose uri is neither a DID nor a record in the space it is written to. fyi.opensocial.applyLabel, negateLabel and the fyi.opensocial.label record are gone.

Deleting a label takes it back. There is no neg record any more. The queue still keeps both events: a labelEvent when a label is written, and one with deleted: true when it is deleted, each with who did it.

One label action. takedown is folded into label, granted by space:*?collection=com.atproto.label.label, which is the proposal's one grant for writing labels in any group space. A holder writes labels in every space of the group's, except that in a space for chosen people only those of the people who hold it may. A token from getGroupAuth, and an app's narrowed scope, carry label writes for holders unless the space's own grant already covers them. The moderate permission set, and the meta and members space types, now name com.atproto.label.label. The host has eleven actions, down from twelve.

The console's Review dialog writes the record as the group with a token for the label's space, and takes a label back by deleting each of the group's records of that value on the subject (listSpaceRecords by uri), in one applyWrites. Take down and every label's × show to a role with label, where main had given takedowns to takedown.

mod label / mod_label write and delete the record. They no longer take --rule, which the proposal's record has no field for.

The lexicon check matched names by prefix, so fyi.opensocial.labeler counted as a use of fyi.opensocial.label. It now matches whole names.

Why

This is the "Labels as the proposal's" item on the open questions issue, at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.issue/3mzjilmwvs2bn. It was waiting on the proposal to define the record. The proposal now has it as a strawman (lexicons/com/atproto/label/label.json), with labels written through CRUD and negated by deletion. A collection grant cannot tell !hide from spam, and the proposal has no takedown grant, so takedown goes.

Our copy in lexicons/upstream makes one change: the proposal renamed createdAt to cts but left createdAt in required. As written, no label could be valid, so ours requires cts. That should go back to the proposal.

How it was checked

  • moderation: a label beside a record, and one on an account. Taking a label back by deleting it, and deleting one nobody wrote. Both history events, including those for one version of a record. Refusals for a subject not beside the label, a long value, and a missing cts. Labels need label, a single grant covers every value, and writes stop once the role is gone.
  • group_tokens and oauth_scope: tokens and narrowed scopes with labels, without a redundant label scope next to collection=*.
  • rbac: the actions a label scope grants.
  • mcp (host): mod_label on an account and on a record, undo, and refusals.
  • protocol (MCP crate): the label plan and where the label goes.
  • commands (CLI): mod label, undo, and its refusals.
  • Locally: just lex, clippy, svelte-check, layers and dialogs, and just docs. The full coverage gate and e2e (the console's "Label someone") are left to CI.
  • After merging main (the Review dialog, label definitions, the atproto crate from its registry): the workspace builds without warnings; moderation, mcp, rbac, group_tokens, oauth_scope, the MCP crate's tests and the CLI's commands pass; svelte-check, layers, dialogs and just lex pass. e2e's moderation flow (label, remove, put back, take down) and just shots --check are left to CI.

Shortcomings

  • Groups made before this keep rpc:fyi.opensocial.applyLabel and space:*?collection=fyi.opensocial.label in their permissions record. Neither grants label now, so their admins and moderators cannot label until their roles are saved again. Old fyi.opensocial.label records stay in their spaces, unread.
  • com.atproto.label.label is still a strawman. If the proposal renames it or changes its fields, this follows.
  • The Review dialog looks as it did to a role that held both label and takedown, so the moderating guide's pictures should not change; just shots --check says.
Approved

This replaces the fyi.opensocial label methods and record with com.atproto.label.label records written as the group. It folds takedown into label, grants it as space:*?collection=com.atproto.label.label, and has the host keep the queue's label and negate events when a label is written or deleted. I found nothing that must change.

What I checked in moderation.rs, token_writes.rs, member_writes.rs, group_tokens.rs, oauth_scope.rs and rbac.rs:

  • Subject check: beside runs from guard for every token write. It compares the whole space URI, so a label can't point into another space. Account DIDs are allowed.
  • Ordering: labels_going reads a deleted label before the write, and labelled records the event only after the write succeeds. A delete of a label that doesn't exist writes no event.
  • Label authority: may_space checks the label rule (labels_in) ahead of the members-space rule, so a label in the members space isn't blocked by the member rules. member_writes now skips labels in its membership handling.
  • Scopes: labels reach tokens and narrowed scopes only when the space grant doesn't already cover them, and labels_in limits chosen-people spaces to their members.

One thing is worth knowing before merge. Any holder of label can now write !hide and !takedown, where takedown used to be a separate grant. The pull states this, and it follows from the proposal having no per-value grant. The loss of labelling for existing groups until their roles are saved again is also already listed under Shortcomings.

I did not read these files:

  • the tests (protocol.rs, tests/*.rs)
  • the docs
  • lib.rs, lexicons.rs and mcp.rs in the host
  • the opensocial CLI crate and the group-host MCP crate
  • the lexicon JSON files and the harness
  • the web files

I relied on the pull's description for these.

Approved

Nothing has changed in the label code since my approval at 929f840. The new commits are a formatting fix to the lexicon check, a merge of main (which brings in the guides pull), and "The guides give labels and takedowns one permission, label". That last commit changes the guides so they match the folded label action. I didn't read the merged-in guides pull itself, and the guide edits themselves I took from the commit message and haven't read. My earlier points still stand: any holder of label can now write !takedown, and existing groups can't label until their roles are saved again. The pull already lists the second of these under Shortcomings.

Approved

Since my approval at 0634e86, the only new content is a merge of main. The merge also changed the console, so that its label and unlabel actions write and delete com.atproto.label.label records as the group, and its Take down uses label. I read those console changes: ReviewDialog.svelte, moderation/+page.server.ts and +page.svelte, ModerationQueue.svelte, actions.ts, activity.ts and moderation.ts. I did not read the rest of the merged-in main, which isn't this pull's change.

  • Label and unlabel: a label goes in the subject's own space, or the members space for an account, matching the host's beside rule. Unlabel lists the group's own records for that subject, keeps those with the same val, and deletes them in one write. It refuses with "It no longer wears …" when there are none.
  • Helpers: asGroup, applyAsGroup and membersOf all exist in web/src/lib/asGroup.ts.
  • takedown: it is removed from the console's can and from KNOWN, and every use is updated.

One small thing, which doesn't block: unlabel reads at most 100 records for the subject (limit: 100). A subject with more than 100 label records would miss some. That is unlikely in practice.

My earlier points still stand: any holder of label can write !takedown, and existing groups can't label until their roles are saved again. The pull already lists the second under Shortcomings.

Merged as 2860c5f