chadtmiller.com/group-host
atmosphere group host
Moderation takes typed subjects and events, and reports come to the group
MergedThis pull moves moderation onto the proposal's typed subjects and events, adds fyi.opensocial.createReport, makes resolveSubject set a status, and updates the console, MCP tools, docs and tests to match. I read the Rust core (moderation.rs, store.rs, group.rs, lib.rs) closely and found nothing that must change. I did not read the other 21 changed files (lexicon JSON, tests, docs, web, harness, MCP). I relied on the passing lexicons, docs, web and e2e checks and on the PR's own description for those.
testcheck fails. The 100% line gate reportsmoderation.rslines 262 and 396 as never run. That is the account branch ofsubject_refand theretaininpresent. A test that queues, reads or resolves an account subject would cover the first. Check the second with--show-missing-lines, since your AGENTS.md says a?or closure line can be miscounted. The gate enforces this, so it is not a reason to withhold approval.- Migration edge case, minor. A migrated
notetakes the status of the last earlier status event. A report that reopened a resolved subject wrote no status event, so a note after such a report is stored asresolvedwhile the subject wasopen. This only affects old history. It is worth a line in the shortcomings or a fix. createReportdoes not check the citedrule. It only checks that the URI is in the meta space. This is not a problem, but a missing record is accepted.
Round 2. The new commit answers the coverage failure I noted. A test now reads the queue for an account subject, which covers the account branch of subject_ref. present now unwraps an object instead of branching, so it has no uncovered line. Both callers (moderation.rs:432 and :436) pass json! objects, so the expect can't fire. The CI checks for this head were still queued or running when I looked, so I haven't seen the coverage gate pass. I read only this incremental diff; I read the rest of the pull last round.
Two small items from last round are still open. Neither blocks the merge:
- A migrated
noteafter a reopening report is stored asresolvedwhile the subject wasopen. Add a line to the shortcomings or fix it. createReportaccepts aruleURI in the meta space even if no such record exists.
Round 3. The only new commit is a merge of main into the branch, which resolved conflicts in tests/moderation.rs, harness/lexicons.mjs and lexicons/fyi/opensocial/defs.json. I did not re-read the merge resolution line by line. I relied on the checks instead: for this head, test (including the coverage gate), e2e, lexicons, docs, web and check (fmt and clippy) all pass. That answers my earlier coverage concern.
Two small items from earlier rounds are still open, and neither blocks the merge:
- A migrated
noteafter a reopening report is stored asresolvedwhile the subject wasopen. Add a line to the shortcomings or fix it. createReportaccepts aruleURI in the meta space even if no such record exists.
What changes
Subjects are typed. Wherever a moderation subject is sent or answered, it is
fyi.opensocial.defs#accountSubject(adid) or#recordSubject(auri, optionally acid), in place of a bare URI.subjectViewis the proposal's:subject,status(the newsubjectStatus),createdAt,updatedAtandreportCount, all required;lastReportedAtis gone.Events are typed.
getSubjectHistoryanswersmoderationEvents (id,createdAt,createdBy,event), each event one ofreportEvent(reasonType,reason,rule),statusEvent(status,note),labelEvent(uri,val,deleted) orejectEvent, in place ofeventView. It pages (limit,cursor), oldest first, takes acidto narrow a record to one version, and no longer answers the subject's view. A subject nothing has happened to has no events. A subject that is no DID or record in the group isInvalidSubject.Resolving sets a status.
resolveSubjecttakesstatus(resolvedorescalated) and an optional note of 2,000 graphemes / 20,000 bytes, in place ofaction(resolve,escalate,note). Setting the current status adds a note. It answers the subject's view. A migration turns keptresolve,escalateandnoteevents into status events, a note taking the status before it.The queue lists one status.
listSubjects'statusisopenunless asked (it listed everything before), withlimitfrom 1.Reports come to the group.
fyi.opensocial.createReportreplacescom.atproto.moderation.createReport. It names thegroup, a typed subject, areasonType, and optionally areasonandrule, and answersid(a string now) andcreatedAt. An account can now be reported if it is a member. The reporter must be able to read the subject's space: a record's own, or the members space for an account. A reporter who cannot is refused. The group's labeler now limits what is taken:reasonTypes,subjectTypesandsubjectCollections, where present. A new group's labeler takes accounts and records. Refusals areGroupNotFound,InvalidSubject, orInvalidRequestfor a reason it does not take or aruleoutside the meta space.The labeler is the proposal's.
policiesrefers tofyi.opensocial.defs#labelerPolicies(moved there), andsubjectCollectionsis an array of NSIDs.The console and the tools follow. The moderation page shows one status at a time and reads typed events. A note goes with Resolve or Escalate. MCP tool schemas now carry a lexicon's
enum.Why
The host follows the opensocial proposal's moderation methods and shapes, so that apps written to it work here, under
fyi.opensocial.*. Where the proposal says nothing, the host keeps its behaviour: labels throughapplyLabelandnegateLabel, the roles'mod.readandmod.resolve, and reopening a resolved subject on a report. The proposal's closedenumstatuses and itsidfields are let throughharness/lexicons.mjsby name. The retyped and removed fields are in itsretractedset, and the upstreamcreateReportis retired.How it was checked
tests/moderation.rswas rewritten for the new shapes. It covers reports from readers and refusals of non-readers, non-members, other groups' spaces, unhosted spaces, unknown kinds and bad rules. It covers the labeler's limits, label and negation events, status events with notes, history paging andcidnarrowing, the queue by status, an ejection's event, and the migration of kept events. The members, groups, lexicons and MCP tests pass.cargo fmt, clippy,node harness/lexicons.mjs,node harness/docs.mjsand the console'snpm run checkpass. CI is left the coverage gate and e2e. The e2e flow now escalates with a note, then reads the escalated queue.Shortcomings
fyi.opensocial.labelrecords written byapplyLabel, and taken back bynegateLabel, not label records written through CRUD as the proposal expects. A negation is answered as alabelEventwithdeleted: trueand the negating record's URI.ejectEventis empty, as the proposal's. The host still storesejectMember's reason but does not answer it.uri, whichlabelEventrequires.createdByis always given; the host does not withhold it.🤖 Generated with Claude Code