A way to check how closely any PDS behaves like the reference, area by area, using the harness this repository already has.
harness/compare.mjs runs a server beside the reference @atproto/pds, sends both the same random sequence of requests, and compares the answers. That's a differential test against the reference, and it checks most of what a PDS does:
records, applyWrites, the repository and sync;
sessions, app passwords and identity;
blobs and the firehose;
OAuth, its scopes and its clients;
proxying, validation and the account lifecycle;
crash runs: a server killed and restarted on the same data loses nothing it acknowledged.
Other PDS projects test themselves with smoke tests, which check that a few flows work. This checks behaviour against the reference across the whole surface, with random sequences and crashes, so it finds the edge cases smoke tests miss.
Today it can only check spec-pds. This issue makes it work for any PDS and report what it finds, rather than stopping at the first difference.
Scope first: the core
The first cut checks the core, where a PDS is hardest to get right:
OAuth:
the server's metadata;
PAR;
the code exchange with PKCE;
DPoP and its nonces;
refresh and its rotation;
revocation;
DPoP-bound calls to XRPC;
scopes, enforced on every method;
client metadata documents and their rules.
Sessions: createSession, refresh, app passwords and their scopes, deleteSession.
Records and the repository: writes, applyWrites, swapCommit and swapRecord, validation, the MST and commits a client can verify.
Sync:getRepo, getBlocks, getRecord, listRepos, getRepoStatus, and the firehose's events, in order, with their blocks.
Identity: handles, PLC operations and DID documents.
Blobs: upload, reference, fetch, listing.
Email flows, invites, rate limits, the admin lifecycle and proxying come later.
OAuth's sign-in step needs an adapter hook. The harness signs in on the authorization page through the reference's own page API (/@atproto/oauth-provider/~api/sign-in, consent, device cookies, ephemeral tokens), which spec-pds copied. Every other PDS has its own sign-in page, and the protocol doesn't standardize that step. So:
A hook: each adapter gives a signIn(account, authorizeUrl) that ends at the client's redirect, with its code. It works through the server's own form or API, or a headless browser.
Checked against every server: everything around sign-in, the protocol itself (metadata, PAR, token, DPoP, refresh, revoke, scopes, and the errors each refuses with).
Not checked against other servers: the checks of the page API itself (its answers, cookies and devices) are the reference's implementation, not the protocol. They are spec-pds's own rules here.
What stands in the way
Starting the server is spec-pds's. The harness configures the server through spec-pds's environment variables (PDS_PORT, PDS_PLC_URL, PDS_HANDLE_DOMAINS and about 20 more; see the top of compare.mjs). It reads email from a directory the server writes to (PDS_DEV_MAIL_DIR), and kills the server as a process. Other PDSes are configured differently, read mail differently (zds keeps an outbox behind an admin API), and run in containers.
Some checks are spec-pds's own rules, not the reference's:
--commands (MCP tools and the CLI, spec/COMMANDS.md);
logs, traces and metrics (checks/operations.mjs, spec/OPERATIONS.md);
--store and --scale (spec/STORE.md);
the exact numbers in --limits;
the timing floors on sign-in.
Another PDS shouldn't be held to these.
It stops at the first difference. That's right for building spec-pds, but a compatibility check has to keep going and count results by area.
What to build
An adapter per implementation: how to start, stop and kill it; how the harness's settings map to its configuration (PLC directory, handle domains, admin password, invites, rate limits, AppView, crawlers, OAuth client fetching); and how to read the email it sends. The harness's own environment becomes spec-pds's adapter. Start from the benchmark's adapters (harness/bench.mjs): the reference, spec-pds, vlpds and zds, pinned in bench/impls.json.
Every check tagged either as compared with the reference, or as one of spec-pds's own rules. Only the first kind runs against another implementation.
A report mode: run every area and keep going past a difference. Each area records its checks passed and failed, and its first difference in full, the request and both answers, as the harness prints them now. Write a table with an area per row and an implementation per column, in the style of bench/RESULTS.md.
The known differences that spec/PDS.md lets the server have, applied to every implementation the same way. A difference an implementation documents as deliberate is listed as such in the report, not counted as a failure.
A first run against vlpds and zds, with the results in a results file, and each implementation's maintainers told what was found.
What stays the same
spec-pds's own gates are unchanged, and still stop at the first difference.
No check is loosened (AGENTS.md). Splitting the checks changes which apply to whom, not what any of them holds.
Risks
The reference moves. A new @atproto/pds can change behaviour. The report records the version it compared against.
Some differences are design choices, not bugs: vlpds documents its departures from the reference. The report has to say which is which, or it will mislead.
Adapters need upkeep as implementations change their configuration. Pinning them as the benchmark does keeps a result reproducible.
Where it lives: in harness/ to start. If other implementations' maintainers use it, it may be worth moving into a repository of its own.
What
A way to check how closely any PDS behaves like the reference, area by area, using the harness this repository already has.
harness/compare.mjsruns a server beside the reference@atproto/pds, sends both the same random sequence of requests, and compares the answers. That's a differential test against the reference, and it checks most of what a PDS does:applyWrites, the repository and sync;Other PDS projects test themselves with smoke tests, which check that a few flows work. This checks behaviour against the reference across the whole surface, with random sequences and crashes, so it finds the edge cases smoke tests miss.
Today it can only check spec-pds. This issue makes it work for any PDS and report what it finds, rather than stopping at the first difference.
Scope first: the core
The first cut checks the core, where a PDS is hardest to get right:
applyWrites,swapCommitandswapRecord, validation, the MST and commits a client can verify.getRepo,getBlocks,getRecord,listRepos,getRepoStatus, and the firehose's events, in order, with their blocks.Email flows, invites, rate limits, the admin lifecycle and proxying come later.
OAuth's sign-in step needs an adapter hook. The harness signs in on the authorization page through the reference's own page API (
/@atproto/oauth-provider/~api/sign-in,consent, device cookies, ephemeral tokens), which spec-pds copied. Every other PDS has its own sign-in page, and the protocol doesn't standardize that step. So:signIn(account, authorizeUrl)that ends at the client's redirect, with itscode. It works through the server's own form or API, or a headless browser.What stands in the way
Starting the server is spec-pds's. The harness configures the server through spec-pds's environment variables (
PDS_PORT,PDS_PLC_URL,PDS_HANDLE_DOMAINSand about 20 more; see the top ofcompare.mjs). It reads email from a directory the server writes to (PDS_DEV_MAIL_DIR), and kills the server as a process. Other PDSes are configured differently, read mail differently (zds keeps an outbox behind an admin API), and run in containers.Some checks are spec-pds's own rules, not the reference's:
--commands(MCP tools and the CLI,spec/COMMANDS.md);checks/operations.mjs,spec/OPERATIONS.md);--storeand--scale(spec/STORE.md);--limits;Another PDS shouldn't be held to these.
It stops at the first difference. That's right for building spec-pds, but a compatibility check has to keep going and count results by area.
What to build
harness/bench.mjs): the reference, spec-pds, vlpds and zds, pinned inbench/impls.json.bench/RESULTS.md.spec/PDS.mdlets the server have, applied to every implementation the same way. A difference an implementation documents as deliberate is listed as such in the report, not counted as a failure.What stays the same
AGENTS.md). Splitting the checks changes which apply to whom, not what any of them holds.Risks
@atproto/pdscan change behaviour. The report records the version it compared against.harness/to start. If other implementations' maintainers use it, it may be worth moving into a repository of its own.