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

Groups moderate what is theirs: reports, labels, and the queue between

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

What changes

Reports, labels and a queue. A group moderates what is in its spaces itself (moderation.rs, docs/design/moderation.md).

  • com.atproto.moderation.createReport takes a report from anyone, member or not, of a record in one of a group's spaces here, into that group's queue.
  • applyLabel and negateLabel write fyi.opensocial.label records beside what they label: a label on a record goes in that record's space, and a label on an account goes in the members space. label is the action a role needs; !hide and !takedown need takedown. A negation is a second record, so that a label was applied stays on record.
  • listSubjects, getSubjectHistory and resolveSubject keep the queue. Each subject is open, escalated or resolved, with its history in order. The queue is the host's working state, not something the group publishes.

The console's moderation page. /g/<handle>/moderation shows the queue to those with mod.read and offers the label form to those with label, and the group's page links to it.

Why

This is step 8's first part. Labels live beside what they label, so whoever may read a record may read its labels, and nobody else may. A label opens a subject nobody reported, and leaves a resolved one resolved: labelling is the moderators acting, not someone asking them to.

How it was checked

tests/moderation.rs:

  • reports from anyone;
  • labels written beside what they label;
  • each label held to the action it needs;
  • resolving, escalating and noting;
  • the queue listed by status, a page at a time.

These are the prototype's moderation.test.ts cases, in this host's terms. tests/serve.rs now asks for an unknown query and an unknown procedure. A new e2e flow labels a record from the moderation page. just cov is at 100% of lines and functions locally.

Shortcomings

  • The prototype's host-wide queue for what its sites module shared (templates and their likes) is not here, along with the sites module.
  • An account is labelled by its group, not reported to it.
Approved

This adds moderation. createReport takes reports from any signed-in account into the group's queue. applyLabel and negateLabel write fyi.opensocial.label records beside their subject, and !hide/!takedown need takedown. listSubjects, getSubjectHistory and resolveSubject keep the queue, and the console gets a moderation page. I read every changed file. I did not read tests/moderation.rs or the checks, and I did not read the lexicons beyond listing them.

The logic holds up. A label can only target a record in the group's own spaces, and the permission check runs before any write. Reports re-open a resolved subject while labels leave it resolved, as the docs say. The queue is cleaned up when an account is forgotten. The cursor ordering (updated_at DESC, subject) matches its predicate. The docs page and the design README are updated, as AGENTS.md asks.

Two small things, neither blocking:

  • create_report stores reason and the subject URI with no length bound. Anyone can write to the queue, so the host should cap them, for example to the createReport lexicon's limits.
  • LabelForm.svelte's doc comment says "and the rule it is under", but the form has no rule field.
Merged as 6825487