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

The host follows the Atmosphere Groups spec as released

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:spec/sync
.changeset/spec-sync.mdnew+15−0
@@ -0,0 +1,15 @@
---
default: major
---
# The host follows the Atmosphere Groups spec as released
The host now follows the Atmosphere Groups spec (tangled.org/atmospheregroups.org/spec) as it was released. Groups made before this change keep their old records, which the host no longer reads.
- A group's profile is now two records in its meta space: `org.atgrp.about` (display name, description, avatar and `website`, which was `url`) and `org.atgrp.config` (its join policy). The banner is gone. A group's rules and labeler moved to its members space. Its declaration is empty.
- Records and spaces were renamed: `acceptance` is now `confirmation`, and the `invites` inbox space is now `inbox`. In roles and space policies, `scopes` is now `permissions`, and in roles, `assignable` is now `canAssign`. A role's ID is lowercase letters and `-`, at least three of them.
- The permission sets are now `authManageBasic`, `authManageMembers`, `authModerate` and `authManageAdmin`. `authModerate` no longer admits, invites or assigns roles.
- Moderation methods are now under `org.atgrp.mod.*`: `submitReport`, `querySubjects`, `querySubjectHistory` and `updateSubject`. A subject is either open or resolved. Moderators tag subjects instead of escalating them, and can reopen a resolved one. Report reasons are `org.atgrp.mod.defs#reason*` tokens. Appeals go through the new `mod.submitAppeal`, and an account reads its own history with `mod.querySelfHistory`.
- An app signed in as the group no longer passes `group` to the group methods.
- `requestJoin` now returns the caller's existing request or membership, where before it refused them.
- `atgrp`: `role set` and `role grant` now take `--permissions` and `--can-assign`, `profile set` takes `--website`, `mod list` filters by tags and sorts, and `mod update` replaces `mod resolve`.
.claude/skills/ui/SKILL.md+8−9
@@ -7,9 +7,9 @@ description: Build or change the console's pages (web/) so they look right, not
The e2e flows say a page works; they do not say it looks right, and
they only ever see the states their flow passes through. A page nobody
looked at shows it: a group with no banner gets a great empty block, an
empty list is two loose sentences, the button that leaves the group is
the heaviest thing on the card. So look, at every state, before pushing.
looked at shows it: an empty list is two loose sentences, the button
that leaves the group is the heaviest thing on the card. So look, at
every state, before pushing.
AGENTS.md has the mechanics (tokens, component layers, inline text).
This is how the pages should read, and how to check they do.
@@ -38,11 +38,11 @@ just look /g/lanterns.groups.test --as alice --out target/look/before --name gro
Each world starts with alice, bob, carol, dan, erin, frank, harbor and
maximilianaquinces (the longest handle the PDS takes), and Riders
(riders.groups.test), alice's, with nothing else in it: no banner, no
(riders.groups.test), alice's, with nothing else in it: no website, no
picture, no words, no one else. That is the bare state. A seed puts in
the rest, once per kept world:
- `full`: Lantern Hikers (lanterns.groups.test), alice's, with a banner,
- `full`: Lantern Hikers (lanterns.groups.test), alice's, with
a picture, words, two rules and a moderator role; bob, carol
(moderator), dan, erin and frank in it, past a page of members; harbor
asking to join; an invite waiting for maximilianaquinces.
@@ -53,7 +53,7 @@ the rest, once per kept world:
"Phone", having posted as it, and taken a post down.
- `reports`, after `full`: Lantern Hikers' moderation queue, with dan
reported twice (once citing a rule), a post of frank's reported, erin
escalated and bob resolved with a note.
tagged `escalated` with a note, and bob resolved with a note.
A state none of them makes is a seed of your own: a module that writes
it, `--seed path/to/it.mjs` (the top of `harness/look/look.mjs` says
@@ -117,7 +117,7 @@ For every list, page or component you touch, each that applies:
is asking, maximilianaquinces is invited).
- **Empty** (Riders), **one**, **many** (Lantern Hikers, past a page),
and **long text** (`--seed long`).
- **No picture**: a group with no banner or avatar, as Riders is.
- **No picture**: a group with no avatar, as Riders is.
- **Phone** and **dark**: the defaults draw desktop light and phone dark.
- **Open**: every dialog and menu it has (`--click`), on a phone as well.
- **After**: what a form says once sent, and once refused.
@@ -307,8 +307,7 @@ As it should read:
**Pictures.** `Avatar` is given the name of whom it draws: with no
picture, it draws their initial on a hue their name gives them, never a
blank disc. A group with no banner shows no banner block: its picture,
name and nav sit at the top of its card.
blank disc.
**People.** A person is their avatar and handle, by `MemberRow` (a row), `Person` (in a line of text) or the
header's menu, never a bare DID where a handle is known.
crates/atgrp/src/lib.rs+57−39
@@ -42,8 +42,10 @@ group
its address again
group delete <group> delete a group, its spaces and its identity, for good
profile
profile set <group> [--display-name <name>] [--join-policy <policy>] [--description <words>] …
change the group's profile in what is given; \"\" takes a field away
profile set <group> [--display-name <name>] [--description <words>] [--website <url>]
[--avatar <blob json>] [--join-policy open|approval|invite]
change the group's about record in what is given, \"\" taking a
field away; --join-policy changes its config
rule
rule set <group> --title <title> --text <words> [--order <n>] [--rule <key>]
write a rule: the one --rule names, or a new one
@@ -55,13 +57,13 @@ label
label delete <group> <label>
stop defining one of the group's own labels
role
role set <group> <role> --display-name <name> [--description <words>] [--default] [--bot]
[--scopes <scope,…>] [--assignable <role,…>]
role set <group> <role> [--display-name <name>] [--description <words>] [--default] [--bot]
[--permissions <permission,…>] [--can-assign <role,…>]
write a role, with what it may do across the group and the
roles its holders may give (* for every role)
role delete <group> <role>
delete a role nobody holds
role grant <group> <role> [--scopes <scope,…>] [--assignable <role,…>] [--undo]
role grant <group> <role> [--permissions <permission,…>] [--can-assign <role,…>] [--undo]
add to what a role may do, or with --undo take it away
member
member list <group> [--q <text>] [--limit <n>] [--cursor <cursor>]
@@ -86,12 +88,15 @@ space
space records <group> <space> [--collection <nsid>] [--field <path> --equals <value>] …
the records in one of the group's spaces
mod
mod list <group> [--status open|escalated|resolved] [--limit <n>] [--cursor <cursor>]
the moderation queue
mod history <group> <subject> [--cid <cid>] [--limit <n>] [--cursor <cursor>]
what was done about a subject
mod resolve <group> <subject> --status resolved|escalated [--note <words>] [--cid <cid>]
resolve or escalate a subject
mod list <group> [--status open|resolved] [--tags <tag,…>] [--sort oldest|newest|updated]
[--limit <n>] [--cursor <cursor>]
the moderation queue: every subject, or those of a status or
with any of the tags, oldest first by default
mod history <group> <subject> [--cid <cid>] [--sort newest|oldest] [--limit <n>] [--cursor <cursor>]
what was done about a subject, newest first by default
mod update <group> <subject> [--status open|resolved] [--note <words>] [--add-tags <tag,…>]
[--remove-tags <tag,…>] [--cid <cid>]
resolve or reopen a subject, tag it, or add a note
mod label <group> <subject> <val> [--cid <cid>] [--undo]
label a subject, or with --undo take the label back
admin
@@ -345,7 +350,7 @@ impl Client {
/// `person`'s inbox, where a group writes an invite for them.
fn inbox_of(person: &str) -> String {
format!("at://{person}/space/org.atgrp.invites/self")
format!("at://{person}/space/org.atgrp.inbox/self")
}
/// Now, as atproto writes a datetime.
@@ -736,12 +741,21 @@ async fn command(
})
}
/// A query's parameters from JSON, each value as text: none of the
/// queries a command asks takes a list.
/// A query's parameters from JSON, each value as text, a list's each
/// item a parameter of its own.
fn query_of(input: &Value) -> Vec<(String, String)> {
let fields = input.as_object().into_iter().flatten();
let text = |v: &Value| v.as_str().map_or_else(|| v.to_string(), String::from);
fields.map(|(k, v)| (k.clone(), text(v))).collect()
let mut out = Vec::new();
for (k, v) in input.as_object().into_iter().flatten() {
let items = match v {
Value::Array(items) => items.iter().collect(),
one => vec![one],
};
for item in items {
let text = item.as_str().map_or_else(|| item.to_string(), String::from);
out.push((k.clone(), text));
}
}
out
}
/// Carries out `plan` as `me`, in `group`: a method asked with a service
@@ -818,20 +832,24 @@ async fn carry_out(me: &Client, host: &Host, group: &str, plan: Plan) -> Result<
}
Plan::Edit {
space,
collection,
rkey,
fields,
records,
} => {
// The record as it is, as the space's records are listed.
let uri = format!("at://{group}/space/{space}/self");
let record = format!("{uri}/{group}/{collection}/{rkey}");
let asked = [("group", group), ("space", &uri), ("uri", &record)];
let listed = me
.query(host, &internal("listSpaceRecords"), &asked)
.await?;
let kept = listed["records"][0]["value"].clone();
let write = group_host_mcp::edited(&kept, space, collection, rkey, fields);
Box::pin(carry_out(me, host, group, write)).await
let mut done = Vec::new();
for (collection, fields) in records {
// The record as it is, as the space's records are listed.
let record = format!("{uri}/{group}/{collection}/{rkey}");
let asked = [("group", group), ("space", &uri), ("uri", &record)];
let listed = me
.query(host, &internal("listSpaceRecords"), &asked)
.await?;
let kept = listed["records"][0]["value"].clone();
let write =
group_host_mcp::edited(&kept, space.clone(), collection, rkey.clone(), fields);
done.push(Box::pin(carry_out(me, host, group, write)).await?);
}
Ok(json!({ "written": done }))
}
Plan::Label {
subject,
@@ -841,8 +859,8 @@ async fn carry_out(me: &Client, host: &Host, group: &str, plan: Plan) -> Result<
} => label(me, host, group, &subject, cid.as_deref(), &val, undo).await,
Plan::Grant {
role,
scopes,
assignable,
permissions,
can_assign,
undo,
} => {
// The role's record as it is, as the space's records are listed.
@@ -853,7 +871,7 @@ async fn carry_out(me: &Client, host: &Host, group: &str, plan: Plan) -> Result<
.query(host, &internal("listSpaceRecords"), &asked)
.await?;
let kept = &listed["records"][0]["value"];
let write = group_host_mcp::regrant(kept, &role, &scopes, &assignable, undo);
let write = group_host_mcp::regrant(kept, &role, &permissions, &can_assign, undo);
let write = write.map_err(anyhow::Error::msg)?;
Box::pin(carry_out(me, host, group, write)).await
}
@@ -1227,8 +1245,8 @@ const RULES: [(&str, &str); 2] = [
];
/// What a seeded group's moderator may do: moderate it, as the group's
/// moderation permission set has it (members, invites, join requests,
/// the moderation queue), and label in any of its spaces.
/// moderation permission set has it (labels, ejections, the moderation
/// queue), and label in any of its spaces.
const MODERATES: [&str; 2] = [
"include:org.atgrp.authModerate",
"space:*?collection=com.atproto.label.record",
@@ -1241,8 +1259,7 @@ async fn moderator(me: &Client, host: &Host, group: &str) -> Result<()> {
"$type": m("role"),
"displayName": "Moderator",
"description": "Keeps the group to its rules.",
"scopes": MODERATES,
"createdAt": now_iso(),
"permissions": MODERATES,
});
let members = members_of(group);
let session = GroupSession::start(me, host, group, &members).await?;
@@ -1263,12 +1280,13 @@ async fn seed(me: &Client, host: &Host, handle: &str, invite: &[String]) -> Resu
let made = me.call(host, &internal("createGroup"), &body).await?;
let group = text(&made["did"]).to_string();
let mut out = format!("group {handle} {group}\n");
// Its rules are its own records, in its meta space, written as it.
let meta = text(&made["meta"]).to_string();
let session = GroupSession::start(me, host, &group, &meta).await?;
// Its rules are its own records, in its members space, written as it.
let members = text(&made["members"]).to_string();
let session = GroupSession::start(me, host, &group, &members).await?;
for (title, words) in RULES {
let rule = json!({"$type": m("rule"), "title": title, "text": words});
let body = json!({"repo": group, "space": meta, "collection": m("rule"), "record": rule});
let body =
json!({"repo": group, "space": members, "collection": m("rule"), "record": rule});
let written = session.call("com.atproto.space.createRecord", &body);
written.await?;
out += &format!("rule {title}\n");
crates/atgrp/tests/commands.rs+130−47
@@ -15,10 +15,10 @@ use std::collections::HashMap;
use std::sync::Arc;
use tempfile::TempDir;
/// Two scopes a role may be granted: reading the moderation queue, and
/// inviting.
const MOD_READ: &str = "rpc:org.atgrp.listModSubjects?aud=*";
const INVITE: &str = "space:org.atgrp.invites?authority=*&skey=self&collection=org.atgrp.invite&action=read_self&action=create&action=update&action=delete";
/// Two permissions a role may be granted: reading the moderation queue,
/// and inviting.
const MOD_READ: &str = "rpc:org.atgrp.mod.querySubjects?aud=*";
const INVITE: &str = "space:org.atgrp.inbox?authority=*&skey=self&collection=org.atgrp.invite&action=read_self&action=create&action=update&action=delete";
/// A host at a free port, on the reference directory, resolving
/// handles at the reference PDS.
@@ -138,7 +138,7 @@ async fn starts_shows_and_runs_a_group() {
let bob_did = &net().accounts[1].did;
assert!(
uri.starts_with(&format!(
"at://{bob_did}/space/org.atgrp.invites/self/{did}/org.atgrp.invite/"
"at://{bob_did}/space/org.atgrp.inbox/self/{did}/org.atgrp.invite/"
)),
"{uri}"
);
@@ -216,7 +216,8 @@ async fn writes_the_groups_rules_roles_and_profile() {
h.host.group_record(&did, space, &collection, rkey).unwrap()
};
// A rule, new at a key of the clock's; changed at it; deleted.
// A rule, in the members space, new at a key of the clock's; changed at
// it; deleted.
let made = ok(
&alice,
&["rule", "set", group, "--title", "Be kind", "--text", ""],
@@ -224,7 +225,8 @@ async fn writes_the_groups_rules_roles_and_profile() {
.await;
let uri = said(&made)["uri"].as_str().unwrap().to_string();
let rkey = uri.rsplit('/').next().unwrap().to_string();
assert_eq!(kept(&meta, "rule", &rkey).unwrap()["title"], "Be kind");
assert_eq!(kept(&members, "rule", &rkey).unwrap()["title"], "Be kind");
assert_eq!(kept(&meta, "rule", &rkey), None);
let again = [
"rule",
"set",
@@ -239,13 +241,13 @@ async fn writes_the_groups_rules_roles_and_profile() {
"1",
];
ok(&alice, &again).await;
let rule = kept(&meta, "rule", &rkey).unwrap();
let rule = kept(&members, "rule", &rkey).unwrap();
assert_eq!(
(rule["title"].clone(), rule["order"].clone()),
(json!("Be very kind"), json!(1))
);
ok(&alice, &["rule", "delete", group, &rkey]).await;
assert_eq!(kept(&meta, "rule", &rkey), None);
assert_eq!(kept(&members, "rule", &rkey), None);
// A role, a bot's, with what it may do and give; added to, and back.
let role = [
@@ -257,9 +259,9 @@ async fn writes_the_groups_rules_roles_and_profile() {
"Ride leader",
"--bot",
"--no-default",
"--scopes",
"--permissions",
INVITE,
"--assignable",
"--can-assign",
"member",
];
ok(&alice, &role).await;
@@ -269,33 +271,49 @@ async fn writes_the_groups_rules_roles_and_profile() {
(json!(true), json!(false))
);
assert_eq!(
(leader()["scopes"].clone(), leader()["assignable"].clone()),
(
leader()["permissions"].clone(),
leader()["canAssign"].clone()
),
(json!([INVITE]), json!(["member"]))
);
// Each added to what it had, once; one taken away, the rest kept.
for scope in [MOD_READ, INVITE] {
for permission in [MOD_READ, INVITE] {
ok(
&alice,
&["role", "grant", group, "leader", "--scopes", scope],
&[
"role",
"grant",
group,
"leader",
"--permissions",
permission,
],
)
.await;
}
assert_eq!(leader()["scopes"], json!([INVITE, MOD_READ]));
assert_eq!(leader()["permissions"], json!([INVITE, MOD_READ]));
let undo = [
"role", "grant", group, "leader", "--scopes", MOD_READ, "--undo",
"role",
"grant",
group,
"leader",
"--permissions",
MOD_READ,
"--undo",
];
ok(&alice, &undo).await;
assert_eq!(leader()["scopes"], json!([INVITE]));
assert_eq!(leader()["permissions"], json!([INVITE]));
// With nothing named, all of both; the rest of the role as it was.
ok(&alice, &["role", "grant", group, "leader", "--undo"]).await;
assert_eq!(
(leader().get("scopes"), leader().get("assignable")),
(leader().get("permissions"), leader().get("canAssign")),
(None, None)
);
assert_eq!(leader()["displayName"], "Ride leader");
let said_so = fails(
&alice,
&["role", "grant", group, "ghost", "--scopes", INVITE],
&["role", "grant", group, "ghost", "--permissions", INVITE],
)
.await;
assert!(said_so.contains("no such role: ghost"), "{said_so}");
@@ -303,32 +321,53 @@ async fn writes_the_groups_rules_roles_and_profile() {
assert!(said_so.contains("RoleInUse"), "{said_so}");
ok(&alice, &["role", "delete", group, "leader"]).await;
assert_eq!(kept(&members, "role", "leader"), None);
// A role with no name to show: its ID stands for it.
ok(&alice, &["role", "set", group, "helpers"]).await;
assert_eq!(
kept(&members, "role", "helpers")
.unwrap()
.get("displayName"),
None
);
// The profile, changed in what is given; given empty, taken away.
let before = kept(&meta, "profile", "self").unwrap();
// The about record, changed in what is given; given empty, taken
// away; the config left alone unless the join policy is given.
let config = kept(&meta, "config", "self").unwrap();
let profile = [
"profile",
"set",
group,
"--display-name",
"Riders United",
"--url",
"--website",
"https://riders.example",
];
ok(&alice, &profile).await;
let written = kept(&meta, "profile", "self").unwrap();
let written = kept(&meta, "about", "self").unwrap();
assert_eq!(written["displayName"], "Riders United");
assert_eq!(written["url"], "https://riders.example");
assert_eq!(written["joinPolicy"], before["joinPolicy"]);
assert_eq!(written["website"], "https://riders.example");
assert_eq!(kept(&meta, "config", "self").unwrap(), config);
let profile = ["profile", "set", group, "--description", "Bikes"];
ok(&alice, &profile).await;
let written = kept(&meta, "profile", "self").unwrap();
assert_eq!(written["url"], "https://riders.example");
let written = kept(&meta, "about", "self").unwrap();
assert_eq!(written["website"], "https://riders.example");
assert_eq!(written["description"], "Bikes");
ok(&alice, &["profile", "set", group, "--url", ""]).await;
let written = kept(&meta, "profile", "self").unwrap();
assert_eq!(written.get("url"), None);
ok(&alice, &["profile", "set", group, "--website", ""]).await;
let written = kept(&meta, "about", "self").unwrap();
assert_eq!(written.get("website"), None);
assert_eq!(written["description"], "Bikes");
ok(
&alice,
&["profile", "set", group, "--join-policy", "approval"],
)
.await;
assert_eq!(
kept(&meta, "config", "self").unwrap()["joinPolicy"],
"approval"
);
assert_eq!(kept(&meta, "about", "self").unwrap(), written);
let said_so = fails(&alice, &["profile", "set", group]).await;
assert!(said_so.contains("nothing to change"), "{said_so}");
// The queue; a label on an account, and taken back, in its history.
let queue = said(&ok(&alice, &["mod", "list", group, "--status", "open"]).await);
@@ -354,27 +393,71 @@ async fn writes_the_groups_rules_roles_and_profile() {
let elsewhere = format!("at://did:plc:other/space/x.y/z/{bob}/a.b.c/d");
let said_so = fails(&alice, &["mod", "label", group, &elsewhere, "spam"]).await;
assert!(said_so.contains("not an account's DID"), "{said_so}");
// Its history, newest first unless asked otherwise, each event named.
let labelled = |history: &Value| -> Vec<Value> {
let events = history["events"].as_array().unwrap().iter();
let labels = events.filter(|e| !e["event"]["deleted"].is_null());
labels.map(|e| e["event"]["deleted"].clone()).collect()
};
let history = said(&ok(&alice, &["mod", "history", group, bob]).await);
let deleted: Vec<&Value> = history["events"]
.as_array()
.unwrap()
.iter()
.map(|e| &e["event"]["deleted"])
.collect();
assert_eq!(deleted, [false, true], "{history}");
let resolve = [
assert_eq!(labelled(&history), [json!(true), json!(false)], "{history}");
assert!(history["events"][0]["eventId"].is_string(), "{history}");
let oldest = ["mod", "history", group, bob, "--sort", "oldest"];
let history = said(&ok(&alice, &oldest).await);
assert_eq!(labelled(&history), [json!(false), json!(true)], "{history}");
// Resolved, tagged and noted; found by status and tag; reopened with
// a tag taken off.
let update = [
"mod",
"resolve",
"update",
group,
bob,
"--status",
"resolved",
"--note",
"Spoke to them",
"--add-tags",
"urgent,spam",
];
let updated = said(&ok(&alice, &update).await);
assert_eq!(updated["status"], "resolved", "{updated}");
assert_eq!(updated["subject"], bob.as_str(), "{updated}");
assert_eq!(updated["tags"], json!(["spam", "urgent"]), "{updated}");
let subjects = async |words: &[&str]| {
let mut asked = vec!["mod", "list", group];
asked.extend(words);
said(&ok(&alice, &asked).await)["subjects"].clone()
};
assert_eq!(subjects(&["--status", "open"]).await, json!([]));
let all = subjects(&[]).await;
assert_eq!(all[0]["subject"], bob.as_str(), "{all}");
let filtered = [
"--status",
"resolved",
"--tags",
"urgent,other",
"--sort",
"updated",
];
let resolved = said(&ok(&alice, &resolve).await);
assert_eq!(resolved["status"], "resolved", "{resolved}");
assert_eq!(resolved["subject"], bob.as_str(), "{resolved}");
let found = subjects(&filtered).await;
assert_eq!(found[0]["subject"], bob.as_str(), "{found}");
assert_eq!(subjects(&["--tags", "other"]).await, json!([]));
assert_eq!(subjects(&["--sort", "newest"]).await, all);
let reopen = [
"mod",
"update",
group,
bob,
"--status",
"open",
"--remove-tags",
"spam",
];
let reopened = said(&ok(&alice, &reopen).await);
assert_eq!(reopened["status"], "open", "{reopened}");
assert_eq!(reopened["tags"], json!(["urgent"]), "{reopened}");
let tagged = subjects(&["--status", "open", "--tags", "urgent"]).await;
assert_eq!(tagged[0]["subject"], bob.as_str(), "{tagged}");
// A space, made as the group under the policy given, at a key of the
// clock's.
@@ -468,12 +551,13 @@ async fn seeds_a_group_to_try_things_on() {
assert!(said.contains("rule Be kind\n"), "{said}");
assert!(said.contains("role moderator\n"), "{said}");
assert!(said.ends_with(&format!("invited {bob}\n")), "{said}");
// Its rules are its own records, written as the group, in its meta.
// Its rules are its own records, written as the group, in its members
// space.
let trial = h.host.store.account("trial.groups.test").unwrap().unwrap();
let meta = group_host::group::meta_space(&trial.did);
let members = group_host::group::members_space(&trial.did);
let rules = h
.host
.group_records(&trial.did, &meta, "org.atgrp.rule")
.group_records(&trial.did, &members, "org.atgrp.rule")
.unwrap();
let titles: Vec<&str> = rules
.iter()
@@ -481,14 +565,13 @@ async fn seeds_a_group_to_try_things_on() {
.collect();
assert_eq!(titles, ["Be kind", "Stay on topic"]);
// Its moderator's role, which its admins give, as they give any.
let members = group_host::group::members_space(&trial.did);
let moderator = h
.host
.group_record(&trial.did, &members, "org.atgrp.role", "moderator")
.unwrap()
.unwrap();
assert_eq!(
moderator["scopes"],
moderator["permissions"],
serde_json::json!([
"include:org.atgrp.authModerate",
"space:*?collection=com.atproto.label.record"
crates/group-host/src/actors.rs+1−1
@@ -72,7 +72,7 @@ impl Host {
let roles = self.roles(group, viewer).map_err(XrpcError::internal)?;
let meta = meta_space(group);
if self.reads_space(&meta, &roles)? {
let profile = self.group_record(group, &meta, &format!("{NS}.profile"), "self");
let profile = self.group_record(group, &meta, &format!("{NS}.about"), "self");
let profile = profile.map_err(XrpcError::internal)?.unwrap_or_default();
if let Some(name) = profile.get("displayName") {
view["displayName"] = name.clone();
crates/group-host/src/authorization.rs+2−2
@@ -82,7 +82,7 @@ impl Host {
}
/// A group as the approval page shows it to `member`: what of its
/// profile they may read, their roles, and what the app would get.
/// about record they may read, their roles, and what the app would get.
pub(crate) fn offered(&self, group: &str, member: &str, requested: &[String]) -> Answer {
let handle = group_of(self, group)?;
let roles = self.roles(group, member).map_err(XrpcError::internal)?;
@@ -104,7 +104,7 @@ impl Host {
});
let meta = meta_space(group);
if self.reads_space(&meta, &roles)? {
let profile = self.group_record(group, &meta, &format!("{NS}.profile"), "self");
let profile = self.group_record(group, &meta, &format!("{NS}.about"), "self");
let profile = profile.map_err(XrpcError::internal)?.unwrap_or_default();
if let Some(name) = profile.get("displayName") {
view["displayName"] = name.clone();
crates/group-host/src/blobs.rs+2−2
@@ -7,7 +7,7 @@
//! An image of an account's is also served for a page to draw, at
//! `/img/{did}/{cid}`, to whoever may see a record that holds it: anyone,
//! for a record in its public repo; for one in a space, whoever signed in
//! to the console that space lets read, a group's listed profile being for
//! to the console that space lets read, a group's listed about record being for
//! anyone signed in; but none a takedown of the group's takes out of the
//! space (`takedown.rs`), to anyone. Served as an image and nothing more,
//! and kept for good, as a CID names its bytes.
@@ -154,7 +154,7 @@ pub(crate) const IMAGES: [&str; 5] = [
"image/avif",
];
/// The kinds of image a group's avatar and banner may be.
/// The kinds of image a group's avatar may be.
pub(crate) const PROFILE_IMAGES: [&str; 3] = ["image/png", "image/jpeg", "image/webp"];
impl Store {
crates/group-host/src/group.rs+39−39
@@ -1,9 +1,9 @@
//! Groups: an account here with two spaces of its own, `meta` (its
//! profile, rules and labeler, for whoever it lets read them) and
//! `members` (its roles, each with what it may do, its memberships and
//! the index of its spaces, for its members). Everything a group is lives
//! in those records, written by the group; who may read or write each
//! space is its policy, against the reader's roles.
//! Groups: an account here with two spaces of its own, `meta` (its about
//! record and config, for whoever it lets read them) and `members` (its
//! roles, each with what it may do, its memberships, rules and labeler,
//! and the index of its spaces, for its members). Everything a group is
//! lives in those records, written by the group; who may read or write
//! each space is its policy, against the reader's roles.
use crate::Host;
use crate::rbac::{EVERY_ROLE, Grant, NS, POLICY, grants, roles_of};
@@ -48,19 +48,29 @@ pub fn rkey_did(rkey: &str) -> String {
format!("did:web:{host}%3A{port}{path}")
}
/// The report reasons the labeler every group starts with takes: each of
/// those the proposal names.
pub const REASONS: [&str; 6] = [
"org.atgrp.mod.defs#reasonSpam",
"org.atgrp.mod.defs#reasonViolation",
"org.atgrp.mod.defs#reasonMisleading",
"org.atgrp.mod.defs#reasonNsfw",
"org.atgrp.mod.defs#reasonRude",
"org.atgrp.mod.defs#reasonOther",
];
/// What the labeler every group starts with says: the labels the host
/// acts on, and reports about accounts and records, of every reason,
/// appeals among them.
/// acts on, and reports about accounts and records, of every reason.
fn labeler() -> Value {
json!({
"$type": format!("{NS}.labeler"),
"policies": {"labelValues": ["!hide", "!takedown"]},
"reasonTypes": ["spam", "violation", "misleading", "nsfw", "rude", "other", "appeal"],
"reasonTypes": REASONS,
"subjectTypes": ["account", "record"],
})
}
/// How a group lets people in, as its profile says it (`defs#joinPolicy`):
/// How a group lets people in, as its config says it (`joinPolicy`):
/// `open`, `approval` or `invite`; `approval` unless it says.
pub fn join_policy(asked: Option<&str>) -> Result<&'static str, XrpcError> {
match asked {
@@ -106,13 +116,12 @@ fn put(collection: &str, rkey: &str, value: Value) -> Write {
}
/// A new group's policy for its meta space, readable by anyone if
/// `public`: its members read it, and admins read it and write its
/// profile and rules as the group.
/// `public`: its members read it. Its admins write its records by their
/// role's permissions across the group.
fn meta_policy(public: bool) -> Value {
let write = format!("space:{NS}.meta?collection={NS}.profile&collection={NS}.rule");
let mut policy = json!({"$type": POLICY, "grants": [
{"role": "member", "read": true},
{"role": "admin", "read": true, "scopes": [write]},
{"role": "admin", "read": true},
]});
if public {
policy["publicRead"] = json!(true);
@@ -121,7 +130,7 @@ fn meta_policy(public: bool) -> Value {
}
/// A new group's policy for its members space: its members read it, and
/// write there, so that their acceptances sync.
/// write there, so that their confirmations sync.
fn members_policy() -> Value {
json!({"$type": POLICY, "grants": [{"role": "member", "read": true, "write": true}]})
}
@@ -215,27 +224,23 @@ impl Host {
let members = self.create_space(&did, &format!("{NS}.members"), "self", &members_policy)?;
let at = iso(now_millis());
let c = |name: &str| format!("{NS}.{name}");
let mut profile = json!({
"$type": c("profile"),
"displayName": new.display_name,
"joinPolicy": join,
"createdAt": at,
});
let mut about = json!({"$type": c("about"), "displayName": new.display_name});
if let Some(d) = &new.description {
profile["description"] = json!(d);
about["description"] = json!(d);
}
let config = json!({"$type": c("config"), "joinPolicy": join});
let meta_writes = [
put(&c("profile"), "self", profile),
put(&c("labeler"), "self", labeler()),
put(&c("about"), "self", about),
put(&c("config"), "self", config),
];
self.space_write(&did, &meta, &meta_writes).await?;
// Its founders run it: administering it, labeling, making,
// changing and ending spaces, writing any record as it, in its
// repo and in its spaces (so that they may give any scope a
// repo and in its spaces (so that they may give any permission a
// space's policy may hold), and giving any role; everyone else is
// a member.
let administers = format!("include:{NS}.authManageGroup");
let scopes = [
let administers = format!("include:{NS}.authManageAdmin");
let permissions = [
administers.as_str(),
"space:*?collection=com.atproto.label.record",
"space:*?manage=update",
@@ -247,13 +252,14 @@ impl Host {
put(
&c("role"),
"admin",
json!({"$type": c("role"), "displayName": "Admin", "description": "Runs the group.", "scopes": scopes, "assignable": [EVERY_ROLE], "createdAt": at}),
json!({"$type": c("role"), "displayName": "Admin", "description": "Runs the group.", "permissions": permissions, "canAssign": [EVERY_ROLE]}),
),
put(
&c("role"),
"member",
json!({"$type": c("role"), "displayName": "Member", "default": true, "createdAt": at}),
json!({"$type": c("role"), "displayName": "Member", "default": true}),
),
put(&c("labeler"), "self", labeler()),
];
for steward in stewards {
members_writes.push(put(
@@ -263,29 +269,23 @@ impl Host {
));
}
self.space_write(&did, &members, &members_writes).await?;
// Each policy published, and both spaces in the group's index.
// Each policy published; neither space is in the group's index.
self.publish_policy(&did, &meta, &meta_policy).await?;
self.publish_policy(&did, &members, &members_policy).await?;
// Listed only if there is a face to show: a meta anyone may read.
if *public {
let declaration = json!({"$type": c("declaration"), "meta": meta, "createdAt": at});
self.write(&did, &[put(&c("declaration"), "self", declaration)])?;
self.declare(&did, true).await?;
}
Ok(Made { did, meta, members })
}
/// Lists the group, by a declaration in its public repo pointing at
/// its meta space, or not.
/// Lists the group, by its declaration in its public repo, or not.
pub async fn declare(&self, group: &str, listed: bool) -> Result<(), XrpcError> {
let collection = format!("{NS}.declaration");
let declared = self.store.record(group, &collection, "self");
let declared = declared.map_err(XrpcError::internal)?.is_some();
let write = match (listed, declared) {
(true, false) => put(
&collection,
"self",
json!({"$type": collection, "meta": meta_space(group), "createdAt": iso(now_millis())}),
),
(true, false) => put(&collection, "self", json!({ "$type": collection })),
(false, true) => Write::Delete {
collection,
rkey: "self".into(),
crates/group-host/src/group_api.rs+64−48
@@ -5,7 +5,7 @@
//! and the method: their own PDS signs it for them.
use crate::Host;
use crate::api::{Params, page, param};
use crate::api::{Params, invalid, page, param};
use crate::group::{Made, NewGroup, members_space, meta_space, rkey_did};
use crate::member_writes::{expanded, held};
use crate::oauth_resource::Refusal;
@@ -67,39 +67,43 @@ pub(crate) async fn signed_in(
}
/// Who calls `lxm`, one of the host's own methods, sent with HTTP `verb`,
/// to do `action` in `group`: a member holding it, by their service auth
/// or the console's cookie; or an app signed in as the group (a DPoP
/// token), whose scope holds `rpc:lxm` and whose member holds `action` at
/// this call, as a session's writes are checked. The answer is the member.
/// to do `action` in a group: a member holding it, by their service auth
/// or the console's cookie, in `group`, which they must name; or an app
/// signed in as the group (a DPoP token), whose scope holds `rpc:lxm` and
/// whose member holds `action` at this call, as a session's writes are
/// checked, in the session's group, which `group`, if named, must be.
/// The answer is the group and the member.
pub(crate) async fn doing(
host: &Host,
headers: &HeaderMap,
verb: &str,
lxm: &str,
group: &str,
group: Option<&str>,
action: &str,
) -> Result<String, Refusal> {
) -> Result<(String, String), Refusal> {
let scheme = headers
.get(header::AUTHORIZATION)
.and_then(|v| v.to_str().ok())
.and_then(|a| a.split_once(' '));
let me = if scheme.is_some_and(|(s, _)| s.eq_ignore_ascii_case("DPoP")) {
let (group, me) = if scheme.is_some_and(|(s, _)| s.eq_ignore_ascii_case("DPoP")) {
let acting = host.acting(headers, verb, &format!("/xrpc/{lxm}"))?;
if acting.grant.group != group {
if group.is_some_and(|g| g != acting.grant.group) {
return Err(forbidden("a session for another group").into());
}
if !acting.permissions.calls(lxm, |aud| for_host(host, aud)) {
return Err(missing(format!("rpc:{lxm}")).into());
}
acting.grant.member
(acting.grant.group, acting.grant.member)
} else {
signed_in(host, headers, lxm).await?
let me = signed_in(host, headers, lxm).await?;
let group = group.ok_or_else(|| invalid("group is required"))?;
(group.to_string(), me)
};
group_of(host, group)?;
if !host.may_do(group, &me, action)? {
group_of(host, &group)?;
if !host.may_do(&group, &me, action)? {
return Err(forbidden(format!("missing {action}")).into());
}
Ok(me)
Ok((group, me))
}
fn forbidden(message: impl Into<String>) -> XrpcError {
@@ -159,25 +163,23 @@ fn cid_of(blob: &Value) -> Option<&str> {
blob["ref"]["$link"].as_str()
}
/// Puts in `view` what a group's profile shows of it.
fn show_profile(view: &mut Value, profile: &Value) {
for key in ["displayName", "description", "joinPolicy", "url"] {
if let Some(v) = profile.get(key) {
/// Puts in `view` what a group's about record shows of it.
fn show_about(view: &mut Value, about: &Value) {
for key in ["displayName", "description", "website"] {
if let Some(v) = about.get(key) {
view[key] = v.clone();
}
}
for key in ["avatar", "banner"] {
if let Some(cid) = cid_of(&profile[key]) {
view[key] = json!(cid);
}
if let Some(cid) = cid_of(&about["avatar"]) {
view["avatar"] = json!(cid);
}
}
/// The group's rules in the order they are presented: by `order`, then as
/// written, then by key.
/// The group's rules, in its members space, in the order they are
/// presented: by `order`, then as written, then by key.
fn rules(host: &Host, group: &str) -> Result<Vec<Value>, XrpcError> {
let mut rules = host
.group_records(group, &meta_space(group), &format!("{NS}.rule"))
.group_records(group, &members_space(group), &format!("{NS}.rule"))
.map_err(XrpcError::internal)?;
rules.sort_by(|(ak, a), (bk, b)| {
let order = |r: &Value| r["order"].as_i64().unwrap_or(i64::MAX);
@@ -221,12 +223,14 @@ fn objects(field: &str, items: impl IntoIterator<Item = impl Into<String>>) -> V
.collect()
}
/// The scopes a role's editor offers that holders of `roles` hold enough
/// of to give, as a role write asks: each action's, then the group's
/// permission sets but `authManageGroup`, which is `group.configure`'s.
/// The permissions a role's editor offers that holders of `roles` hold
/// enough of to give, as a role write asks: each action's, then the
/// group's permission sets but `authManageAdmin`, which is
/// `group.configure`'s.
fn grantable(grants: &[Grant], roles: &[String], group: &str) -> Vec<Value> {
let held = held(grants, roles);
let sets = ["authManageProfile", "authModerate"].map(|s| format!("include:{NS}.{s}"));
let sets = ["authManageBasic", "authManageMembers", "authModerate"]
.map(|s| format!("include:{NS}.{s}"));
let offered = ACTIONS.iter().filter_map(|a| scope_of(a)).chain(sets);
offered
.filter(|s| expanded(s).iter().all(|x| covers(&held, x, group)))
@@ -241,9 +245,10 @@ fn signed_out(did: &str, handle: String) -> Value {
}
/// One group in full, as the caller may see it: what its meta space
/// holds for whoever may read it, the caller's own standing, and for a
/// member, how many are in it, its roles and spaces. To no one signed in,
/// only its DID and handle, whatever its meta space's policy says.
/// holds for whoever may read it, its rules and labels for whoever may
/// read its members space, the caller's own standing, and for a member,
/// how many are in it, its roles and spaces. To no one signed in, only its
/// DID and handle, whatever its meta space's policy says.
pub async fn get_group(
State(host): State<Arc<Host>>,
Query(p): Query<Params>,
@@ -280,11 +285,17 @@ pub async fn get_group(
let mut view = base(&host, group, &handle)?;
if reads_meta {
if let Some(profile) = record(&meta, "profile", "self")? {
show_profile(&mut view, &profile);
if let Some(about) = record(&meta, "about", "self")? {
show_about(&mut view, &about);
}
let config = record(&meta, "config", "self")?.unwrap_or_default();
if let Some(join) = config.get("joinPolicy") {
view["joinPolicy"] = join.clone();
}
}
if reads_members {
view["rules"] = json!(rules(&host, group)?);
let labeler = record(&meta, "labeler", "self")?.unwrap_or_default();
let labeler = record(&members, "labeler", "self")?.unwrap_or_default();
let labels = &labeler["policies"]["labelValueDefinitions"];
view["labels"] = if labels.is_array() {
labels.clone()
@@ -342,9 +353,9 @@ pub async fn get_group(
json!({
"role": g.role,
"actions": actions_for(&granted, one),
"assignable": objects("role", g.assignable.clone()),
"canAssign": objects("role", g.can_assign.clone()),
"repoCollections": objects("collection", repo_collections_for(&granted, one)),
"scopes": g.scopes.iter().map(|s| json!({
"permissions": g.permissions.iter().map(|s| json!({
"scope": s,
"actions": actions_of(std::slice::from_ref(s)),
})).collect::<Vec<_>>(),
@@ -352,19 +363,24 @@ pub async fn get_group(
})
.collect();
let mut spaces = Vec::new();
// Those in its index, in its order, then those left out of it to
// whoever reads them; each with its policy, to whoever reads the space.
let mut uris: Vec<String> = records("space")?
.into_iter()
.filter_map(|(_, e)| e["space"].as_str().map(String::from))
.collect();
let unlisted = host.store.spaces_of(group).map_err(XrpcError::internal)?;
let unlisted: Vec<String> = unlisted.into_iter().filter(|u| !uris.contains(u)).collect();
uris.extend(unlisted);
// The meta and members spaces, then those in its index, in its order,
// then those left out of it to whoever reads them; each with its
// policy, to whoever reads the space. `unlisted` means nothing in the
// meta and members spaces' policies.
let own = [meta.clone(), members.clone()];
let mut uris = own.to_vec();
let indexed = records("space")?.into_iter();
let indexed = indexed.filter_map(|(_, e)| e["space"].as_str().map(String::from));
let rest = host.store.spaces_of(group).map_err(XrpcError::internal)?;
for uri in indexed.chain(rest) {
if !uris.contains(&uri) {
uris.push(uri);
}
}
for uri in uris {
let kept = host.hosted_space(&uri)?;
let readable = reads(&uri)?;
if kept.policy["unlisted"] == true && !readable {
if kept.policy["unlisted"] == true && !readable && !own.contains(&uri) {
continue;
}
let kind = uri.split('/').nth(4).unwrap_or_default();
@@ -455,7 +471,7 @@ pub async fn list_members(
Ok(Json(out))
}
/// Whether `did` has written their own acceptance in the members space:
/// Whether `did` has written their own confirmation in the members space:
/// their repo there holds anything.
fn accepted(host: &Host, members: &str, did: &str) -> anyhow::Result<bool> {
let empty = atproto::space::LtHash::default().digest();
crates/group-host/src/group_config.rs+45−41
@@ -1,6 +1,7 @@
//! A group's face: its profile, its pictures and its rules, each a record
//! in its meta space that the group writes, and its declaration, in its
//! public repo, which lists it while anyone may read that space. An app
//! A group's face: its about record and its picture, and its config, each
//! a record in its meta space that the group writes; its rules and
//! labeler, in its members space; and its declaration, in its public
//! repo, which lists it while anyone may read its meta space. An app
//! writes them as the group, with a token a member approved
//! (`token_writes`); here is what each must be for the host to keep it,
//! beyond what its lexicon says, and who may configure the group.
@@ -20,7 +21,7 @@ use serde_json::{Value, json};
type Answer = Result<Json<Value>, XrpcError>;
/// The most bytes a profile's picture may be, as its lexicon has it.
/// The most bytes the group's picture may be, as its lexicon has it.
pub const IMAGE_AT_MOST: i64 = 2_000_000;
pub(crate) fn forbidden() -> XrpcError {
@@ -101,22 +102,24 @@ fn said(text: &Value) -> bool {
}
/// Refuses a website that is not on the web.
fn website(profile: &Value) -> Result<(), XrpcError> {
let url = profile
.get("url")
.map(|url| url.as_str().unwrap_or_default());
if url.is_some_and(|url| !url.starts_with("https://") && !url.starts_with("http://")) {
return Err(invalid("url is an http or https address"));
fn website(about: &Value) -> Result<(), XrpcError> {
let website = about
.get("website")
.map(|website| website.as_str().unwrap_or_default());
let web = |w: &str| w.starts_with("https://") || w.starts_with("http://");
if website.is_some_and(|w| !web(w)) {
return Err(invalid("website is an http or https address"));
}
Ok(())
}
impl Host {
/// Refuses a picture a profile names at `key`, unless it is one of the
/// group's own uploads, of a kind of image a page is given and no
/// larger than a profile takes, with the type and size the host kept.
fn picture(&self, group: &str, profile: &Value, key: &str) -> Result<(), XrpcError> {
let Some(asked) = profile.get(key) else {
/// Refuses a picture an about record names at `key`, unless it is one
/// of the group's own uploads, of a kind of image a page is given and
/// no larger than the record takes, with the type and size the host
/// kept.
fn picture(&self, group: &str, about: &Value, key: &str) -> Result<(), XrpcError> {
let Some(asked) = about.get(key) else {
return Ok(());
};
let not_one = || {
@@ -136,24 +139,21 @@ impl Host {
Ok(())
}
/// Refuses a profile the group should not keep: one with no name, a
/// join policy the host does not know, a website not on the web, or a
/// picture that is not one of its own.
fn profile(&self, group: &str, profile: &Value) -> Result<(), XrpcError> {
if !said(&profile["displayName"]) {
/// Refuses an about record the group should not keep: one with no
/// name, a website not on the web, or a picture that is not one of its
/// own.
fn about(&self, group: &str, about: &Value) -> Result<(), XrpcError> {
if !said(&about["displayName"]) {
return Err(invalid("displayName is required"));
}
if let Some(policy) = profile["joinPolicy"].as_str() {
join_policy(Some(policy))?;
}
website(profile)?;
self.picture(group, profile, "avatar")?;
self.picture(group, profile, "banner")
website(about)?;
self.picture(group, about, "avatar")
}
/// Refuses a write of the group's profile or one of its rules, in its
/// meta space, that the host should not keep: a profile as `profile`
/// has it, kept at `self` and never deleted; a rule with a title, at a
/// Refuses a write of the group's own records in its meta or members
/// space that the host should not keep: its about record (as `about`
/// has it), config (with a join policy the host knows) and labeler,
/// each kept at `self` and never deleted; a rule with a title, at a
/// TID, so that a label citing it keeps its URI however it changes.
pub(crate) fn face(&self, group: &str, write: &Write) -> Result<(), XrpcError> {
let (collection, rkey) = write.path();
@@ -161,14 +161,22 @@ impl Host {
Write::Create { value, .. } | Write::Update { value, .. } => Some(value),
Write::Delete { .. } => None,
};
if collection == format!("{NS}.profile") {
let name = collection
.strip_prefix(&format!("{NS}."))
.unwrap_or_default();
if ["about", "config", "labeler"].contains(&name) {
if rkey != "self" {
return Err(invalid(format!("{collection} is kept at self")));
}
let kept = || invalid("the group keeps its profile");
return self.profile(group, value.ok_or_else(kept)?);
let kept = || invalid(format!("the group keeps its {collection}"));
let value = value.ok_or_else(kept)?;
return match name {
"about" => self.about(group, value),
"config" => join_policy(value["joinPolicy"].as_str()).map(|_| ()),
_ => Ok(()),
};
}
if let Some(rule) = value.filter(|_| collection == format!("{NS}.rule")) {
if let Some(rule) = value.filter(|_| name == "rule") {
if !is_tid(rkey) {
return Err(invalid("a rule is kept at a TID"));
}
@@ -181,8 +189,8 @@ impl Host {
/// Refuses a write of the group's declaration, in its public repo,
/// that does not follow who may read its meta space: it is kept at
/// `self`, names that space, and is made only while anyone may read
/// it. Taking it away is always the group's to do.
/// `self`, and made only while anyone may read that space. Taking it
/// away is always the group's to do.
pub(crate) fn declaration(&self, group: &str, write: &Write) -> Result<(), XrpcError> {
let (collection, rkey) = write.path();
if collection != format!("{NS}.declaration") {
@@ -191,14 +199,10 @@ impl Host {
if rkey != "self" {
return Err(invalid(format!("{collection} is kept at self")));
}
let (Write::Create { value, .. } | Write::Update { value, .. }) = write else {
if matches!(write, Write::Delete { .. }) {
return Ok(());
};
let meta = meta_space(group);
if value["meta"] != meta.as_str() {
let named = format!("a group's declaration names its meta space, {meta}");
return Err(invalid(named));
}
let meta = meta_space(group);
let public = self.hosted_space(&meta)?.public_read;
if !public {
let hidden = "a group is declared only while anyone may read its meta space";
crates/group-host/src/group_invites.rs+5−5
crates/group-host/src/group_join.rs+37−24
crates/group-host/src/group_members.rs+16−1
crates/group-host/src/group_spaces.rs+27−18
crates/group-host/src/group_tokens.rs+13−10
crates/group-host/src/lexicons.rs+14−9
crates/group-host/src/lib.rs+16−8
crates/group-host/src/mcp.rs+19−10
crates/group-host/src/member_writes.rs+64−42
crates/group-host/src/moderation.rs+402−128
530 lines changed: not loaded until asked for.
crates/group-host/src/oauth_scope.rs+27−30
crates/group-host/src/rbac.rs+149−87
crates/group-host/src/store.rs+15−0
crates/group-host/src/takedown.rs+1−1
crates/group-host/src/token_writes.rs+17−23
crates/group-host/tests/common/groups.rs+5−4
crates/group-host/tests/common/members.rs+6−6
crates/group-host/tests/common/oauth.rs+4−6
crates/group-host/tests/actors.rs+3−3
crates/group-host/tests/app_passwords.rs+2−3
crates/group-host/tests/authorization.rs+16−15
crates/group-host/tests/blobs.rs+11−14
crates/group-host/tests/firehose.rs+3−3
crates/group-host/tests/group_config.rs+180−99
crates/group-host/tests/group_spaces.rs+49−15
crates/group-host/tests/group_tokens.rs+6−6
crates/group-host/tests/groups.rs+87−57
crates/group-host/tests/import.rs+5−5
crates/group-host/tests/interop.rs+2−2
crates/group-host/tests/invites.rs+12−4
crates/group-host/tests/joining.rs+32−5
crates/group-host/tests/lifecycle.rs+2−2
crates/group-host/tests/mcp.rs+33−14
crates/group-host/tests/members.rs+64−29
crates/group-host/tests/migration.rs+9−9
crates/group-host/tests/moderation.rs+592−343
935 lines changed: not loaded until asked for.
crates/group-host/tests/oauth_scope.rs+120−92
crates/group-host/tests/provision.rs+28−2
crates/group-host/tests/rbac.rs+83−35
crates/group-host/tests/spaces.rs+8−8
crates/group-host/tests/tokens.rs+80−38
crates/group-host-mcp/src/lib.rs+89−56
crates/group-host-mcp/tests/protocol.rs+123−54
docs/design/groups.md+75−64
docs/design/limits.md+3−2
docs/design/membership.md+79−60
docs/design/moderation.md+155−120
docs/design/moving.md+2−2
docs/design/README.md+6−6
docs/design/signing-in.md+61−46
docs/design/spaces.md+16−15
docs/guides/shots/apps-activity-dark.png+0−0
A binary file, not shown.
docs/guides/shots/apps-activity.png+0−0
A binary file, not shown.
docs/guides/shots/apps-made-dark.png+0−0
A binary file, not shown.
docs/guides/shots/apps-made.png+0−0
A binary file, not shown.
docs/guides/shots/apps-signed-in-dark.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-escalate-sent-dark.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-escalate-sent.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-escalate-sent.txt+6−1
docs/guides/shots/moderating-found-dark.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-found.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-label-dialog-dark.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-label-dialog.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-queue-dark.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-queue.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-queue.txt+5−5
docs/guides/shots/moderating-remove-dialog-dark.png+0−0
A binary file, not shown.
docs/guides/shots/moderating-remove-dialog.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-added-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-added.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-refused.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-removed-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-removed.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-tab-dark.png+0−0
A binary file, not shown.
docs/guides/shots/recovery-tab.png+0−0
A binary file, not shown.
docs/guides/shots/rules-change-role-dark.png+0−0
A binary file, not shown.
docs/guides/shots/rules-change-role.png+0−0
A binary file, not shown.
docs/guides/shots/rules-change-role.txt+15−11
docs/guides/shots/rules-create-role-dark.png+0−0
A binary file, not shown.
docs/guides/shots/rules-create-role.png+0−0
A binary file, not shown.
docs/guides/shots/rules-create-role.txt+9−6
docs/guides/shots/rules-delete-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-bob-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-bob.png+0−0
A binary file, not shown.
docs/guides/shots/starting-card-done-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-card-done.png+0−0
A binary file, not shown.
docs/guides/shots/starting-pictures-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-pictures.png+0−0
A binary file, not shown.
docs/guides/shots/starting-pictures.txt+1−5
docs/guides/shots/starting-taken.png+0−0
A binary file, not shown.
docs/guides/shots/starting-words-dark.png+0−0
A binary file, not shown.
docs/guides/shots/starting-words.png+0−0
A binary file, not shown.
docs/guides/shots/starting-words.txt+1−5
docs/guides/moderating.md+16−12
docs/guides/rules-and-roles.md+19−18
docs/guides/signing-in-as-a-group.md+3−3
docs/guides/starting-a-group.md+8−10
docs/reference/api.md+40−27
docs/reference/cli.md+6−6
docs/reference/mcp.md+11−11
docs/README.md+2−2
harness/e2e/flows.spec.mjs+44−16
harness/e2e/pages.mjs+1−1
harness/look/seeds/bookclub-pictures.mjs+18−25
harness/look/seeds/full.mjs+16−23
harness/look/seeds/long.mjs+12−1
harness/look/seeds/moderating.mjs+10−5
harness/look/seeds/nightshift-poster.mjs+1−1
harness/look/seeds/reports.mjs+22−19
harness/look/seeds/roles.mjs+6−6
harness/look/look.mjs+4−4
harness/lexicons.mjs+70−58
lexicons/org/atgrp/internal/defs.json+18−26
lexicons/org/atgrp/internal/provisionGroup.json+2−6
lexicons/org/atgrp/mod/defs.jsonnew+232−0
lexicons/org/atgrp/mod/querySelfHistory.jsonnew+72−0
lexicons/org/atgrp/getModSubjectHistory.json → lexicons/org/atgrp/mod/querySubjectHistory.jsonrenamed+13−13
lexicons/org/atgrp/listModSubjects.json → lexicons/org/atgrp/mod/querySubjects.jsonrenamed+23−16
lexicons/org/atgrp/mod/submitAppeal.jsonnew+65−0
lexicons/org/atgrp/createReport.json → lexicons/org/atgrp/mod/submitReport.jsonrenamed+9−26
lexicons/org/atgrp/resolveModSubject.json → lexicons/org/atgrp/mod/updateSubject.jsonrenamed+26−14
lexicons/org/atgrp/about.jsonnew+37−0
lexicons/org/atgrp/authManageGroup.json → lexicons/org/atgrp/authManageAdmin.jsonrenamed+16−36
lexicons/org/atgrp/authManageBasic.jsonnew+32−0
lexicons/org/atgrp/authManageMembers.jsonnew+42−0
lexicons/org/atgrp/authManageProfile.jsondeleted+0−31
lexicons/org/atgrp/authModerate.json+13−38
lexicons/org/atgrp/authParticipate.json+10−21
lexicons/org/atgrp/cancelJoinRequest.json+8−14
lexicons/org/atgrp/config.jsonnew+22−0
lexicons/org/atgrp/acceptance.json → lexicons/org/atgrp/confirmation.jsonrenamed+2−2
lexicons/org/atgrp/declaration.json+2−13
lexicons/org/atgrp/defs.json+2−179
lexicons/org/atgrp/denyJoinRequest.json+7−17
lexicons/org/atgrp/invites.json → lexicons/org/atgrp/inbox.jsonrenamed+3−5
lexicons/org/atgrp/invite.json+6−6
lexicons/org/atgrp/labeler.json+15−32
lexicons/org/atgrp/leaveGroup.json+9−15
lexicons/org/atgrp/listJoinRequests.json+5−5
lexicons/org/atgrp/members.json+7−4
lexicons/org/atgrp/membership.json+3−6
lexicons/org/atgrp/meta.json+6−6
lexicons/org/atgrp/policy.json+5−5
lexicons/org/atgrp/profile.jsondeleted+0−66
lexicons/org/atgrp/requestJoin.json+11−22
lexicons/org/atgrp/role.json+11−16
lexicons/org/atgrp/rule.json+2−6
lexicons/org/atgrp/space.json+2−5
web/messages/en.json+41−27
web/src/lib/molecules/RoleFields.svelte+28−30
web/src/lib/molecules/SubjectHistory.svelte+5−4
web/src/lib/organisms/GroupCard.svelte+3−7
web/src/lib/organisms/MemberList.svelte+6−6
web/src/lib/organisms/ModerationQueue.svelte+19−15
web/src/lib/organisms/ProfileForm.svelte+4−4
web/src/lib/organisms/ProfilePictures.svelte+33−71
web/src/lib/organisms/ReviewDialog.svelte+29−8
web/src/lib/organisms/RolesEditor.svelte+27−18
web/src/lib/server/settings.ts+62−59
web/src/lib/actions.ts+13−11
web/src/lib/activity.ts+4−2
web/src/lib/errors.ts+0−1
web/src/lib/moderation.ts+112−18
web/src/lib/permissions.ts+5−3
web/src/lib/reasons.ts+21−10
web/src/routes/g/[handle]/moderation/+page.server.ts+53−32
web/src/routes/g/[handle]/moderation/+page.svelte+14−16
web/src/routes/g/[handle]/settings/roles/+page.svelte+1−1
web/src/routes/g/[handle]/settings/+page.server.ts+1−1
web/src/routes/g/[handle]/settings/+page.svelte+3−7
web/src/routes/g/[handle]/+page.server.ts+1−1
web/src/routes/g/[handle]/+page.svelte+3−4
web/src/app.css+3−42
web/src/tokens.css+0−2
AGENTS.md+2−2
README.md+1−1