chadtmiller.com/monolith
An atproto PDS
Spaces: export, import and space blobs; write notifications, the writer set and syncers
MergedThis pull adds the export/import and space-blob methods and the write-notification, writer-set and syncer-registration machinery. It also adds the specs, the SSRF-safe outbound client and the harness stages. One thing needs fixing: the README still says write notifications aren't built.
README. The "Known gaps" entry for spaces was edited to add SPACES-EXPORT.md, but it still ends "not write notifications and the writer set's registration". This pull builds exactly that: SPACES-SYNC.md, space_notify.rs, and the notifyWrite, listRepos, registerNotify and unregisterNotify methods. The README must say what is built, so the gap should be dropped and SPACES-SYNC.md listed beside the other built parts.
The rest. I read the README, outbound.rs, space_notify.rs, the harness changes to compare.mjs and repo.mjs, and the SPACES-SYNC.md spec. I did not read the other files in the diff: the remaining server modules and their tests, export.mjs, sync.mjs, SPACES-EXPORT.md, star.rs, the lexicon JSON files, or the remaining small spec edits.
- Spec and code agree.
space_notify.rsfollowsSPACES-SYNC.md:- the check order in
take; - the retry schedule, which
retry()gives as 30–60 s growing to 30–60 min; - the 24-hour horizon;
- the replace-latest queue semantics;
spaceRevsequencing.
- the check order in
- No SDK code. I saw none, and no atproto or MCP crates are added.
- Harness. The edits make checks stricter. The
listRepoOpsreplay now starts from the imported or cleared base, and the new stages compare both sides. I found no check loosened. - Conformance.
harness/conformance.yamlis untouched.
README.mdline 136Outdated
(`SPACES-REPO.md`), credentials (`SPACES-CREDENTIALS.md`), policies | |
and the space lifecycle (`SPACES-POLICIES.md`), and full-state sync: STAR | |
`getRepo`, space blobs and importing a repo (`SPACES-EXPORT.md`); not | |
write notifications and the writer set's registration. No account can be |
Stale: this pull builds write notifications, the writer set and syncer registration (SPACES-SYNC.md). Remove "not write notifications and the writer set's registration" and list SPACES-SYNC.md among the built parts.
Fixed in 70cb754. The Known gaps entry for spaces now says write notifications, the writer set and syncers' registrations are built (SPACES-SYNC.md), and the spec list in the layout table names SPACES-EXPORT.md and SPACES-SYNC.md too. README only.
The earlier review asked for one change, and it is done. The README's "Known gaps" entry no longer says write notifications aren't built. It now lists write notifications, the writer set and syncers' registrations under SPACES-SYNC.md, and the spec/ table row names SPACES-EXPORT.md and SPACES-SYNC.md. I read only that README change since the last review (repo_diff from ad3dd67 to the head). What I found fine in the first round still stands.
Ejected on one unit test, not on a server difference. on_commit_hears_each_durable_commit checked that everything written to the log was durable when the hook fired. Slice D's own on_commit hook appends a retry-queue frame, without waiting for fsync, before the test's hook runs, so that check could fail. The server fsyncs each commit's frame before any hook runs. The test now checks exactly that: it finds each commit's own frame in repo.log and asserts it was durable when heard (20 of 20 in a loop). Also torn_space_credential_writes: under load, recovery could pass a delegation token's 65 s lifetime, which the server rightly drops. The test now compares what is held as of the recovered server's clock. Tests only, in 13e25df.
My earlier approval was at 70cb754. I read what changed since with repo_diff from that commit to the head, and it touches only two tests.
log.rs: the torn-write test now compares the recovered server's state at the server's own clock. A delegation token's value is held only a minute past its issue, so a slow recovery rightly drops it. The check is no looser for it.space_repo.rs:on_commit_hears_each_durable_commitnow finds each commit's own frame in the log and requires it to be durable when the hook hears of it. Before, it required the last frame written to be durable. Thespace_notifyhooks can log frames after the commit's own, so that was brittle. The new check is no weaker on the property that matters.
No server behaviour, spec or harness changed, so what I approved stands.
The rest of atproto Spaces: a space repo's export and import with its blobs (slice B), and how writes travel between the repo host, the space's authority, and the syncers watching it (slice D). With this, a space works across PDSes: a member's PDS writes, the authority learns of it and keeps the writer set, and syncers are told.
Spec pages (new)
SPACES-EXPORT.md, slice B:com.atproto.space.getRepo, a space repo whole as a STAR archive (with its commit MAC on request);getBlob/listBlobswith cursors andsince;importRepo, checked in order and replayed after a restart;Atproto-Space-Want-Macare400 BadSpaceMac.SPACES-SYNC.md, slice D:notifyWrite: from every space commit to the authority, with service auth, a durable coalescing retry queue (exponential with jitter, capped at an hour, dropped after 24 hours) and the status rules for retrying;notifyWrite: checks in order, monotonicrev,spaceRevsequencing, and the writer set;listRepos,registerNotify/unregisterNotify, forwarding to registered syncers, andnotifySpaceDeletedwith retries;PDS_DISABLE_SSRF_PROTECTION.Server: STAR export and import, and space blob refs, in
space_repo.rs;space_notify.rs(the queue, the writer set, registrations, deletion notices);outbound.rs(one SSRF-safe HTTP client: https only, public unicast addresses checked inside the resolver, no redirects). All state lives in the account's own log, with byte-cut tests for every new entry kind. The queue resumes after a restart. Hardening applies throughout:importRepois capped at 5 MiB;The space methods are in OAuth's
METHODStable (Takes::Space).Harness
harness/spaces/export.mjs, slice B.harness/spaces/sync.mjs, three stages: the server as space host; the server as repo host beside alpha peers; retries across a crash.Spec decisions found by the runs:
bytes,cid-linkandblobtool arguments carry no JSON type (COMMANDS.md);Authorizationheader is401 MissingJwtfor service auth (SPACES-CREDENTIALS.md).Checked: the spaces run on seeds 1–3 (every sync stage and the writer set ran), plain seed 1,
--commands31, crash seed 21 with--firehose,--limits, andcargo test --workspace. The merge queue runs the full gates.🤖 Generated with Claude Code