~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

harness: checks cite the spec sections they hold the server to

Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:spec/citations
.knotless/workflows/citations.ymlnew+19−0
@@ -0,0 +1,19 @@
# The harness's citations of the spec (spec/PDS.md, "How it is checked"):
# every citation names a section its page has, and every section of every
# page is cited by some check, but those harness/spec-coverage.mjs lists as
# unchecked. The gates run it too, but only on a change to what they check,
# which the spec's prose is not: a heading renamed in a pull of prose alone
# is caught here. It needs Node alone.
image: node:24.22.1
runners: [runner.knotless.dev]
# The two lists are the same; keep them so.
on:
push:
refs: [refs/heads/main]
paths: [spec/*.md, harness/**/*.mjs, .knotless/workflows/citations.yml]
pull:
base: [refs/heads/main]
paths: [spec/*.md, harness/**/*.mjs, .knotless/workflows/citations.yml]
steps:
- name: citations
run: node harness/spec-coverage.mjs
docs/guide/contributing.md+7−0
@@ -74,6 +74,13 @@ in `harness/`, with `CARGO` naming the cargo to run.
- `#![forbid(unsafe_code)]` at the root of every crate, each of its
targets, which `harness/code.mjs` checks: what needs the operating
system goes through a crate that wraps it safely.
- Every citation of the spec in the harness, as `(spec/LIFECYCLE.md,
"deactivateAccount")`, naming a section its page has, and every section
of every page cited by some check, but the few `harness/spec-coverage.mjs`
lists as unchecked, each with why (`spec/PDS.md`, "How it is checked").
The `citations` workflow runs it alone on every pull that changes a spec
page or the harness, so a pull of the spec's prose, which the gates
skip, is held to it too.
- The pages' source ([web/AGENTS.md](../../web/AGENTS.md)): each component
using only its own layer and those below (`harness/layers.mjs`), every
text colour at 4.5:1 on what it is drawn on in light and dark
harness/checks/accounts.mjs+13−11
@@ -110,11 +110,12 @@ export const newAccountInput = (withPassword = false) => inputOf(newDetails(with
/// document for the DID; the directory's log is one genesis operation, with
/// the side's rotation keys, the account's handle and the side's URL, whose
/// signing key is then the one its repository is verified against; and
/// getSession with the new token is the same on both sides. The reference
/// is held to all of it too, which checks the checks. spec-pds's operation
/// also has the account's KEM key, a P-256 did:key other than the signing
/// key (spec/SPACES.md), which the `latest` reference has not; another
/// implementation may have one, held to the same (spec/COMPAT.md).
/// getSession with the new token is the same on both sides
/// (spec/ACCOUNTS.md, "createAccount"). The reference is held to all of it
/// too, which checks the checks. spec-pds's operation also has the
/// account's KEM key, a P-256 did:key other than the signing key
/// (spec/SPACES.md, "The KEM key"), which the `latest` reference has not;
/// another implementation may have one, held to the same (spec/COMPAT.md).
async function checkNewAccount(acct, answers, body) {
const request = shown({ body })
for (const [side, res] of [[ref, answers[0]], [cand, answers[1]]]) {
@@ -159,7 +160,7 @@ const freeEmails = () => accounts.filter((a) => !a.password && !accounts.some((b
/// createAccount that both sides must make: mixed-case handles and emails,
/// accounts with no password or an empty one, and sometimes the email of an
/// account without a password.
/// account without a password (spec/ACCOUNTS.md, "createAccount").
export async function createAccount({ withPassword = false } = {}) {
const d = newDetails(withPassword)
const free = freeEmails()
@@ -209,7 +210,7 @@ const FAULTS = {
/// createAccount with one fault, or two or three in different fields,
/// which tests the order the checks are made in. Each side must refuse it
/// as the reference does.
/// as the reference does (spec/ACCOUNTS.md, "createAccount").
export async function createAccountRefused() {
const front = freshFront()
const body = { handle: `${front}.test`, email: `${front}@example.com`, password: `pw-${front}` }
@@ -226,7 +227,7 @@ export async function createAccountRefused() {
/// Two createAccounts at once on each side, with the same handle and email
/// in different case: each side makes one account at most, and the same
/// number as the other.
/// number as the other (spec/ACCOUNTS.md, "createAccount").
export async function accountRace() {
const d = newDetails(false)
const bodies = [inputOf(d, false), { ...inputOf(d, false), handle: mixCase(d.handle), email: mixCase(d.email) }]
@@ -248,8 +249,8 @@ export async function accountRace() {
/// createSession by handle or email, either in mixed case, or by DID; with
/// the account's password, a wrong one, or for an account without one any;
/// or for an identifier no account has. Sometimes the account carries on
/// with the new session's tokens.
/// or for an identifier no account has (spec/ACCOUNTS.md, "Sessions").
/// Sometimes the account carries on with the new session's tokens.
export async function createSession(acct) {
let kind, request
if (rand() < 0.75) {
@@ -276,7 +277,8 @@ const WRITE_METHODS = ['com.atproto.repo.createRecord', 'com.atproto.repo.putRec
/// A write with the account's token to another account's repository, by its
/// handle or DID, with every write method, sometimes with bad input or a
/// record of the wrong `$type`; or to a repository no account has. Input
/// errors come first, then the repository.
/// errors come first, then the repository (spec/ACCOUNTS.md, "Writes to
/// another account").
export async function crossWrites(acct) {
const others = accounts.filter((x) => x !== acct)
const nobody = rand() < 0.15
harness/checks/blobs.mjs+19−10
@@ -62,7 +62,8 @@ export const referencedCids = (m) => [...new Set([...m.refs.values()].flatMap((s
export const rawCid = async (bytes) => CID.create(1, RAW, await sha256.digest(bytes)).toString()
/// Whether `v` is a blob ref, as spec/BLOBS.md says, in its JSON form.
/// Whether `v` is a blob ref, in its JSON form (spec/BLOBS.md, "Blob refs in
/// records").
function isBlobRef(v) {
if (!v || typeof v !== 'object' || Array.isArray(v)) return false
const keys = Object.keys(v).sort()
@@ -179,7 +180,8 @@ async function sniffs(bytes, want) {
/// uploadBlob on one side: `bytes` with `type` as Content-Type (none if
/// undefined), `token` an account or a string, sent chunked if asked. With
/// --commands, some of the server's go through `pds repo upload-blob`.
/// --commands, some of the server's go through `pds repo upload-blob`
/// (spec/COMMANDS.md, "Answers").
export async function uploadOn(side, { bytes, type, token, chunked }) {
const t = token && typeof token === 'object' ? tokenOf(side, token) : token
if (COMMANDS && side === cand && type && !chunked && token && typeof token === 'object' && bytes.length < 100_000 && chance(0.3)) return uploadByCommand(type, t, bytes)
@@ -223,7 +225,8 @@ async function uploadByCommand(type, token, bytes) {
}
/// getBlob on one side, asking for no compression: its status, the headers
/// spec/BLOBS.md names, and the bytes, or the error.
/// spec/BLOBS.md names, and the bytes, or the error (spec/BLOBS.md,
/// "getBlob").
async function getBlobOn(side, params, token) {
const t = token && typeof token === 'object' ? tokenOf(side, token) : token
const url = new URL(`${side.url}/xrpc/${GET}`)
@@ -318,8 +321,9 @@ export async function sendUpload(acct, m, { bytes, type, token, chunked = false,
/// ones and rarely ones at the limit or past it; Content-Types of each kind
/// spec/BLOBS.md names, or none; the account's token, none, or a JWT never
/// given out. Answers compared whole; the reference's `ref` and `size` held
/// to the body. The limit's exact number is spec-pds's own: another
/// implementation is sent no body at it (spec/COMPAT.md).
/// to the body (spec/BLOBS.md, "uploadBlob"). The limit's exact number is
/// spec-pds's own: another implementation is sent no body at it
/// (spec/COMPAT.md).
export async function uploadBlob(acct) {
const m = model(acct)
const r = rand()
@@ -441,7 +445,8 @@ export function landed(acct, m, a, b, changes) {
/// Records with blob refs, by createRecord, putRecord, deleteRecord and
/// applyWrites, in the collection of their own; at most one ref in a write
/// may be wrong. Compared as any write; sometimes the record is read back.
/// may be wrong. Compared as any write; sometimes the record is read back
/// (spec/BLOBS.md, "Blob refs in records").
export async function blobRecord(acct) {
const m = model(acct)
const budget = { n: 1 }
@@ -506,7 +511,7 @@ export async function blobRecord(acct) {
/// none, another; of the account's uploads, held or not; another account's
/// upload; a CID never uploaded; a record's; arguments that do not parse;
/// and a DID no one holds. With no token, the account's, another's, or one
/// never given out.
/// never given out (spec/BLOBS.md, "getBlob").
export async function getBlob(acct) {
const r = rand()
const holders = accounts.filter((a) => a.blobs && referencedCids(a.blobs).length)
@@ -538,7 +543,8 @@ export async function getBlob(acct) {
/// own, from the same write), a TID before every rev or one after; and
/// arguments that do not parse. Compared whole, cursors too, which are
/// CIDs. Listed from the start without `since`, the reference must list
/// exactly the blobs the harness knows to be referenced.
/// exactly the blobs the harness knows to be referenced (spec/BLOBS.md,
/// "listBlobs").
export async function listBlobs(acct) {
const m = model(acct)
const params = {}
@@ -586,7 +592,8 @@ export async function listBlobs(acct) {
/// An upload on its way to the server when it is killed, and already
/// answered by the reference. Its body is the run's own and never sent
/// again, so whatever the server kept of it touches nothing else.
/// again, so whatever the server kept of it touches nothing else
/// (spec/BLOBS.md, "Durability"; spec/DURABILITY.md, "Blobs").
export function uploadInFlight(acct) {
const bytes = plainBody('in flight ')
const type = 'text/plain'
@@ -661,7 +668,9 @@ export async function reuploadAtOnce(acct) {
/// After a restart: every account's blobs as the reference holds them. Its
/// listBlobs, getBlob of some of its referenced blobs, and a record
/// referencing an upload no record referenced before the restart.
/// referencing an upload no record referenced before the restart: an
/// upload answered survives a kill (spec/BLOBS.md, "Durability";
/// spec/DURABILITY.md, "Blobs").
export async function blobsSurvive() {
for (const acct of accounts) {
const m = acct.blobs
harness/checks/blobstore.mjs+2−1
@@ -263,7 +263,8 @@ export async function afterRestart() {
/// harness knows an account holds with its object; and none of a blob it
/// stopped holding, of an account deleted, or of an upload the server was
/// killed during. And no request of the server's refused, or of an
/// operation the store does not know.
/// operation the store does not know: the store refuses one not signed
/// (spec/BLOBS.md, "Requests to the store").
async function wrongs() {
const out = []
for (const r of s3.rejected.filter((x) => x.bucket === BUCKETS.server || !x.bucket)) out.push({ refused: r })
harness/checks/commands.mjs+10−3
@@ -7,8 +7,8 @@ import { accounts, tokenOf } from '../lib/state.mjs'
import { count, differ } from '../lib/report.mjs'
import { ACCOUNT_ARGS, METHODS, MCP_LEGACY, MCP_VERSION, mcpPost, mcpRpc, mcpShape, runCli } from '../lib/via.mjs'
/// What a lexicon type is as JSON Schema, by spec/COMMANDS.md: the `type`
/// expected, or undefined for none.
/// What a lexicon type is as JSON Schema (spec/COMMANDS.md, "Arguments"):
/// the `type` expected, or undefined for none.
function schemaType(t) {
if (['string', 'integer', 'boolean', 'array'].includes(t)) return t
if (['object', 'ref', 'union'].includes(t)) return 'object'
@@ -78,13 +78,20 @@ async function checkMcpRefusals(versions) {
/// The tools and commands, as spec/COMMANDS.md derives them from the
/// lexicons: `server/discover`, the tool list and each tool's schema, the
/// legacy era, the CLI's help at each level, and usage errors for what it
/// does not take.
/// does not take (spec/COMMANDS.md, "One binary", "Names", "Which methods",
/// "Arguments", "Answers"); every tool listed with a token or without
/// (spec/COMMANDS.md, "Auth").
export async function checkCommands() {
const own = tokenOf(cand, accounts[0])
const d = await mcpRpc('server/discover', {}, undefined, 'DiscoverResult')
if (d.failed || d.message.error) await differ('MCP server/discover', {}, 'a DiscoverResult', d)
const versions = [MCP_VERSION, ...MCP_LEGACY]
if (!isDeepStrictEqual(d.message.result.supportedVersions, versions) || !d.message.result.capabilities?.tools) await differ('MCP server/discover', {}, `supportedVersions ${versions}, and the tools capability`, d.message.result)
// The spaces' methods among them, by their lexicons: each with a JSON
// answer or none a tool, none destructive but the space repo's writes
// (spec/SPACES-REPO.md, "Commands"; spec/SPACES-EXPORT.md, "Commands";
// spec/SPACES-CREDENTIALS.md, "As tools and commands";
// spec/SPACES-POLICIES.md, "Commands"; spec/SPACES-SYNC.md, "Commands").
const want = Object.values(METHODS).filter((m) => m.tool)
let modernTools
for (const token of [undefined, own]) {
harness/checks/cors.mjs+1−1
@@ -1,4 +1,4 @@
// Browsers (spec/PDS.md): CORS on every path but OAuth's, held to the
// CORS on every path but OAuth's (spec/PDS.md, "Browsers"), held to the
// reference.
import { isDeepStrictEqual } from 'node:util'
harness/checks/email.mjs+22−12
@@ -33,7 +33,8 @@ const NEVER = ['AAAAA-AAAAA', '22222-22222', 'ZZZZZ-77777']
/// Each account's tokens, by purpose, as each side mailed them, oldest
/// first: `{reference: [...], server: [...]}`, alike in length, as both
/// sides mail alike.
/// sides mail alike. Kept to give back later, maybe after a crash, when
/// each must still do as it would have (spec/EMAIL.md, "Durability").
const mailed = new Map()
function tokensOf(acct, purpose) {
if (!mailed.has(acct)) mailed.set(acct, {})
@@ -75,7 +76,7 @@ async function bothHttp(kind, nsid, request) {
/// The emails sent since the last step of this page, by other steps:
/// compared too, so that no other method sends one where the reference
/// does not.
/// does not (spec/EMAIL.md, "The mailer").
async function strays() {
keep(await checkMail('the emails sent since the last email step', {}))
}
@@ -84,7 +85,8 @@ const tokenOn = (side, t) => (typeof t === 'function' ? t(side) : t)
/// A token to give back for `acct`'s `purpose`, as `[how, token of the
/// side]`: its current one, an earlier one, the current one in lower case,
/// its current one of another purpose, one never made, or `""`.
/// its current one of another purpose, one never made, or `""`
/// (spec/EMAIL.md, "Tokens").
function pickToken(acct, purpose) {
const t = tokensOf(acct, purpose)
const n = t.reference.length
@@ -128,7 +130,8 @@ function noInput() {
/// with a password has: no account keeps them.
const freeEmails = () => accounts.filter((a) => !a.password && !accounts.some((b) => b.password && b.email === a.email)).map((a) => a.email)
/// requestEmailConfirmation with the account's token, none, or a wrong one.
/// requestEmailConfirmation with the account's token, none, or a wrong one
/// (spec/EMAIL.md, "requestEmailConfirmation").
export async function requestEmailConfirmation(acct) {
await strays()
const [how, token] = authOf(acct)
@@ -137,7 +140,8 @@ export async function requestEmailConfirmation(acct) {
}
/// confirmEmail with the account's email, in mixed case, another's, or one
/// no account has; and a token picked as pickToken says. Then getSession.
/// no account has; and a token picked as pickToken says. Then getSession
/// (spec/EMAIL.md, "confirmEmail", "The account's email").
export async function confirmEmail(acct) {
await strays()
const others = accounts.filter((a) => a !== acct)
@@ -149,7 +153,8 @@ export async function confirmEmail(acct) {
if (a.status === 200) await both('getSession after confirmEmail', GET, { token: acct })
}
/// requestEmailUpdate with the account's token, none, or a wrong one.
/// requestEmailUpdate with the account's token, none, or a wrong one
/// (spec/EMAIL.md, "requestEmailUpdate").
export async function requestEmailUpdate(acct) {
await strays()
const [how, token] = authOf(acct)
@@ -161,7 +166,7 @@ export async function requestEmailUpdate(acct) {
/// account without a password had, or no address; with no token or one
/// picked as pickToken says; sometimes with `emailAuthFactor: false`, or
/// `true` and a new address. Then getSession, and createSession by the
/// new email.
/// new email (spec/EMAIL.md, "updateEmail", "The account's email").
export async function updateEmail(acct) {
await strays()
const others = accounts.filter((a) => a !== acct && a.password)
@@ -230,7 +235,8 @@ function login(acct, extra = {}, password = acct.password) {
/// not (confirmed first, mostly); createSession without the code, with
/// wrong codes, with an app password, and with the code, once and again;
/// then turned off, without a token, with a wrong one, and with the one
/// mailed. It is off again when the step ends.
/// mailed. It is off again when the step ends (spec/EMAIL.md, "The
/// account's email", "updateEmail", "The email factor and createSession").
export async function emailFactor(acct) {
await strays()
const turnOn = (kind) => call(kind, UPDATE, { token: acct, body: { email: chance(0.3) ? mixCase(acct.email) : acct.email, emailAuthFactor: true, ...(chance(0.3) ? { token: pick(NEVER) } : {}) } })
@@ -350,7 +356,8 @@ async function oauthSignInFactor(acct) {
/// resetPassword with a token picked as pickToken says, or another
/// account's, and a new password, one of 256 UTF-16 units, one over, or
/// `""` (then set again). After a reset: createSession with the old and new
/// password, and refreshSession with a session from before.
/// password, and refreshSession with a session from before (spec/EMAIL.md,
/// "requestPasswordReset", "resetPassword").
export async function passwordReset(acct) {
await strays()
const free = freeEmails()
@@ -410,8 +417,9 @@ async function beforeReset(owner) {
/// the reference keeps them all: each OAuth session of the account ended,
/// `getSession` `401 invalid_token` and a refresh `400 invalid_grant`; the
/// code of the request approved before refused, `400 invalid_grant`; and
/// the account on the page of no device it signed in on. The harness then
/// drops those sessions and devices on both sides.
/// the account on the page of no device it signed in on (spec/EMAIL.md,
/// "resetPassword", "What the reference does that the server does not
/// copy"). The harness then drops those sessions and devices on both sides.
async function afterReset(owner, pending) {
const st = oauthOf(owner)
const held = async (what, want, got) => {
@@ -443,7 +451,9 @@ async function afterReset(owner, pending) {
}
/// The four methods of this page that take a token, with a session of an
/// app password, privileged or not: two take it, two do not.
/// app password, privileged or not: two take it, two do not (spec/EMAIL.md,
/// "requestEmailConfirmation", "confirmEmail", "requestEmailUpdate",
/// "updateEmail").
export async function appPasswordEmail(acct) {
await strays()
const s = await appSession(acct)
harness/checks/federation.mjs+15−8
@@ -89,7 +89,8 @@ let kept = null
/// listRepos: the cursor kept from the last time, which must list the
/// accounts made since; then every account, paged through at a random
/// limit; or a limit out of range, or an empty cursor.
/// limit; or a limit out of range, or an empty cursor (spec/FEDERATION.md,
/// "listRepos").
export async function listRepos() {
if (kept) {
const { pages } = await pageThrough('listRepos from an old cursor', undefined, kept.cursor)
@@ -125,7 +126,8 @@ async function repoStatus(kind, did, acct, shownAs) {
}
/// getRepoStatus of the account, of a DID no one has, of a handle, of
/// something that is no DID, or of nothing.
/// something that is no DID, or of nothing (spec/FEDERATION.md,
/// "getRepoStatus").
export async function getRepoStatus(acct) {
const r = rand()
if (r < 0.6) return repoStatus('getRepoStatus', (side) => didOf(side, acct), acct, { did: `<did:${acct.n}>` })
@@ -156,7 +158,7 @@ async function blocksOf(bytes) {
/// read from the reference's getRepo and the same on both sides, and
/// sometimes each side's own latest commit, sometimes one named twice;
/// sometimes with a CID the repository never held; or a DID no one has, a
/// CID that does not parse, or none.
/// CID that does not parse, or none (spec/FEDERATION.md, "getBlocks").
export async function getBlocks(acct) {
const res = await xrpcHttp(ref, 'com.atproto.sync.getRepo', { params: { did: didOf(ref, acct) }, raw: true })
const car = await readCarWithRoot(res.bytes)
@@ -220,7 +222,8 @@ export async function getBlocks(acct) {
/// MST nodes and records the reference's tree had at an earlier such step
/// and has not now, and each side's own earlier commit, sometimes with a
/// block it holds now. Both sides answer them as blocks the repository does
/// not hold, `400 InvalidRequest` (spec/FEDERATION.md, spec/STORE.md).
/// not hold, `400 InvalidRequest` (spec/FEDERATION.md, "getBlocks";
/// spec/STORE.md).
export async function getGoneBlocks(acct) {
const res = await xrpcHttp(ref, 'com.atproto.sync.getRepo', { params: { did: didOf(ref, acct) }, raw: true })
const car = await readCarWithRoot(res.bytes)
@@ -247,7 +250,8 @@ export async function getGoneBlocks(acct) {
// getRecord
/// The sync getRecord of a key of the account's repository, there or not,
/// or of a bad collection or record key, a handle, or a DID no one has.
/// or of a bad collection or record key, a handle, or a DID no one has
/// (spec/FEDERATION.md, "getRecord").
export async function syncGetRecord(acct) {
const held = [...acct.records.keys()]
let [collection, rkey] = held.length && chance(0.5) ? pick(held).split('/') : [pick(COLLECTIONS), pick(RKEYS)]
@@ -293,7 +297,8 @@ export async function syncGetRecord(acct) {
/// After a restart, once the repositories are checked: listRepos lists every
/// account in the order made, and each account's getRepoStatus, each with
/// the head and rev the repository check found.
/// the head and rev the repository check found (spec/FEDERATION.md,
/// "listRepos", "getRepoStatus").
export async function checkListing() {
const { pages } = await pageThrough('listRepos after a restart', 1000)
if (!isDeepStrictEqual(listedIn(pages), named())) await fail(ref, 'listRepos', { after: 'a restart' }, named(), listedIn(pages))
@@ -307,7 +312,8 @@ export async function checkListing() {
const CRAWL = { method: 'POST', path: '/xrpc/com.atproto.sync.requestCrawl', type: 'application/json', body: { hostname: 'localhost' } }
const TWENTY_MINUTES = 20 * 60e3
/// Before the first account, no side has told its crawlers anything.
/// Before the first account, no side has told its crawlers anything
/// (spec/FEDERATION.md, "requestCrawl").
export async function noCrawlsYet() {
await wait(300)
for (const side of [ref, cand]) if (crawls[side.name].length) await fail(side, 'requestCrawl', { before: 'any account was made' }, 'no request', crawls[side.name])
@@ -316,7 +322,8 @@ export async function noCrawlsYet() {
/// Each crawler that listens has had one request from each side since the
/// first event, the same, within 5 seconds of being checked; and no more
/// than one in each 20 minutes the run has lasted, besides, from the server,
/// one after each of its `restarts`.
/// one after each of its `restarts`. The crawlers are those each side's
/// `PDS_CRAWLERS` names (spec/FEDERATION.md, "Environment", "requestCrawl").
export async function checkCrawls(restarts) {
const started = Date.now()
for (const side of [ref, cand]) {
harness/checks/firehose.mjs+19−14
@@ -63,7 +63,8 @@ const opKey = (op) => `${op.action} ${sameKey(op.path)} ${op.cid?.toString() ??
/// The event's account as both sides name it, `<did:n>`.
const whose = (side, e) => strip(side, String(e.body.repo ?? e.body.did))
/// The events a new account starts with, in order (spec/ACCOUNTS.md).
/// The events a new account starts with, in order (spec/ACCOUNTS.md,
/// "createAccount").
const BIRTH = ['#identity', '#account', '#commit', '#sync']
function describeEvent(f, e) {
@@ -83,7 +84,8 @@ function describeEvent(f, e) {
/// Check one event on its own terms: what the sync spec says a consumer
/// checks, and that it continues the chain of events before it. The
/// reference's events are checked too, which checks the checks.
/// reference's events are checked too, which checks the checks
/// (spec/SYNC.md, "The firehose").
async function checkEvent(f, e) {
const { header, body } = e
const fail = (why) => differ(`the ${f.side.name}'s firehose`, { event: kind(e), seq: body.seq }, why, describeEvent(f, e))
@@ -101,7 +103,7 @@ async function checkEvent(f, e) {
if (header.t !== BIRTH[born]) return fail(`a new account's events, ${BIRTH.join(', ')}: ${BIRTH[born]} next`)
}
// Each #identity carries the handle the account had been given by then,
// in order (spec/IDENTITY.md).
// in order (spec/IDENTITY.md, "updateHandle").
if (header.t === '#identity') {
const i = f.identities.get(did) ?? 0
f.identities.set(did, i + 1)
@@ -171,7 +173,7 @@ async function checkEvent(f, e) {
/// Both firehoses caught up with every account's latest commit, each new
/// event checked, and the same events on both sides since the last check:
/// the commits, by account and ops, and the other events, by account, in
/// order.
/// order (spec/SYNC.md, "The firehose").
export async function checkFirehose() {
const fresh = {}
for (const side of [ref, cand]) {
@@ -203,8 +205,9 @@ export async function checkFirehose() {
}
/// A new subscription from a cursor must replay exactly the events after it,
/// or with a backfill window, as spec/STORE.md says; and one from the future
/// must be refused as the reference refuses it.
/// or with a backfill window, as it says (spec/STORE.md, "The backfill
/// window"); and one from the future must be refused as the reference
/// refuses it (spec/SYNC.md, "The firehose").
export async function checkReplay() {
if (BACKFILL_MS) await windowReplay()
else {
@@ -233,7 +236,8 @@ export async function checkReplay() {
}
if (!isDeepStrictEqual(answers.reference, answers.server)) await differ('subscribeRepos from a cursor in the future', { cursor: future }, answers.reference, answers.server)
// A cursor that is not an integer is refused as the reference refuses it.
// A cursor that is not an integer is refused as the reference refuses it
// (spec/SYNC.md, "What the reference does that the specs leave open").
const odd = {}
for (const side of [ref, cand]) {
const sub = subscribe(side, 'abc')
@@ -249,13 +253,14 @@ export async function checkReplay() {
/// side of it: the two clocks, and the time a subscription takes to start.
const EDGE = 1500
/// subscribeRepos from a cursor with the backfill window (spec/STORE.md), on
/// both sides, each held to the rule on its own: a cursor whose next event
/// is well out of the window (`old`, or `0`) gets `#info OutdatedCursor`
/// first, then every event from somewhere at the window's edge to the last,
/// with no gap; one whose next event is well within it (`recent`), every
/// event after it and no `#info`. Each side's cursor is one of its own
/// events'; the sides must agree on whether there was an `#info`.
/// subscribeRepos from a cursor with the backfill window (spec/STORE.md,
/// "The backfill window"), on both sides, each held to the rule on its own:
/// a cursor whose next event is well out of the window (`old`, or `0`) gets
/// `#info OutdatedCursor` first, then every event from somewhere at the
/// window's edge to the last, with no gap; one whose next event is well
/// within it (`recent`), every event after it and no `#info`. Each side's
/// cursor is one of its own events'; the sides must agree on whether there
/// was an `#info`.
export async function windowReplay() {
const which = pick(['old', 'recent', 'zero'])
const at = rand()
harness/checks/identity.mjs+35−23
harness/checks/lifecycle.mjs+62−34
harness/checks/limits.mjs+68−50
harness/checks/logging.mjs+7−5
harness/checks/moves.mjs+18−8
harness/checks/oauth-clients.mjs+26−17
harness/checks/oauth-limits.mjs+20−15
harness/checks/oauth-mcp.mjs+34−15
harness/checks/oauth-scopes.mjs+23−12
harness/checks/oauth.mjs+60−43
harness/checks/odd.mjs+8−3
harness/checks/operations.mjs+24−14
harness/checks/pages.mjs+23−11
harness/checks/permission-sets.mjs+15−6
harness/checks/proxy.mjs+28−15
harness/checks/records.mjs+9−6
harness/checks/repository.mjs+2−1
harness/checks/scale.mjs+6−5
harness/checks/session.mjs+6−5
harness/checks/sessions.mjs+17−9
harness/checks/store.mjs+11−10
harness/checks/validation.mjs+36−19
harness/lib/adapters/spec-pds.mjs+4−2
harness/lib/clients.mjs+2−1
harness/lib/crawlers.mjs+4−2
harness/lib/env.mjs+8−8
harness/lib/kem.mjs+3−3
harness/lib/mail.mjs+4−3
harness/lib/observe.mjs+1−1
harness/lib/plc-proxy.mjs+2−2
harness/lib/processes.mjs+1−1
harness/lib/sets.mjs+6−3
harness/lib/via.mjs+16−9
harness/spaces/lib/spec.mjs+7−5
harness/spaces/compare.mjs+15−5
harness/spaces/credentials.mjs+30−13
harness/spaces/export.mjs+29−8
harness/spaces/policies.mjs+37−20
harness/spaces/repo.mjs+45−15
harness/spaces/ssrf.mjs+6−4
harness/spaces/sync.mjs+34−13
harness/spaces/vectors.mjs+3−2
harness/compare.mjs+8−6
harness/conformance.mjs+3−2
harness/contrast.mjs+4−3
harness/gates.mjs+3−1
harness/perf.mjs+6−6
harness/spec-coverage.mjsnew+121−0
spec/interop/spaces/lthash.json+1−1
spec/ACCOUNTS.md+2−0
spec/BLOBS.md+3−1
spec/DURABILITY.md+9−8
spec/EMAIL.md+12−7
spec/FEDERATION.md+4−4
spec/LIFECYCLE.md+22−14
spec/LIMITS.md+16−9
spec/OAUTH-CLIENTS.md+7−3
spec/OAUTH-MCP.md+2−0
spec/OAUTH-PAGES.md+18−8
spec/OAUTH-PERMISSION-SETS.md+11−5
spec/OAUTH-SCOPES.md+7−4
spec/OAUTH.md+15−9
spec/OPERATIONS.md+43−31
spec/PDS.md+31−3
spec/PROXY.md+19−12
spec/SESSIONS.md+15−9
spec/SPACES-CREDENTIALS.md+14−7
spec/SPACES-EXPORT.md+4−3
spec/SPACES-POLICIES.md+7−2
spec/SPACES-REPO.md+17−14
spec/SPACES-SYNC.md+2−0
spec/SPACES.md+3−2
spec/STORE.md+2−2
spec/SYNC.md+2−2
spec/VALIDATION.md+3−1
AGENTS.md+4−1
README.md+1−1