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

Space URIs are at:space/, as the spaces alpha of November 24 names them

Merged chadtmiller.com asked to merge into main from chadtmiller.com/group-host:spaces/at-space-uri
.changeset/at-space-uri.mdnew+7−0
@@ -0,0 +1,7 @@
---
default: minor
---
# Space URIs are at:space/
The host names a space `at:space/<authority>/<type>/<skey>`, and a record in one `at:space/<authority>/<type>/<skey>/<repo>/<collection>/<rkey>`, as the spaces alpha of November 24, 2026 does (@atproto/space 0.0.0-spaces-alpha-20261124235736). They were `at://<authority>/space/…`. Every method, the console, `atgrp` and the MCP tools answer and take the new form; a space or a record in one named the old way is refused, as anything that is not one is. The host renames the spaces its database keeps, and the moderation subjects and events that name them, when it starts.
crates/atgrp/src/lib.rs+19−7
@@ -14,6 +14,7 @@
use anyhow::{Context, Result, anyhow, bail};
use atproto::jose;
use atproto::keys::{Curve, Keypair};
use atproto::space::{SPACE_URI_PREFIX, SpaceRef};
use group_host_mcp::{Plan, Tool};
use serde_json::{Value, json};
use std::collections::HashMap;
@@ -115,7 +116,7 @@ account
with that code, finish moving it
A group or person is a handle or a DID; a subject an account's DID or a
record's at:// URI. A flag is a field of what the command writes or asks,
record's URI. A flag is a field of what the command writes or asks,
in kebab case; a list is comma-separated, and anything more than text or
a number is JSON. Every command but group create, seed, move and
delete, account import and admin is also the MCP tool <group>_<action>
@@ -348,9 +349,20 @@ impl Client {
}
}
/// The URI of `authority`'s space of `kind` at `skey`.
fn space_uri(authority: &str, kind: &str, skey: &str) -> String {
let (authority, kind, skey) = (authority.into(), kind.into(), skey.into());
SpaceRef {
authority,
kind,
skey,
}
.to_string()
}
/// `person`'s inbox, where a group writes an invite for them.
fn inbox_of(person: &str) -> String {
format!("at://{person}/space/org.atgrp.inbox/self")
space_uri(person, "org.atgrp.inbox", "self")
}
/// Now, as atproto writes a datetime.
@@ -785,7 +797,7 @@ async fn carry_out(me: &Client, host: &Host, group: &str, plan: Plan) -> Result<
rkey,
record,
} => {
let uri = format!("at://{group}/space/{space}/self");
let uri = space_uri(group, &space, "self");
let session = GroupSession::start(me, host, group, &uri).await?;
let mut body = json!({"repo": group, "space": uri, "collection": collection});
if let Some(key) = &rkey {
@@ -835,7 +847,7 @@ async fn carry_out(me: &Client, host: &Host, group: &str, plan: Plan) -> Result<
rkey,
records,
} => {
let uri = format!("at://{group}/space/{space}/self");
let uri = space_uri(group, &space, "self");
let mut done = Vec::new();
for (collection, fields) in records {
// The record as it is, as the space's records are listed.
@@ -878,7 +890,7 @@ async fn carry_out(me: &Client, host: &Host, group: &str, plan: Plan) -> Result<
Plan::Space { kind, skey, policy } => {
// A key of its own, so that the token is for the space it makes.
let skey = skey.unwrap_or_else(|| atproto::tid::TidClock::new(0).next());
let uri = format!("at://{group}/space/{kind}/{skey}");
let uri = space_uri(group, &kind, &skey);
let session = GroupSession::start(me, host, group, &uri).await?;
let body = json!({"spaceType": kind, "skey": skey, "policy": policy});
session.call("com.atproto.space.createSpace", &body).await
@@ -1025,7 +1037,7 @@ fn shown(said: &Value, members: &Value) -> String {
/// A group's members space.
fn members_of(group: &str) -> String {
format!("at://{group}/space/{NS}.members/self")
space_uri(group, &format!("{NS}.members"), "self")
}
/// Deletes `group`, for good: what went.
@@ -1170,7 +1182,7 @@ async fn start_import(
let bring = &internal("importAccountSpace");
for space in &spaces {
let at = [("space", space.as_str()), ("repo", did)];
let governs = space.starts_with(&format!("at://{did}/"));
let governs = space.starts_with(&format!("{SPACE_URI_PREFIX}{did}/"));
if governs {
let meta = theirs
.own_bytes("com.atproto.space.exportSpaceMeta", &at[..1])
crates/atgrp/tests/commands.rs+3−3
@@ -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.inbox/self/{did}/org.atgrp.invite/"
"at:space/{bob_did}/org.atgrp.inbox/self/{did}/org.atgrp.invite/"
)),
"{uri}"
);
@@ -390,7 +390,7 @@ async fn writes_the_groups_rules_roles_and_profile() {
ok(&alice, &["mod", "label", group, bob, "spam", "--undo"]).await;
let said_so = fails(&alice, &["mod", "label", group, bob, "spam", "--undo"]).await;
assert!(said_so.contains("no spam label"), "{said_so}");
let elsewhere = format!("at://did:plc:other/space/x.y/z/{bob}/a.b.c/d");
let elsewhere = format!("at:space/did:plc:other/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.
@@ -472,7 +472,7 @@ async fn writes_the_groups_rules_roles_and_profile() {
];
let made = said(&ok(&alice, &make).await);
let space = made["space"].as_str().unwrap();
let calendars = format!("at://{did}/space/com.example.calendar/");
let calendars = format!("at:space/{did}/com.example.calendar/");
assert!(space.starts_with(&calendars), "{made}");
let kept = h.host.store.space(space).unwrap().unwrap();
assert_eq!(kept.policy["grants"][0]["role"], "member");
crates/group-host/src/account_move.rs+2−1
@@ -32,6 +32,7 @@ use crate::store::Store;
use crate::time::now_millis;
use crate::xrpc::XrpcError;
use anyhow::Result;
use atproto::space::SPACE_URI_PREFIX;
use atproto::{Curve, Keypair, did, jose};
use axum::Json;
use axum::extract::{Query, State};
@@ -407,7 +408,7 @@ impl Host {
let (mut records, mut files) = (0, 0);
for space in &spaces {
let at = [("space", space.as_str()), ("repo", did.as_str())];
let governs = space.starts_with(&format!("at://{did}/"));
let governs = space.starts_with(&format!("{SPACE_URI_PREFIX}{did}/"));
if governs {
let meta = self
.moving_bytes(mover, m, "com.atproto.space.exportSpaceMeta", &at[..1])
crates/group-host/src/authority.rs+1−1
@@ -334,7 +334,7 @@ impl Host {
skey: &str,
policy: &Json,
) -> Result<String, XrpcError> {
let uri = format!("at://{authority}/space/{kind}/{skey}");
let uri = crate::group::space_uri(authority, kind, skey);
SpaceRef::parse(&uri).map_err(|e| invalid(e.to_string()))?;
let account = self.store.account(authority).map_err(XrpcError::internal)?;
if !account.is_some_and(|a| a.did == authority) {
crates/group-host/src/group.rs+14−2
@@ -13,17 +13,29 @@ use crate::time::{iso, now_millis};
use crate::xrpc::XrpcError;
use anyhow::Result;
use atproto::drisl;
use atproto::space::SpaceRef;
use axum::http::StatusCode;
use serde_json::{Value, json};
/// The URI of `authority`'s space of `kind` at `skey`.
pub fn space_uri(authority: &str, kind: &str, skey: &str) -> String {
let (authority, kind, skey) = (authority.into(), kind.into(), skey.into());
SpaceRef {
authority,
kind,
skey,
}
.to_string()
}
/// A group's meta space, at `did`.
pub fn meta_space(did: &str) -> String {
format!("at://{did}/space/{NS}.meta/self")
space_uri(did, &format!("{NS}.meta"), "self")
}
/// A group's members space, at `did`.
pub fn members_space(did: &str) -> String {
format!("at://{did}/space/{NS}.members/self")
space_uri(did, &format!("{NS}.members"), "self")
}
/// A DID as a record key: a record key holds no `%`, so a did:web's
crates/group-host/src/group_api.rs+2−1
@@ -17,6 +17,7 @@ use crate::scopes::covers;
use crate::space_api::{service_caller, unauthorized};
use crate::token_writes::missing;
use crate::xrpc::XrpcError;
use atproto::space::SpaceRef;
use axum::Json;
use axum::extract::{Query, State};
use axum::http::{HeaderMap, StatusCode, header};
@@ -383,7 +384,7 @@ pub async fn get_group(
if kept.policy["unlisted"] == true && !readable && !own.contains(&uri) {
continue;
}
let kind = uri.split('/').nth(4).unwrap_or_default();
let kind = SpaceRef::parse(&uri).expect("a space the host keeps").kind;
let mut space = json!({"uri": uri, "spaceType": kind});
if readable {
space["policy"] = kept.policy;
crates/group-host/src/group_invites.rs+1−1
@@ -43,7 +43,7 @@ fn bad(error: &'static str, message: impl Into<String>) -> XrpcError {
/// Someone's inbox: where groups' invites to them arrive.
pub fn inbox_of(did: &str) -> String {
format!("at://{did}/space/{NS}.inbox/self")
crate::group::space_uri(did, &format!("{NS}.inbox"), "self")
}
/// Where `invite` is: the group's record in the invitee's inbox.
crates/group-host/src/import_space.rs+1−2
@@ -254,8 +254,7 @@ impl Host {
if commit.repo != did {
return Err(refused("NotSpaceOwner", "that repo isn't the account's"));
}
let space = SpaceRef::parse(&commit.space);
let space = space.map_err(|e| refused("InvalidArchive", e.to_string()))?;
let space = SpaceRef::parse(&commit.space).expect("a space the archive's reader checked");
let uri = commit.space;
let governed = self.store.space(&uri).map_err(XrpcError::internal)?;
if space.authority == did && governed.is_none() {
crates/group-host/src/mcp.rs+4−3
@@ -21,6 +21,7 @@
use crate::Host;
use crate::api::{Params, invalid, param};
use crate::group::space_uri;
use crate::group_api::{group_of, signed_in};
use crate::oauth_resource::Acting;
use crate::oauth_store::Grant;
@@ -819,7 +820,7 @@ impl Host {
rkey,
record,
} => {
let uri = format!("at://{}/space/{space}/self", who.group);
let uri = space_uri(&who.group, &space, "self");
let written = self.record_as(who, &uri, collection, rkey, record);
written.await.map_err(said)
}
@@ -841,7 +842,7 @@ impl Host {
rkey,
records,
} => {
let uri = format!("at://{}/space/{space}/self", who.group);
let uri = space_uri(&who.group, &space, "self");
let mut done = Vec::new();
for (collection, fields) in records {
let kept = self.group_record(&who.group, &uri, &collection, &rkey);
@@ -889,7 +890,7 @@ impl Host {
skey: &str,
policy: Value,
) -> Result<Value, XrpcError> {
let uri = format!("at://{}/space/{kind}/{skey}", who.group);
let uri = space_uri(&who.group, kind, skey);
let (acting, _) = self.session_for(who, &uri)?;
let body = json!({"spaceType": kind, "skey": skey, "policy": policy});
let made = self.create_space_as(&acting, &body).await?;
crates/group-host/src/moderation.rs+14−22
crates/group-host/src/store.rs+49−1
crates/group-host/tests/common/oauth.rs+3−3
crates/group-host/tests/account_move.rs+4−4
crates/group-host/tests/app_passwords.rs+1−1
crates/group-host/tests/authority.rs+8−13
crates/group-host/tests/group_config.rs+1−1
crates/group-host/tests/group_spaces.rs+5−4
crates/group-host/tests/group_tokens.rs+41−7
crates/group-host/tests/import.rs+2−2
crates/group-host/tests/index.rs+4−3
crates/group-host/tests/interop.rs+1−1
crates/group-host/tests/invites.rs+1−1
crates/group-host/tests/mcp.rs+8−4
crates/group-host/tests/migration.rs+3−3
crates/group-host/tests/moderation.rs+20−7
crates/group-host/tests/oauth_scope.rs+1−1
crates/group-host/tests/provision.rs+4−12
crates/group-host/tests/rbac.rs+1−1
crates/group-host/tests/spaces.rs+73−8
crates/group-host/tests/tokens.rs+4−4
crates/group-host-mcp/src/lib.rs+13−13
crates/group-host-mcp/tests/protocol.rs+8−4
crates/group-host-mcp/Cargo.toml+1−0
docs/design/groups.md+2−2
docs/design/membership.md+2−2
docs/design/moderation.md+3−2
docs/design/spaces.md+7−5
docs/guides/moderating.md+2−2
docs/reference/cli.md+3−2
docs/reference/mcp.md+3−3
docs/development.md+16−0
harness/e2e/flows.spec.mjs+1−0
harness/look/seeds/moderating.mjs+1−1
harness/look/seeds/reports.mjs+2−2
harness/alpha.sh+3−3
lexicons/org/atgrp/internal/listGroupTokens.json+1−1
web/patches/@atproto+lex-schema+0.0.0-spaces-alpha-20261124235736.patchnew+14−0
web/patches/apply.shnew+25−0
web/src/lib/asGroup.ts+1−1
web/src/lib/moderation.ts+8−6
web/src/routes/g/[handle]/moderation/+page.server.ts+7−6
web/src/routes/g/[handle]/+page.server.ts+1−1
web/package-lock.json+174−135
web/package.json+13−12
Cargo.lock+3−2
Cargo.toml+1−1