chadtmiller.com/monolith
An atproto PDS
0
0
Sessions, blobs, identity and what a relay reads, built in parallel
Merged Approved
This pull adds four slices to the PDS: sessions, blobs, identity and what a relay reads. It is about 9,700 lines across 59 files, and I did not read all of them.
Read in full:
Cargo.toml,Cargo.lockandcrates/pds-server/Cargo.tomlREADME.mdharness/compare.mjs,harness/lib/xrpc.mjs, and the changes toharness/checks/{accounts,commands,crashes,firehose}.mjsharness/conformance.yamlcrates/pds-server/src/sessions.rs, lines 300–560 (token checks, session start,refreshSession,deleteSession, app-password methods)
Not read:
- The rest of
sessions.rs(its tests). blobs.rs,federation.rs,identity.rs,plc.rsandlog.rs.- The other changes under
crates/(pds-cli,pds-lexicon,pds-repo, and thelib.rs,mcp.rs,repo.rs,server.rs,events.rs,sync.rschanges inpds-server). - The new harness checks
blobs.mjs,federation.mjs,identity.mjsandsessions.mjs, and the remainingharness/lib/changes. - Everything under
spec/, including the new pages and lexicons.
I make no claims about those. No runs were listed for this pull, so I relied on the author's report that just gates passes.
What I checked against .knotless/review.md:
- Crates: the only new dependencies are
hmacandhttp-body, plus tokio'stimefeature. None is an atproto or MCP crate. - README: it now says what is built and which gaps remain, not how it was built.
conformance.yaml: unchanged, so there are no new excuses to justify.- Harness: the firehose check is stricter, since it now compares each
#identityhandle in order.normalizenow treats a missing body as{}. This matches the new rule that tools and commands for methods with no output answer{}, and I don't see it loosening a check. - Session code: it matches the claims in the body. A refresh keeps the session's scope, so an app-password session stays one.
createAppPasswordneeds a full-access token. The refresh grace window and reuse of the successor are implemented as described.
Nothing I read needs changing. Whoever merges should know the large unread portion above.
Merged as 6aa625c
Four slices, built in parallel: sessions, blobs, identity, and what a relay reads. For each, one agent probed the reference and wrote the spec page and harness checks; a second built the server from the committed spec without reading reference source. The four were then merged here.
Sessions (
spec/SESSIONS.md)expandscope. Access tokens areat+jwt, last 2h and hold no state. Refresh tokens arerefresh+jwtwith ajti, last 90 days, and are tracked: a successor, a 2h grace window, reuse answering the same successor, and concurrent refreshes all succeeding.refreshSession,deleteSession, and app passwords (createAppPassword,listAppPasswords,revokeAppPassword). It specs what an app-password session may do, and that revoking a password ends its sessions.{}, and a command prints{}.""turns it into a full session, which survives revoking the password. That is privilege escalation. The server keeps such sessions app-password sessions, and the harness doesn't log in with an empty-named app password.Blobs (
spec/BLOBS.md)uploadBlob: checks the token, thenContent-Type, then the 5 MB limit (413, draining the body so the client reads the answer). The MIME type is sniffed for six formats.BlobNotFound,InvalidMimeType,InvalidSize. Malformed blob-shaped maps are stored as they are, as the reference does. References are counted from the records as the commit leaves them, and a blob goes with its last reference.getBlobserves referenced blobs only, with the reference's security headers.listBlobspages by CID, withsince.Identity (
spec/IDENTITY.md)resolveHandle.updateHandle:createAccount's handle checks; a PLC update operation built on the directory's last one and signed with the rotation key;#identity; and the old handle freed at once. Of two accounts racing for one handle, one wins. The reference's loser sometimes gets500after its operation was already posted; ours getsHandleNotAvailableand posts nothing./.well-known/atproto-didbyHost,getRecommendedDidCredentials, anddescribeRepo'sdidDocandhandleIsCorrect, now compared.What a relay reads (
spec/FEDERATION.md)listRepos, with cursors that survive account creation and restarts;getRepoStatus;getBlocks: a CID the repository doesn't hold refuses the call;getRecord, proving presence and absence;requestCrawlsent toPDS_CRAWLERSat the first event, then at most every 20 minutes.A reference fault not copied: killed between a commit and its account-table update, the reference's
listReposlags.Integration
Resp::Nothing; sessions'BearerandAuth::Expiredused by every token check; one handler kind for token-before-input; one tool rule (JSON or no output, and JSON or no input).The checks bite. One bug planted per slice, each caught on every seed tried:
listReposreversedgetBlobwith the wrongContent-TypeFound along the way and fixed:
413reset the connection instead of reaching the client;Checked:
just gates: all 15 harness runs, conformance, and every crate's tests pass. Before that, each slice passed its own harness: plain seeds 1–3,--commands31–32, and crash seeds 21, 22 and 41.🤖 Generated with Claude Code