chadtmiller.com/monolith
An atproto PDS
Spec and check what a build from scratch found the spec left open
MergedThis pull writes down what the reference does where the spec was silent. It reorders the write checks (token, then input, then repo, then $type), adds RepoNotFound, wrong-HTTP-method, validate and getRepo since, and makes nullable tool schemas [type, "null"]. Each change is in SLICE.md or COMMANDS.md and has a harness check against the reference (oddRequests, checkSince, the cursor abc case, the nullable schema comparison). I read all ten files. The server code matches the spec text, and the held bookkeeping in pds-repo is logged as added, so it survives a restart (the new since_survives_restart test covers that). The harness changes only add or tighten checks, and nothing in the pull touches conformance.yaml. It adds no crates, and I saw no use of reference or SDK source. I did not run the gates.
One gap that does not block the merge: SLICE.md says getRepo since holds "the records and MST nodes of the current tree written since", but checkSince compares only the records (blocks with a $type) and the root. It checks the node count only for the latest rev, where it must be 0. A server that left out the changed MST nodes would pass. Compare the non-record block count against the reference, or narrow the spec sentence to what is checked.
harness/compare.mjsline 1191
if (oursSince.root !== ourRoot) await differ('com.atproto.sync.getRepo', request, `the latest commit, ${ourRoot}, as root`, oursSince.root) | |
if (theirsSince.root !== theirRoot) throw new Error(`the reference's getRepo since has root ${theirsSince.root}, not ${theirRoot}`) | |
if (which === 'latest' && oursSince.blocks !== 0) await differ('com.atproto.sync.getRepo', request, 'no blocks', `${oursSince.blocks} blocks`) | |
if (!isDeepStrictEqual(theirsSince.records, oursSince.records)) await differ('com.atproto.sync.getRepo', request, { records: theirsSince.records }, { records: oursSince.records }, 'the records written since') |
Only records are compared. The spec also puts the MST nodes written since in this CAR, and nothing here checks them. Compare the count of non-record blocks too, or say in SLICE.md that the nodes are the server's choice, as is done for the firehose.
An agent rebuilt the whole server from
spec/alone, from an emptycrates/with no history, and passedjust gatesin 25 minutes. Its list of where the spec was silent is now spec, each answer taken from the reference PDS, and each one is a harness check against the reference.Spec (
SLICE.md). What the reference does, now written down:repo, then the record's$type. No token is401 AuthMissing(SLICE saidAuthenticationRequired, which was wrong). A token never given out is400 InvalidToken, whatever the input. Arepothat isn't the account is403 AccountNotFound.describeRepo,getRepoandgetLatestCommitof a DID the server doesn't hold are400 RepoNotFound.400 InvalidRequest.validate: trueis400 InvalidRequest, since the server has no lexicon for any record type.validate: falsewrites, with novalidationStatusin the answer.getRepo since: the latest commit, plus the blocks of the current tree written since that rev. A record replaced or deleted since is not included, which a first wording got wrong. Asincethat isn't a TID is400.InvalidRequestframe, then the stream closes.putRecordalso answersvalidationStatus.blocksare defined by what is checked: every op proved against the commit, and the ops undone back toprevData.atproto/did.mdandatproto/handle.mddefine them; both are newly vendored.COMMANDS.md: anullableargument's schema type is[type, "null"].Harness.
oddRequestsstep covers every case above against the reference: writes with no token or a bogus one, with good or bad input; a write to another repo; unknown DIDs; the other HTTP method;validate.getRepo sinceis checked in the repository check: the root, the record blocks, and no blocks at the head.AccountNotFoundis mapped for tool errors.The checks bite. Two independent servers fail them:
AuthenticationRequired).sincereturning a replaced record.Three of my own guesses were wrong and got caught here:
sinceat first, the place of the repo check, and the place of the$typecheck. Each came from a random run on the reference.Server:
dispatch,check_account,typed;validate;car_since, with the rev that added each block, logged so it survives restarts;pds-lexicon.Docs:
Checked:
just gates: all 15 harness runs and the crates' tests pass, in 223s.🤖 Generated with Claude Code