// How the harness runs the server it compares with the reference: an // adapter per implementation. Monolith's is the harness as it always ran // it, a process given Monolith's `PDS_*` environment (compare.mjs's // header); the others run in Docker, as the benchmark runs them // (lib/impls.mjs), given as much of the same setup as each can take. // // An adapter is // // start(o) makes the server, not yet started, for the run's setup `o`: // `{command, port, dataDir, logDir, keptLogDir, plc, // recoveryKey, crawlers, appView, clientFetch, handles, limits, // invites, backfillMs, cacheBytes, metricsPort, otlp, // lexiconAuthority}`, `keptLogDir` an empty directory apart // from `dataDir` to keep its log in, for the admin's reads // (spec/OPERATIONS.md, "Kept"; `unsupported.logDir` if it // cannot). Answers // `{server, url, // publicUrl, issuer, recoveryKey, rotationKey, plcSigner, // admin, takeMail}`: `server` the process the harness starts, // kills and starts again (`child`, or `container` here); the // URL the harness calls, the one its DID documents name, and // its OAuth issuer if that is not the same; the rotation keys // it lists in each DID it makes, and its own as a signer; the // `Authorization` its admin is; and `takeMail()`, the emails // it sent since the last call, oldest first, as `{to, kind, // token}` (or a promise of them). A server that hosts one // account (`unsupported.accounts`) answers too its // `password`, the one it was started with, and // `claim({handle, email})`, which makes that account and // answers `{status, body}`, the body a session's as // createSession answers it (spec/COMPAT.md, "One account"). // A server that names itself by an https origin it is not // reached at answers that origin as `publicUrl` and // `fronted: true`: every request for it then goes to `url` // (spec/COMPAT.md, "Its own address"). // port() a port for it to listen on. // info() what it is: `{version, source, config}`. // unsupported each setting it cannot be given, by name, with why. The // checks that depend on one are skipped, saying why // (lib/areas.mjs). // pageApi whether it signs in through the reference's page API // (`/@atproto/oauth-provider/~api/*`), as Monolith does: then // every step of a sign-in is compared. Without it, it has // signIn(account, authorizeUrl, consent) // which signs `account` (`{identifier, password}`) in on its // own authorization page at `authorizeUrl` (the page a PAR's // `request_uri` names) and approves the request, or with // `consent.approve` false refuses it, through its own form or // API, and answers the answer that sends the browser back to // the client, with its `code` (a redirect, or a `form_post` // page), as lib/oauth.mjs's Browser answers. Only that answer // is compared with the reference's. // passwordFor(p) // for a server that refuses passwords by rules of its own, // a password they take made from `p`, the same each time and // with no draw: each area's first accounts are made with it // (spec/COMPAT.md, "Password rules"). None for Monolith. // own whether Monolith's own rules hold it: its commands, logs, // traces and metrics, store and scale, the exact numbers of // its limits, its timing floors, and what the specs it is // built from say where the reference departs from them // (compat/README.md lists them). Only Monolith is. // // Each is a module of its own here; common.mjs is what they share. import pdsjs from './pds.js.mjs' import monolith from './monolith.mjs' import tranquil from './tranquil.mjs' import vlpds from './vlpds.mjs' import zds from './zds.mjs' /// The adapters, by name. export const ADAPTERS = { monolith, zds, vlpds, 'pds.js': pdsjs, tranquil }