@getcirrus/space-conformance 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"full-CKsHg6ox.js","names":["parts: Uint8Array[]","cursor: string | undefined","last: ReturnType<typeof commitFromJson>","problems: string[]","credential: Credential","cryptoChecks: Check[]","didFor?: (\n\t\t\trole: string,\n\t\t\tdidKey: string,\n\t\t) => string | Promise<string>"],"sources":["../src/full/helpers.ts","../src/full/checks.ts","../src/identity.ts","../src/full.ts"],"sourcesContent":["/**\n * Crypto-bound helpers: tokens minted as harness-held identities\n * (delegation tokens as a reader, credentials as a foreign authority,\n * service auth as a writer's PDS) and the reference library's verifiers\n * for the MACs, commits and archives a target serves.\n *\n * Using the reference library to mint and verify is deliberate: \"correctly\n * formed\" is defined by the library every implementation must interoperate\n * with, so a token it mints is one the target must accept, and an artefact\n * it rejects is one no other implementation could consume.\n */\n\nimport {\n\tcreateDelegationToken,\n\tcreateSpaceCredential,\n\tspaceHostAud,\n\ttype SpaceCommit,\n} from \"@atproto/space\";\nimport type { CheckContext, HarnessIdentity } from \"../model.js\";\nimport { lexBytes, toBase64Url, utf8 } from \"../encoding.js\";\nimport {\n\trequestCredential,\n\tspaceAuthority,\n\ttype Credential,\n\ttype CredentialResult,\n} from \"../checks/probe.js\";\nimport type { XrpcResult } from \"../http.js\";\n\nexport {\n\tcreateProbeSpace,\n\tdeleteProbeSpace,\n\toperatorCreateRecord,\n\tobtainCredentialViaDelegation,\n\tobtainPublicCredential,\n\tcredentialGet,\n\tcredentialCall,\n\trequestCredential,\n} from \"../checks/probe.js\";\nexport type { Credential, ProbeSpace } from \"../checks/probe.js\";\n\ntype Did = `did:${string}:${string}`;\n\n/** Adapt a harness identity to the `Signer` surface token minting uses. */\nfunction keypairFor(identity: HarnessIdentity) {\n\treturn {\n\t\tjwtAlg: identity.jwtAlg,\n\t\tsign: (bytes: Uint8Array) => identity.sign(bytes),\n\t\tdid: () => identity.did,\n\t} as never;\n}\n\n/**\n * Mint a delegation token for `identity` against `space`, addressed (by\n * default) to the space authority's `#atproto_pds` — the space host.\n */\nexport function mintDelegation(\n\tidentity: HarnessIdentity,\n\tspace: string,\n\taudOverride?: string,\n): Promise<string> {\n\treturn createDelegationToken({\n\t\tiss: identity.did as Did,\n\t\tsub: space as never,\n\t\taud: audOverride ?? spaceHostAud(spaceAuthority(space) as Did),\n\t\tkeypair: keypairFor(identity),\n\t});\n}\n\n/**\n * The full obtain flow as a foreign user: mint a delegation token as\n * `identity` and exchange it for a credential bound to a fresh P-256 key.\n * Returns the raw result so callers can assert on refusals.\n */\nexport async function obtainCredential(\n\tctx: CheckContext,\n\tidentity: HarnessIdentity,\n\tspace: string,\n\topts: { audOverride?: string; clientAttestation?: string } = {},\n): Promise<{ result: XrpcResult; credential?: Credential }> {\n\treturn requestCredential(ctx, space, {\n\t\tdelegationToken: await mintDelegation(identity, space, opts.audOverride),\n\t\t...(opts.clientAttestation\n\t\t\t? { clientAttestation: opts.clientAttestation }\n\t\t\t: {}),\n\t});\n}\n\n/**\n * Mint a credential as the authority of `space` — a harness identity\n * playing a foreign space authority whose credentials a repo host must\n * honour for reads of its repos in that space.\n */\nexport function mintCredential(\n\tauthority: HarnessIdentity,\n\tspace: string,\n\tkeyDid: string,\n): Promise<string> {\n\treturn createSpaceCredential({\n\t\tiss: authority.did as Did,\n\t\tsub: space as never,\n\t\tkeyId: keyDid as Did,\n\t\tkeypair: keypairFor(authority),\n\t});\n}\n\n/** An inter-service auth JWT (`lxm`-scoped), signed as `identity`. */\nexport async function serviceJwt(\n\tidentity: HarnessIdentity,\n\topts: { aud: string; lxm: string; expiresInSec?: number },\n): Promise<string> {\n\tconst iat = Math.floor(Date.now() / 1000);\n\tconst header = { typ: \"JWT\", alg: identity.jwtAlg };\n\tconst payload = {\n\t\tiss: identity.did,\n\t\taud: opts.aud,\n\t\tiat,\n\t\texp: iat + (opts.expiresInSec ?? 60),\n\t\tlxm: opts.lxm,\n\t\tjti: toBase64Url(crypto.getRandomValues(new Uint8Array(16))),\n\t};\n\tconst input = `${toBase64Url(utf8(JSON.stringify(header)))}.${toBase64Url(utf8(JSON.stringify(payload)))}`;\n\tconst sig = await identity.sign(utf8(input));\n\treturn `${input}.${toBase64Url(sig)}`;\n}\n\n/** A commit as the wire JSON carries it, with `data` decoded. */\nexport function commitFromJson(value: unknown): SpaceCommit | undefined {\n\tif (!value || typeof value !== \"object\") return undefined;\n\tconst raw = value as Record<string, unknown>;\n\tconst data = lexBytes(raw.data);\n\tif (!data) return undefined;\n\treturn { ...(raw as Omit<SpaceCommit, \"data\">), data } as SpaceCommit;\n}\n\n/** What `verifyCommit` / `verifyRecord` / `verifyRepoStar` need from a MAC'd response. */\nexport function macParams(res: CredentialResult) {\n\tif (!res.keyShare || !res.sharedSecret) {\n\t\tthrow new Error(\"the response was not requested with a MAC\");\n\t}\n\treturn {\n\t\tkeyShare: res.keyShare as Did,\n\t\tsharedSecret: res.sharedSecret,\n\t\theaders: res.headers,\n\t};\n}\n\n/** Drain an async byte stream (an archive serializer) into one buffer. */\nexport async function collectBytes(\n\tchunks: AsyncIterable<Uint8Array>,\n): Promise<Uint8Array> {\n\tconst parts: Uint8Array[] = [];\n\tfor await (const chunk of chunks) parts.push(chunk);\n\tconst out = new Uint8Array(parts.reduce((n, p) => n + p.length, 0));\n\tlet offset = 0;\n\tfor (const part of parts) {\n\t\tout.set(part, offset);\n\t\toffset += part.length;\n\t}\n\treturn out;\n}\n","/**\n * The crypto-bound check catalog: the checks that genuinely need the\n * alpha libs or harness-held foreign identities, and nothing else — every\n * check an operator session can run with plain fetch + WebCrypto lives in\n * `../checks/` instead, browser included.\n *\n * What keeps a check here:\n * - verifying what a target serves — commit and record MACs, STAR\n * archives, token signatures — with the reference library;\n * - building archives (space meta, repo STARs) to import;\n * - `identities`: the harness plays a reader, a writer's PDS or a foreign\n * space authority, minting tokens the target must verify by resolving\n * that party's DID.\n *\n * Each check's metadata comes from `../descriptors.ts`, the dependency-free\n * list the browser catalog shows as \"not testable here\".\n */\n\nimport {\n\tRepoCommit,\n\treadRepoStar,\n\treadSpaceMetaStar,\n\tspaceHostAud,\n\tverifyCommit,\n\tverifyRecord,\n\tverifyRepoStarFull,\n\tverifySpaceToken,\n\twriteRepoStar,\n\twriteSpaceMetaStar,\n\ttype SpaceMetaArchive,\n} from \"@atproto/space\";\nimport { parseCid } from \"@atproto/lex-data\";\nimport { defineCheck } from \"../registry.js\";\nimport { descriptor } from \"../descriptors.js\";\nimport {\n\tasOperator,\n\toperatorFetch,\n\txrpcGet,\n\txrpcPost,\n\txrpcPostBytes,\n} from \"../http.js\";\nimport {\n\tfail,\n\tpass,\n\ttype Check,\n\ttype CheckContext,\n\ttype CheckOutcome,\n} from \"../model.js\";\nimport {\n\tbytesEqual,\n\tdecodeJwt,\n\tisTid,\n\tlexBytes,\n\ttidAt,\n\ttidNow,\n\ttoBase64,\n\tutf8,\n} from \"../encoding.js\";\nimport { resolveDidDocument, verificationMethodDidKey } from \"../did.js\";\nimport {\n\tCOMMIT_MAC_PROFILE,\n\tcreateCredentialKey,\n\tformatMacRequest,\n} from \"../space-auth.js\";\nimport {\n\tFOREIGN_DID,\n\tPOST,\n\tcreateProbeSpace,\n\tcredentialCall,\n\tcredentialGet,\n\tdeleteProbeSpace,\n\tdescribe,\n\tmanagedspace,\n\tmemberspace,\n\tmustCreateRecord,\n\tobtainPublicCredential,\n\toperatorCreateRecord,\n\tpersonalspace,\n\tprobeSkey,\n\tpublicRead,\n\tspaceRecordUri,\n\tspaceUri,\n\tunknownSpaceUri,\n\ttype Credential,\n} from \"../checks/probe.js\";\nimport { fakeDid, putMembers } from \"../checks/space.js\";\nimport { ACCOUNT_REFUSALS } from \"../checks/credential.js\";\nimport { listWriters } from \"../checks/host.js\";\nimport {\n\tcollectBytes,\n\tcommitFromJson,\n\tmacParams,\n\tmintCredential,\n\tmintDelegation,\n\tobtainCredential,\n\tserviceJwt,\n} from \"./helpers.js\";\n\ntype Did = `did:${string}:${string}`;\n\nconst crypto$ = (\n\tid: string,\n\trun: (ctx: CheckContext) => Promise<CheckOutcome>,\n): Check => defineCheck({ ...descriptor(id), run });\n\nconst errMsg = (err: unknown) =>\n\terr instanceof Error ? err.message : String(err);\n\n/**\n * A public-read space with two records and a credential for it. `fn` gets\n * the space-ref in the form the protocol fixes (`at:space/{did}/{type}/{skey}`),\n * built here rather than echoed from createSpace, so the MAC checks verify\n * the commit's and record's URIs against it, not against whatever the host\n * emitted.\n */\nasync function withPublicSpace<T>(\n\tctx: CheckContext,\n\tfn: (space: string, credential: Credential) => Promise<T>,\n): Promise<T> {\n\tconst space = await createProbeSpace(ctx, publicRead());\n\ttry {\n\t\tconst ref = spaceUri(ctx.target.did, space.skey);\n\t\tawait mustCreateRecord(ctx, ref, \"a\", \"one\");\n\t\tawait mustCreateRecord(ctx, ref, \"b\", \"two\");\n\t\treturn await fn(ref, await obtainPublicCredential(ctx, ref));\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n}\n\n// --- MAC verification ---------------------------------------------------\n\nconst macCommit = crypto$(\"mac.commit-verifies\", (ctx) =>\n\twithPublicSpace(ctx, async (space, credential) => {\n\t\t// A custom label, and a request for some other profile alongside: the\n\t\t// host must answer under the label asked for and ignore the stranger.\n\t\tconst res = await credentialCall(\n\t\t\tctx,\n\t\t\tcredential,\n\t\t\t\"com.atproto.space.getLatestCommit\",\n\t\t\t{\n\t\t\t\tparams: { space, repo: ctx.target.did },\n\t\t\t\tmac: {\n\t\t\t\t\tprofile: COMMIT_MAC_PROFILE,\n\t\t\t\t\theader: (k) =>\n\t\t\t\t\t\t`${formatMacRequest(COMMIT_MAC_PROFILE, k, { label: \"m1\" })}, other=(\"content-digest\");tag=\"someone-elses\"`,\n\t\t\t\t},\n\t\t\t},\n\t\t);\n\t\tif (res.status !== 200)\n\t\t\treturn fail(`getLatestCommit ${describe(res)}`, res.json);\n\t\tconst raw = (res.json as { commit?: Record<string, unknown> }).commit ?? {};\n\t\tconst keys = Object.keys(raw).sort().join(\",\");\n\t\tif (keys !== \"data,repo,rev,space,ver\")\n\t\t\treturn fail(\n\t\t\t\t`commit carries {${keys}}, expected exactly {data,repo,rev,space,ver}`,\n\t\t\t\traw,\n\t\t\t);\n\t\tconst commit = commitFromJson(raw);\n\t\tif (\n\t\t\t!commit ||\n\t\t\tcommit.ver !== 1 ||\n\t\t\t!isTid(commit.rev) ||\n\t\t\tcommit.data.length !== 32\n\t\t) {\n\t\t\treturn fail(\n\t\t\t\t\"commit fields malformed (ver 1, TID rev, 32-byte data)\",\n\t\t\t\traw,\n\t\t\t);\n\t\t}\n\t\tconst input = res.headers.get(\"signature-input\") ?? \"\";\n\t\tif (!/^m1=/.test(input))\n\t\t\treturn fail(`MAC not under the requested label: ${input}`);\n\t\tconst vary = (res.headers.get(\"vary\") ?? \"\").toLowerCase();\n\t\tif (\n\t\t\t!vary\n\t\t\t\t.split(\",\")\n\t\t\t\t.map((v) => v.trim())\n\t\t\t\t.includes(\"accept-signature\")\n\t\t)\n\t\t\treturn fail(`Vary does not list Accept-Signature: ${vary}`);\n\t\ttry {\n\t\t\t// `space` is the at:space/ ref built from the skey: verifyCommit\n\t\t\t// requires the commit's space, and the space the MAC header covers,\n\t\t\t// to equal it exactly — an at:// form fails here.\n\t\t\tverifyCommit(commit, {\n\t\t\t\tspace: space as never,\n\t\t\t\trepo: ctx.target.did as Did,\n\t\t\t\t...macParams(res),\n\t\t\t});\n\t\t\treturn pass(\n\t\t\t\t\"commit shape as specified; commit and MAC name the at:space/ ref; MAC verifies under the requested label; Vary lists Accept-Signature\",\n\t\t\t);\n\t\t} catch (err) {\n\t\t\treturn fail(`verifyCommit rejected the response: ${errMsg(err)}`, raw);\n\t\t}\n\t}),\n);\n\nconst macRecord = crypto$(\"mac.record-verifies\", (ctx) =>\n\twithPublicSpace(ctx, async (space, credential) => {\n\t\tconst res = await credentialGet(\n\t\t\tctx,\n\t\t\tcredential,\n\t\t\t\"com.atproto.space.getRecord\",\n\t\t\t{\n\t\t\t\tspace,\n\t\t\t\trepo: ctx.target.did,\n\t\t\t\tcollection: POST,\n\t\t\t\trkey: \"a\",\n\t\t\t},\n\t\t);\n\t\tif (res.status !== 200) return fail(`getRecord ${describe(res)}`, res.json);\n\t\tconst record = res.json as {\n\t\t\turi: string;\n\t\t\tcid: string;\n\t\t\tvalue: Record<string, unknown>;\n\t\t};\n\t\t// The record's URI in the form the protocol fixes; the response's uri\n\t\t// and the uri the MAC header covers must both be exactly this.\n\t\tconst uri = spaceRecordUri(space, ctx.target.did, POST, \"a\");\n\t\tif (record.uri !== uri)\n\t\t\treturn fail(`getRecord uri was ${record.uri}, expected ${uri}`, record);\n\t\ttry {\n\t\t\tawait verifyRecord(record as never, {\n\t\t\t\turi: uri as never,\n\t\t\t\t...macParams(res),\n\t\t\t});\n\t\t\treturn pass(\n\t\t\t\t\"record uri is the at:space/ form; MAC verifies over that uri and the cid; value encodes to cid\",\n\t\t\t);\n\t\t} catch (err) {\n\t\t\treturn fail(`verifyRecord rejected the response: ${errMsg(err)}`, record);\n\t\t}\n\t}),\n);\n\nconst oplogFolds = crypto$(\"sync.oplog-folds-to-commit\", (ctx) =>\n\twithPublicSpace(ctx, async (space, credential) => {\n\t\t// One more op that replaces a record, so the fold exercises `prev`.\n\t\tawait xrpcPost(asOperator(ctx), \"com.atproto.space.putRecord\", {\n\t\t\tspace,\n\t\t\trepo: ctx.target.did,\n\t\t\tcollection: POST,\n\t\t\trkey: \"a\",\n\t\t\trecord: { $type: POST, text: \"one, again\" },\n\t\t});\n\t\t// One op per page: every page, not just the last, carries the commit.\n\t\tconst folded = new RepoCommit();\n\t\tlet cursor: string | undefined;\n\t\tlet pages = 0;\n\t\tlet last: ReturnType<typeof commitFromJson>;\n\t\tfor (; pages < 20; pages++) {\n\t\t\tconst res = await credentialGet(\n\t\t\t\tctx,\n\t\t\t\tcredential,\n\t\t\t\t\"com.atproto.space.listRepoOps\",\n\t\t\t\t{\n\t\t\t\t\tspace,\n\t\t\t\t\trepo: ctx.target.did,\n\t\t\t\t\tlimit: \"1\",\n\t\t\t\t\tcursor,\n\t\t\t\t},\n\t\t\t);\n\t\t\tif (res.status !== 200)\n\t\t\t\treturn fail(\n\t\t\t\t\t`listRepoOps page ${pages + 1}: ${describe(res)}`,\n\t\t\t\t\tres.json,\n\t\t\t\t);\n\t\t\tconst body = res.json as {\n\t\t\t\tops: Array<{\n\t\t\t\t\tcollection: string;\n\t\t\t\t\trkey: string;\n\t\t\t\t\tcid: string | null;\n\t\t\t\t\tprev: string | null;\n\t\t\t\t}>;\n\t\t\t\tcommit?: unknown;\n\t\t\t\tcursor?: string;\n\t\t\t};\n\t\t\tlast = commitFromJson(body.commit);\n\t\t\tif (!last) return fail(`page ${pages + 1} carried no commit`, body);\n\t\t\ttry {\n\t\t\t\tverifyCommit(last, {\n\t\t\t\t\tspace: space as never,\n\t\t\t\t\trepo: ctx.target.did as Did,\n\t\t\t\t\t...macParams(res),\n\t\t\t\t});\n\t\t\t} catch (err) {\n\t\t\t\treturn fail(\n\t\t\t\t\t`page ${pages + 1}'s commit MAC does not verify: ${errMsg(err)}`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tfolded.applyOps(\n\t\t\t\tbody.ops.map((op) => ({\n\t\t\t\t\tcollection: op.collection,\n\t\t\t\t\trkey: op.rkey,\n\t\t\t\t\tcid: op.cid ? parseCid(op.cid) : null,\n\t\t\t\t\tprev: op.prev ? parseCid(op.prev) : null,\n\t\t\t\t})) as never,\n\t\t\t);\n\t\t\tcursor = body.cursor;\n\t\t\tif (!cursor) break;\n\t\t}\n\t\tif (pages < 2) return fail(\"three ops at limit=1 did not paginate\");\n\t\treturn folded.matches(last!)\n\t\t\t? pass(\n\t\t\t\t\t`${pages + 1} pages, each with a MAC-verified commit; the ops fold to its data`,\n\t\t\t\t)\n\t\t\t: fail(\"the folded oplog does not match the commit data\");\n\t}),\n);\n\nconst getRepoStar = crypto$(\"sync.getrepo-star\", (ctx) =>\n\twithPublicSpace(ctx, async (space, credential) => {\n\t\tconst res = await credentialGet(\n\t\t\tctx,\n\t\t\tcredential,\n\t\t\t\"com.atproto.space.getRepo\",\n\t\t\t{ space, repo: ctx.target.did },\n\t\t);\n\t\tif (res.status !== 200) return fail(`getRepo ${describe(res)}`, res.json);\n\t\tconst type = res.headers.get(\"Content-Type\") ?? \"\";\n\t\tif (!type.includes(\"application/vnd.dasl.star\"))\n\t\t\treturn fail(`getRepo content-type was ${type}`);\n\t\tconst bytes = new Uint8Array(await res.response.arrayBuffer());\n\t\ttry {\n\t\t\tconst { records } = await verifyRepoStarFull([bytes], {\n\t\t\t\tspace: space as never,\n\t\t\t\trepo: ctx.target.did as Did,\n\t\t\t\t...macParams(res),\n\t\t\t});\n\t\t\tconst rkeys = records.map((r) => `${r.collection}/${r.rkey}`).sort();\n\t\t\treturn rkeys.join(\",\") === `${POST}/a,${POST}/b`\n\t\t\t\t? pass(\"STAR archive verified against its MAC; both records present\")\n\t\t\t\t: fail(`archive verified but held ${rkeys.join(\", \") || \"no records\"}`);\n\t\t} catch (err) {\n\t\t\treturn fail(`verifyRepoStarFull rejected the archive: ${errMsg(err)}`);\n\t\t}\n\t}),\n);\n\n// --- token signatures -------------------------------------------------\n\nasync function atprotoKey(ctx: CheckContext, did: string): Promise<string> {\n\tconst key = verificationMethodDidKey(\n\t\tawait resolveDidDocument(ctx, did),\n\t\t\"atproto\",\n\t);\n\tif (!key) throw new Error(`${did} publishes no #atproto key`);\n\treturn key;\n}\n\nconst credentialSigned = crypto$(\n\t\"credential.signed-by-authority\",\n\tasync (ctx) => {\n\t\tconst space = await createProbeSpace(ctx, publicRead());\n\t\ttry {\n\t\t\tconst credential = await obtainPublicCredential(ctx, space.uri);\n\t\t\ttry {\n\t\t\t\tawait verifySpaceToken(\"credential\", credential.credential, {\n\t\t\t\t\tgetSigningKey: (iss) => atprotoKey(ctx, iss),\n\t\t\t\t\tsub: space.uri,\n\t\t\t\t});\n\t\t\t\treturn pass(\"verifies against the authority's #atproto key\");\n\t\t\t} catch (err) {\n\t\t\t\treturn fail(`credential did not verify: ${errMsg(err)}`);\n\t\t\t}\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\nconst delegationSigned = crypto$(\"delegation.signed-by-user\", async (ctx) => {\n\tconst space = await createProbeSpace(ctx, memberspace());\n\ttry {\n\t\tconst res = await xrpcGet(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.getDelegationToken\",\n\t\t\t{ space: space.uri },\n\t\t);\n\t\tif (res.status !== 200)\n\t\t\treturn fail(`getDelegationToken ${describe(res)}`, res.json);\n\t\ttry {\n\t\t\tawait verifySpaceToken(\n\t\t\t\t\"delegation\",\n\t\t\t\t(res.json as { token: string }).token,\n\t\t\t\t{\n\t\t\t\t\tgetSigningKey: (iss) => atprotoKey(ctx, iss),\n\t\t\t\t\taud: spaceHostAud(ctx.target.did as Did),\n\t\t\t\t\tsub: space.uri,\n\t\t\t\t},\n\t\t\t);\n\t\t\treturn pass(\"verifies against the user's #atproto key\");\n\t\t} catch (err) {\n\t\t\treturn fail(`delegation token did not verify: ${errMsg(err)}`);\n\t\t}\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n});\n\n// --- migration ----------------------------------------------------------\n\nasync function exportMeta(ctx: CheckContext, space: string) {\n\tconst res = await operatorFetch(ctx)(\n\t\t`${ctx.target.origin}/xrpc/com.atproto.space.exportSpaceMeta?space=${encodeURIComponent(space)}`,\n\t);\n\tif (res.status !== 200)\n\t\tthrow new Error(\n\t\t\t`exportSpaceMeta ${res.status} ${await res.text().catch(() => \"\")}`,\n\t\t);\n\treturn {\n\t\ttype: res.headers.get(\"Content-Type\") ?? \"\",\n\t\tarchive: await readSpaceMetaStar([new Uint8Array(await res.arrayBuffer())]),\n\t};\n}\n\nconst importMeta = async (ctx: CheckContext, archive: SpaceMetaArchive) =>\n\txrpcPostBytes(\n\t\tasOperator(ctx),\n\t\t\"com.atproto.space.importSpaceMeta\",\n\t\tawait collectBytes(writeSpaceMetaStar(archive)),\n\t);\n\nconst memberKey = (did: string) => `com.atproto.memberspace.member/${did}`;\n\nconst exportSpaceMeta = crypto$(\"migration.export-space-meta\", async (ctx) => {\n\tconst space = await createProbeSpace(ctx, memberspace({ publicWrite: true }));\n\tconst member = fakeDid();\n\ttry {\n\t\tawait putMembers(ctx, space.uri, [\n\t\t\t{ did: member, read: true, write: false },\n\t\t]);\n\t\tawait mustCreateRecord(ctx, space.uri, \"a\");\n\t\tconst { type, archive } = await exportMeta(ctx, space.uri);\n\t\tconst problems: string[] = [];\n\t\tif (!type.includes(\"application/vnd.dasl.star\"))\n\t\t\tproblems.push(`content-type ${type}`);\n\t\tif (archive.space !== space.uri) problems.push(`space ${archive.space}`);\n\t\tif (archive.policy.$type !== \"com.atproto.memberspace.policy\")\n\t\t\tproblems.push(`policy ${String(archive.policy.$type)}`);\n\t\tconst entry = archive.policyState.find((e) => e.key === memberKey(member));\n\t\tif (!entry || entry.value.read !== true || entry.value.write !== false)\n\t\t\tproblems.push(\"member entry missing or wrong\");\n\t\tconst writer = archive.writers.find((w) => w.did === ctx.target.did);\n\t\tif (!writer || !isTid(writer.repoRev))\n\t\t\tproblems.push(\"the authority is not in the writer set with a repoRev\");\n\t\tif (problems.length) return fail(problems.join(\"; \"), archive);\n\t\t// A removed writer is left out of the archive.\n\t\tawait xrpcPost(asOperator(ctx), \"com.atproto.space.removeWriter\", {\n\t\t\tspace: space.uri,\n\t\t\trepo: ctx.target.did,\n\t\t});\n\t\tconst after = await exportMeta(ctx, space.uri);\n\t\treturn after.archive.writers.some((w) => w.did === ctx.target.did)\n\t\t\t? fail(\"a removed writer is still in the exported writer set\")\n\t\t\t: pass(\n\t\t\t\t\t\"archive carries the policy, the member and live writers with repoRev; removed writers are left out\",\n\t\t\t\t);\n\t} catch (err) {\n\t\treturn fail(errMsg(err));\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n});\n\nconst importSpaceMeta = crypto$(\"migration.import-space-meta\", async (ctx) => {\n\tconst space = await createProbeSpace(ctx, memberspace());\n\tconst before = fakeDid();\n\tconst after = fakeDid();\n\ttry {\n\t\tawait putMembers(ctx, space.uri, [\n\t\t\t{ did: before, read: true, write: true },\n\t\t]);\n\t\tconst { archive } = await exportMeta(ctx, space.uri);\n\t\t// Import a changed configuration over the space: it replaces, not merges.\n\t\tconst imported = await importMeta(ctx, {\n\t\t\t...archive,\n\t\t\tpolicy: { $type: \"com.atproto.memberspace.policy\", publicRead: true },\n\t\t\tpolicyState: [\n\t\t\t\t{\n\t\t\t\t\tkey: memberKey(after),\n\t\t\t\t\tvalue: {\n\t\t\t\t\t\t$type: \"com.atproto.memberspace.member\",\n\t\t\t\t\t\tread: true,\n\t\t\t\t\t\twrite: false,\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t});\n\t\tif (imported.status !== 200)\n\t\t\treturn fail(`importSpaceMeta ${describe(imported)}`, imported.json);\n\t\tconst got = await xrpcGet(asOperator(ctx), \"com.atproto.space.getSpace\", {\n\t\t\tspace: space.uri,\n\t\t});\n\t\tconst policy = (\n\t\t\tgot.json as { policy?: { publicRead?: boolean } } | undefined\n\t\t)?.policy;\n\t\tconst list = await xrpcGet(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.memberspace.listMembers\",\n\t\t\t{ space: space.uri },\n\t\t);\n\t\tconst dids = (\n\t\t\t(list.json as { members?: Array<{ did: string }> } | undefined)\n\t\t\t\t?.members ?? []\n\t\t).map((m) => m.did);\n\t\tif (policy?.publicRead !== true)\n\t\t\treturn fail(\"getSpace does not reflect the imported policy\", got.json);\n\t\treturn dids.includes(after) && !dids.includes(before)\n\t\t\t? pass(\"imported policy and member list replaced the old ones\")\n\t\t\t: fail(`members after import: ${dids.join(\", \") || \"none\"}`, list.json);\n\t} catch (err) {\n\t\treturn fail(errMsg(err));\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n});\n\nconst importMetaNotAuthority = crypto$(\n\t\"migration.import-space-meta-not-authority\",\n\tasync (ctx) => {\n\t\tconst res = await importMeta(ctx, {\n\t\t\tspace: unknownSpaceUri(FOREIGN_DID) as never,\n\t\t\tpolicy: { $type: \"com.atproto.personalspace.policy\" },\n\t\t\tpolicyState: [],\n\t\t\twriters: [],\n\t\t});\n\t\treturn res.error === \"NotAuthorized\"\n\t\t\t? pass(\"answered NotAuthorized\")\n\t\t\t: fail(`answered ${describe(res)}, expected NotAuthorized`, res.json);\n\t},\n);\n\nconst importMetaUnsupported = crypto$(\n\t\"migration.import-space-meta-unsupported-policy\",\n\tasync (ctx) => {\n\t\tconst space = unknownSpaceUri(ctx.target.did);\n\t\tconst res = await importMeta(ctx, {\n\t\t\tspace: space as never,\n\t\t\tpolicy: { $type: \"com.example.mysteryPolicy\" },\n\t\t\tpolicyState: [],\n\t\t\twriters: [],\n\t\t});\n\t\tif (res.status === 200) await deleteProbeSpace(ctx, space);\n\t\treturn res.error === \"UnsupportedPolicy\"\n\t\t\t? pass(\"answered UnsupportedPolicy\")\n\t\t\t: fail(`answered ${describe(res)}, expected UnsupportedPolicy`, res.json);\n\t},\n);\n\nconst importMetaInvalid = crypto$(\n\t\"migration.import-space-meta-invalid\",\n\tasync (ctx) => {\n\t\tconst res = await xrpcPostBytes(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.importSpaceMeta\",\n\t\t\tutf8(\"not a STAR archive\"),\n\t\t);\n\t\treturn res.error === \"InvalidSpaceMeta\"\n\t\t\t? pass(\"answered InvalidSpaceMeta\")\n\t\t\t: fail(`answered ${describe(res)}, expected InvalidSpaceMeta`, res.json);\n\t},\n);\n\nasync function ownRepoArchive(\n\tctx: CheckContext,\n\tspace: string,\n): Promise<Uint8Array> {\n\tconst res = await operatorFetch(ctx)(\n\t\t`${ctx.target.origin}/xrpc/com.atproto.space.getRepo?space=${encodeURIComponent(space)}&repo=${encodeURIComponent(ctx.target.did)}`,\n\t);\n\tif (res.status !== 200) throw new Error(`getRepo ${res.status}`);\n\treturn new Uint8Array(await res.arrayBuffer());\n}\n\nconst importRepo = crypto$(\"migration.import-repo\", async (ctx) => {\n\tconst space = await createProbeSpace(ctx, personalspace());\n\ttry {\n\t\tawait mustCreateRecord(ctx, space.uri, \"a\", \"one\");\n\t\tawait mustCreateRecord(ctx, space.uri, \"b\", \"two\");\n\t\tconst bytes = await ownRepoArchive(ctx, space.uri);\n\t\tconst exported = await readRepoStar([bytes]);\n\t\tconst commit = exported.commit;\n\t\tawait exported[Symbol.asyncDispose]();\n\t\t// Change the repo after export, so the import visibly replaces it.\n\t\tawait mustCreateRecord(ctx, space.uri, \"c\", \"three\");\n\t\t// The lexicon's input encoding is application/vnd.dasl.star.\n\t\tconst wrongType = await xrpcPostBytes(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.importRepo\",\n\t\t\tbytes,\n\t\t\tundefined,\n\t\t\t\"application/octet-stream\",\n\t\t);\n\t\tif (wrongType.status === 200)\n\t\t\treturn fail(\"importRepo accepted an application/octet-stream body\");\n\t\tconst res = await xrpcPostBytes(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.importRepo\",\n\t\t\tbytes,\n\t\t);\n\t\tif (res.status !== 200)\n\t\t\treturn fail(`importRepo ${describe(res)}`, res.json);\n\t\tconst list = await xrpcGet(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.listRecords\",\n\t\t\t{ space: space.uri, repo: ctx.target.did },\n\t\t);\n\t\tconst rkeys = (\n\t\t\t(list.json as { records?: Array<{ rkey: string }> } | undefined)\n\t\t\t\t?.records ?? []\n\t\t)\n\t\t\t.map((r) => r.rkey)\n\t\t\t.sort();\n\t\tif (rkeys.join(\",\") !== \"a,b\")\n\t\t\treturn fail(`records after import: ${rkeys.join(\",\")}`, list.json);\n\t\tconst latest = await xrpcGet(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.getLatestCommit\",\n\t\t\t{ space: space.uri, repo: ctx.target.did },\n\t\t);\n\t\tconst now = commitFromJson(\n\t\t\t(latest.json as { commit?: unknown } | undefined)?.commit,\n\t\t);\n\t\tif (!now)\n\t\t\treturn fail(\n\t\t\t\t`getLatestCommit after import ${describe(latest)}`,\n\t\t\t\tlatest.json,\n\t\t\t);\n\t\tif (!bytesEqual(now.data, commit.data))\n\t\t\treturn fail(\"commit data changed across the import\");\n\t\treturn now.rev > commit.rev\n\t\t\t? pass(\n\t\t\t\t\t\"refused octet-stream; records replaced from the archive; same data, new rev\",\n\t\t\t\t)\n\t\t\t: fail(`rev ${now.rev} did not advance past the archive's ${commit.rev}`);\n\t} catch (err) {\n\t\treturn fail(errMsg(err));\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n});\n\nconst emptyRepoArchive = (space: string, repo: string) =>\n\tcollectBytes(\n\t\twriteRepoStar(\n\t\t\tnew RepoCommit().toCommit({\n\t\t\t\tspace: space as never,\n\t\t\t\trepo: repo as Did,\n\t\t\t\trev: tidNow() as never,\n\t\t\t}),\n\t\t\t[],\n\t\t),\n\t);\n\nconst importRepoNotFound = crypto$(\n\t\"migration.import-repo-space-not-found\",\n\tasync (ctx) => {\n\t\t// A well-formed archive of an empty repo in an own space this host has\n\t\t// never heard of: the authority's space must be imported first.\n\t\tconst space = spaceUri(ctx.target.did, probeSkey());\n\t\tconst res = await xrpcPostBytes(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.importRepo\",\n\t\t\tawait emptyRepoArchive(space, ctx.target.did),\n\t\t);\n\t\tif (res.status === 200) await deleteProbeSpace(ctx, space);\n\t\treturn res.error === \"SpaceNotFound\"\n\t\t\t? pass(\"answered SpaceNotFound\")\n\t\t\t: fail(`answered ${describe(res)}, expected SpaceNotFound`, res.json);\n\t},\n);\n\nconst importRepoInvalid = crypto$(\n\t\"migration.import-repo-invalid\",\n\tasync (ctx) => {\n\t\tconst res = await xrpcPostBytes(\n\t\t\tasOperator(ctx),\n\t\t\t\"com.atproto.space.importRepo\",\n\t\t\tutf8(\"not a STAR archive\"),\n\t\t);\n\t\treturn res.error === \"InvalidRepoFile\"\n\t\t\t? pass(\"answered InvalidRepoFile\")\n\t\t\t: fail(`answered ${describe(res)}, expected InvalidRepoFile`, res.json);\n\t},\n);\n\nconst importRepoMismatch = crypto$(\n\t\"migration.import-repo-mismatch\",\n\tasync (ctx) => {\n\t\tconst space = await createProbeSpace(ctx, personalspace());\n\t\ttry {\n\t\t\tconst res = await xrpcPostBytes(\n\t\t\t\tasOperator(ctx),\n\t\t\t\t\"com.atproto.space.importRepo\",\n\t\t\t\tawait emptyRepoArchive(space.uri, fakeDid()),\n\t\t\t);\n\t\t\treturn res.error === \"RepoMismatch\"\n\t\t\t\t? pass(\"answered RepoMismatch\")\n\t\t\t\t: fail(`answered ${describe(res)}, expected RepoMismatch`, res.json);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\n// --- foreign identities --------------------------------------------------\n\nconst isAccountRefusal = (error?: string) =>\n\terror !== undefined && ACCOUNT_REFUSALS.includes(error);\n\nconst memberGate = crypto$(\"credential.member-gate\", async (ctx) => {\n\tconst reader = await ctx.identities!.identity(\"reader\");\n\tconst space = await createProbeSpace(ctx, memberspace());\n\tconst put = (read: boolean) =>\n\t\tputMembers(ctx, space.uri, [{ did: reader.did, read, write: false }]);\n\ttry {\n\t\tawait mustCreateRecord(ctx, space.uri, \"shared\", \"members only\");\n\t\tconst stranger = await obtainCredential(ctx, reader, space.uri);\n\t\tif (stranger.credential) return fail(\"a non-member obtained a credential\");\n\t\tif (!isAccountRefusal(stranger.result.error)) {\n\t\t\treturn fail(\n\t\t\t\t`non-member refused with ${describe(stranger.result)}; expected ${ACCOUNT_REFUSALS.join(\" / \")}`,\n\t\t\t);\n\t\t}\n\t\tawait put(false);\n\t\tconst writeOnly = await obtainCredential(ctx, reader, space.uri);\n\t\tif (writeOnly.credential)\n\t\t\treturn fail(\"a member with read: false obtained a credential\");\n\t\tawait put(true);\n\t\tconst member = await obtainCredential(ctx, reader, space.uri);\n\t\tif (!member.credential)\n\t\t\treturn fail(\n\t\t\t\t`a reader was refused: ${describe(member.result)}`,\n\t\t\t\tmember.result.json,\n\t\t\t);\n\t\tconst read = await credentialGet(\n\t\t\tctx,\n\t\t\tmember.credential,\n\t\t\t\"com.atproto.space.getRecord\",\n\t\t\t{\n\t\t\t\tspace: space.uri,\n\t\t\t\trepo: ctx.target.did,\n\t\t\t\tcollection: POST,\n\t\t\t\trkey: \"shared\",\n\t\t\t},\n\t\t);\n\t\treturn read.status === 200\n\t\t\t? pass(\n\t\t\t\t\t`non-member refused (${stranger.result.error}), read:false refused, reader admitted and read`,\n\t\t\t\t)\n\t\t\t: fail(\n\t\t\t\t\t`the reader's credential could not read: ${describe(read)}`,\n\t\t\t\t\tread.json,\n\t\t\t\t);\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n});\n\nconst personalOnly = crypto$(\"policy.personalspace-owner-only\", async (ctx) => {\n\tconst reader = await ctx.identities!.identity(\"reader\");\n\tconst space = await createProbeSpace(ctx, personalspace());\n\ttry {\n\t\tconst res = await obtainCredential(ctx, reader, space.uri);\n\t\tif (res.credential)\n\t\t\treturn fail(\"a personalspace issued a credential to another account\");\n\t\t// The authority's own admission is policy.personalspace-owner-admitted:\n\t\t// a harness identity cannot be the authority, the target's own\n\t\t// delegation tokens can.\n\t\treturn isAccountRefusal(res.result.error)\n\t\t\t? pass(\n\t\t\t\t\t`refused another account with ${res.result.error} (the authority's admission is policy.personalspace-owner-admitted)`,\n\t\t\t\t)\n\t\t\t: fail(\n\t\t\t\t\t`refused with ${describe(res.result)}; expected ${ACCOUNT_REFUSALS.join(\" / \")}`,\n\t\t\t\t);\n\t} finally {\n\t\tawait deleteProbeSpace(ctx, space.uri);\n\t}\n});\n\nconst delegationWrongAud = crypto$(\n\t\"delegation.wrong-audience-refused\",\n\tasync (ctx) => {\n\t\tconst reader = await ctx.identities!.identity(\"reader\");\n\t\tconst space = await createProbeSpace(ctx, memberspace());\n\t\ttry {\n\t\t\tawait putMembers(ctx, space.uri, [\n\t\t\t\t{ did: reader.did, read: true, write: false },\n\t\t\t]);\n\t\t\t// Positive control: with the right audience the reader is admitted.\n\t\t\tconst control = await obtainCredential(ctx, reader, space.uri);\n\t\t\tif (!control.credential)\n\t\t\t\treturn fail(\n\t\t\t\t\t`correct-aud control failed (${describe(control.result)}); cannot attribute the wrong-aud refusal`,\n\t\t\t\t);\n\t\t\tconst { result, credential } = await obtainCredential(\n\t\t\t\tctx,\n\t\t\t\treader,\n\t\t\t\tspace.uri,\n\t\t\t\t{ audOverride: `${FOREIGN_DID}#atproto_pds` },\n\t\t\t);\n\t\t\tif (credential)\n\t\t\t\treturn fail(\"a token addressed to another host was accepted\");\n\t\t\treturn result.error === \"InvalidDelegationToken\"\n\t\t\t\t? pass(\"refused with InvalidDelegationToken\")\n\t\t\t\t: fail(\n\t\t\t\t\t\t`refused with ${describe(result)}, expected InvalidDelegationToken`,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\nasync function notifyRepoUpdate(\n\tctx: CheckContext,\n\twriter: {\n\t\tdid: string;\n\t\tjwtAlg: string;\n\t\tsign(b: Uint8Array): Promise<Uint8Array>;\n\t},\n\tspace: string,\n\trepoRev: string,\n\tdata: Uint8Array,\n) {\n\tconst jwt = await serviceJwt(writer, {\n\t\taud: spaceHostAud(ctx.target.did as Did),\n\t\tlxm: \"com.atproto.space.notifyRepoUpdate\",\n\t});\n\treturn xrpcPost(\n\t\tctx,\n\t\t\"com.atproto.space.notifyRepoUpdate\",\n\t\t{\n\t\t\tspace,\n\t\t\trepo: writer.did,\n\t\t\trepoRev,\n\t\t\tdata: { $bytes: toBase64(data).replace(/=+$/, \"\") },\n\t\t},\n\t\t{ Authorization: `Bearer ${jwt}` },\n\t);\n}\n\nconst notifyAccepted = crypto$(\n\t\"host.notifyrepoupdate-accepted\",\n\tasync (ctx) => {\n\t\tconst writer = await ctx.identities!.identity(\"writer\");\n\t\tconst space = await createProbeSpace(\n\t\t\tctx,\n\t\t\tmemberspace({ publicRead: true }),\n\t\t);\n\t\ttry {\n\t\t\tawait putMembers(ctx, space.uri, [\n\t\t\t\t{ did: writer.did, read: false, write: true },\n\t\t\t]);\n\t\t\tconst repoRev = tidNow();\n\t\t\tconst data = globalThis.crypto.getRandomValues(new Uint8Array(32));\n\t\t\tconst res = await notifyRepoUpdate(ctx, writer, space.uri, repoRev, data);\n\t\t\tif (res.status !== 200)\n\t\t\t\treturn fail(`notifyRepoUpdate ${describe(res)}`, res.json);\n\t\t\tconst { repos } = await listWriters(\n\t\t\t\tctx,\n\t\t\t\tawait obtainPublicCredential(ctx, space.uri),\n\t\t\t);\n\t\t\tconst entry = repos.find((r) => r.repo === writer.did);\n\t\t\tif (!entry) return fail(\"the notified writer is not in listWriters\");\n\t\t\tconst listed = lexBytes(entry.data);\n\t\t\treturn entry.$type === \"com.atproto.space.defs#repoWrite\" &&\n\t\t\t\tentry.repoRev === repoRev &&\n\t\t\t\tlisted &&\n\t\t\t\tbytesEqual(listed, data)\n\t\t\t\t? pass(\"accepted; listWriters reports the notified repoRev and data\")\n\t\t\t\t: fail(\"listWriters entry does not match the notification\", entry);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\nconst notifyFuture = crypto$(\n\t\"host.notifyrepoupdate-future-rev\",\n\tasync (ctx) => {\n\t\tconst writer = await ctx.identities!.identity(\"writer\");\n\t\tconst space = await createProbeSpace(\n\t\t\tctx,\n\t\t\tmemberspace({ publicWrite: true }),\n\t\t);\n\t\ttry {\n\t\t\tconst hourAhead = BigInt(Date.now() + 60 * 60 * 1000) * 1000n;\n\t\t\tconst res = await notifyRepoUpdate(\n\t\t\t\tctx,\n\t\t\t\twriter,\n\t\t\t\tspace.uri,\n\t\t\t\ttidAt(hourAhead),\n\t\t\t\tnew Uint8Array(32),\n\t\t\t);\n\t\t\treturn res.error === \"FutureRev\"\n\t\t\t\t? pass(\"a repoRev an hour ahead answered FutureRev\")\n\t\t\t\t: fail(`answered ${describe(res)}, expected FutureRev`, res.json);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\nconst notifyUnknown = crypto$(\n\t\"host.notifyrepoupdate-unknown-space\",\n\tasync (ctx) => {\n\t\tconst writer = await ctx.identities!.identity(\"writer\");\n\t\tconst res = await notifyRepoUpdate(\n\t\t\tctx,\n\t\t\twriter,\n\t\t\tunknownSpaceUri(ctx.target.did),\n\t\t\ttidNow(),\n\t\t\tnew Uint8Array(32),\n\t\t);\n\t\treturn res.error === \"SpaceNotFound\"\n\t\t\t? pass(\"answered SpaceNotFound\")\n\t\t\t: fail(`answered ${describe(res)}, expected SpaceNotFound`, res.json);\n\t},\n);\n\nconst writeRevocation = crypto$(\n\t\"memberspace.write-revocation-removes-writer\",\n\tasync (ctx) => {\n\t\tconst writer = await ctx.identities!.identity(\"writer\");\n\t\tconst space = await createProbeSpace(\n\t\t\tctx,\n\t\t\tmemberspace({ publicRead: true, publicWrite: true }),\n\t\t);\n\t\ttry {\n\t\t\tawait putMembers(ctx, space.uri, [\n\t\t\t\t{ did: writer.did, read: true, write: true },\n\t\t\t]);\n\t\t\tconst first = await notifyRepoUpdate(\n\t\t\t\tctx,\n\t\t\t\twriter,\n\t\t\t\tspace.uri,\n\t\t\t\ttidNow(),\n\t\t\t\tnew Uint8Array(32),\n\t\t\t);\n\t\t\tif (first.status !== 200)\n\t\t\t\treturn fail(`notifyRepoUpdate ${describe(first)}`, first.json);\n\t\t\tconst credential = await obtainPublicCredential(ctx, space.uri);\n\t\t\tconst entry = async () =>\n\t\t\t\t(await listWriters(ctx, credential)).repos\n\t\t\t\t\t.filter((r) => r.repo === writer.did)\n\t\t\t\t\t.at(-1);\n\t\t\tif ((await entry())?.$type !== \"com.atproto.space.defs#repoWrite\")\n\t\t\t\treturn fail(\"the writer never entered the writer set\");\n\t\t\t// Revoking write access removes it, announced as repoRemoved...\n\t\t\tawait putMembers(ctx, space.uri, [\n\t\t\t\t{ did: writer.did, read: true, write: false },\n\t\t\t]);\n\t\t\tconst removed = await entry();\n\t\t\tif (removed?.$type !== \"com.atproto.space.defs#repoRemoved\")\n\t\t\t\treturn fail(\n\t\t\t\t\t`after revoking write, the entry is ${JSON.stringify(removed)}`,\n\t\t\t\t);\n\t\t\t// ...and, even under publicWrite, a member without write is not tracked.\n\t\t\tconst again = await notifyRepoUpdate(\n\t\t\t\tctx,\n\t\t\t\twriter,\n\t\t\t\tspace.uri,\n\t\t\t\ttidNow(),\n\t\t\t\tnew Uint8Array(32),\n\t\t\t);\n\t\t\tconst after = await entry();\n\t\t\treturn after?.$type === \"com.atproto.space.defs#repoRemoved\"\n\t\t\t\t? pass(\n\t\t\t\t\t\t`removed as repoRemoved; a later notification was not tracked (${describe(again)})`,\n\t\t\t\t\t)\n\t\t\t\t: fail(\n\t\t\t\t\t\t\"a member without write access was tracked again under publicWrite\",\n\t\t\t\t\t\tafter,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\n/**\n * The revocation flow: a harness identity plays a foreign space authority,\n * the operator writes into that space (as a member's PDS would), and the\n * authority's credential reads the operator's repo — until revoked.\n */\nasync function revocationFlow(\n\tctx: CheckContext,\n\trevoker: \"authority\" | \"stranger\",\n): Promise<{\n\tdetail?: string;\n\trevoke?: { status: number; error?: string };\n\tafter?: { status: number; error?: string };\n}> {\n\tconst authority = await ctx.identities!.identity(\"authority\");\n\tconst space = spaceUri(authority.did, probeSkey());\n\tconst write = await operatorCreateRecord(ctx, space, POST, \"shared\", {\n\t\t$type: POST,\n\t\ttext: \"for the authority\",\n\t});\n\tif (write.status !== 200)\n\t\treturn {\n\t\t\tdetail: `operator write into a foreign space: ${describe(write)}`,\n\t\t};\n\tconst key = await createCredentialKey();\n\tconst credential: Credential = {\n\t\tcredential: await mintCredential(authority, space, key.did),\n\t\tkey,\n\t\tspace,\n\t};\n\tconst read = () =>\n\t\tcredentialGet(ctx, credential, \"com.atproto.space.getRecord\", {\n\t\t\tspace,\n\t\t\trepo: ctx.target.did,\n\t\t\tcollection: POST,\n\t\t\trkey: \"shared\",\n\t\t});\n\tconst before = await read();\n\tif (before.status !== 200)\n\t\treturn {\n\t\t\tdetail: `foreign authority's credential could not read: ${describe(before)}`,\n\t\t};\n\tconst signer =\n\t\trevoker === \"authority\"\n\t\t\t? authority\n\t\t\t: await ctx.identities!.identity(\"stranger\");\n\tconst jwt = await serviceJwt(signer, {\n\t\taud: ctx.target.did,\n\t\tlxm: \"com.atproto.space.notifyCredentialsRevoked\",\n\t});\n\tconst revoke = await xrpcPost(\n\t\tctx,\n\t\t\"com.atproto.space.notifyCredentialsRevoked\",\n\t\t{ space, credentials: [decodeJwt(credential.credential).payload.jti] },\n\t\t{ Authorization: `Bearer ${jwt}` },\n\t);\n\treturn { revoke, after: await read() };\n}\n\nconst revocationRefused = crypto$(\n\t\"revocation.revoked-credential-refused\",\n\tasync (ctx) => {\n\t\tconst flow = await revocationFlow(ctx, \"authority\");\n\t\tif (flow.detail) return fail(flow.detail);\n\t\tif (flow.revoke!.status !== 200)\n\t\t\treturn fail(\n\t\t\t\t`notifyCredentialsRevoked ${flow.revoke!.status} ${flow.revoke!.error ?? \"\"}`,\n\t\t\t);\n\t\treturn flow.after!.status >= 400 && flow.after!.status < 500\n\t\t\t? pass(\n\t\t\t\t\t`foreign credential read 200; after revocation refused (${flow.after!.status} ${flow.after!.error ?? \"\"})`,\n\t\t\t\t)\n\t\t\t: fail(`a revoked credential still read (${flow.after!.status})`);\n\t},\n);\n\nconst revocationName = crypto$(\"revocation.error-name\", async (ctx) => {\n\tconst flow = await revocationFlow(ctx, \"authority\");\n\tif (flow.detail) return fail(flow.detail);\n\treturn flow.after!.error === \"CredentialRevoked\"\n\t\t? pass(\"refused with CredentialRevoked\")\n\t\t: fail(`refused with ${flow.after!.status} ${flow.after!.error ?? \"\"}`);\n});\n\nconst revocationStranger = crypto$(\n\t\"revocation.non-authority-refused\",\n\tasync (ctx) => {\n\t\tconst flow = await revocationFlow(ctx, \"stranger\");\n\t\tif (flow.detail) return fail(flow.detail);\n\t\tif (flow.revoke!.status === 200)\n\t\t\treturn fail(\n\t\t\t\t\"accepted a revocation signed by someone other than the authority\",\n\t\t\t);\n\t\t// The method declares no error: the refusal is of the caller's\n\t\t// authority, an auth refusal — not a 5xx or a malformed-input 400.\n\t\tif (flow.revoke!.status !== 401 && flow.revoke!.status !== 403)\n\t\t\treturn fail(\n\t\t\t\t`refused the stranger's revocation with ${flow.revoke!.status} ${flow.revoke!.error ?? \"\"}, expected 401/403`,\n\t\t\t);\n\t\treturn flow.after!.status === 200\n\t\t\t? pass(\n\t\t\t\t\t`stranger's revocation refused (${flow.revoke!.status} ${flow.revoke!.error ?? \"\"}); credential still reads`,\n\t\t\t\t)\n\t\t\t: fail(\n\t\t\t\t\t`the revocation was refused but the credential stopped working (${flow.after!.status})`,\n\t\t\t\t);\n\t},\n);\n\nconst managedAccount = crypto$(\n\t\"managedspace.check-access-account\",\n\tasync (ctx) => {\n\t\tconst inbox = ctx.syncerInbox!;\n\t\tconst reader = await ctx.identities!.identity(\"reader\");\n\t\tconst lxm = \"com.atproto.managedspace.checkAccess\";\n\t\tlet answer = { read: false, write: false };\n\t\tinbox.respond(lxm, () => answer);\n\t\tconst space = await createProbeSpace(ctx, managedspace(inbox.service));\n\t\ttry {\n\t\t\tconst since = Date.now();\n\t\t\tconst denied = await obtainCredential(ctx, reader, space.uri);\n\t\t\tif (denied.credential)\n\t\t\t\treturn fail(\"issued a credential the managing app refused\");\n\t\t\tconst asked = await inbox.waitFor(\n\t\t\t\t(d) =>\n\t\t\t\t\td.lxm === lxm &&\n\t\t\t\t\td.receivedAt >= since &&\n\t\t\t\t\td.params?.repo === reader.did,\n\t\t\t\t5_000,\n\t\t\t);\n\t\t\tif (!asked)\n\t\t\t\treturn fail(\n\t\t\t\t\t`the managing app was never asked about the reader (${describe(denied.result)})`,\n\t\t\t\t);\n\t\t\tconst p = asked.params ?? {};\n\t\t\tif (p.space !== space.uri || \"access\" in p)\n\t\t\t\treturn fail(\"checkAccess carried the wrong params\", p);\n\t\t\tanswer = { read: true, write: false };\n\t\t\tconst allowed = await obtainCredential(ctx, reader, space.uri);\n\t\t\treturn allowed.credential\n\t\t\t\t? pass(\n\t\t\t\t\t\t`asked about the reader (space, repo); refused on read:false (${denied.result.error}), issued on read:true`,\n\t\t\t\t\t)\n\t\t\t\t: fail(\n\t\t\t\t\t\t`the managing app authorised but the credential was refused: ${describe(allowed.result)}`,\n\t\t\t\t\t);\n\t\t} finally {\n\t\t\tinbox.respond(lxm, undefined);\n\t\t\tawait deleteProbeSpace(ctx, space.uri);\n\t\t}\n\t},\n);\n\n/** The crypto-bound catalog, in descriptor order. */\nexport const cryptoChecks: Check[] = [\n\tmacCommit,\n\tmacRecord,\n\toplogFolds,\n\tgetRepoStar,\n\tcredentialSigned,\n\tdelegationSigned,\n\texportSpaceMeta,\n\timportSpaceMeta,\n\timportMetaNotAuthority,\n\timportMetaUnsupported,\n\timportMetaInvalid,\n\timportRepo,\n\timportRepoNotFound,\n\timportRepoInvalid,\n\timportRepoMismatch,\n\tmemberGate,\n\tpersonalOnly,\n\tdelegationWrongAud,\n\tnotifyAccepted,\n\tnotifyFuture,\n\tnotifyUnknown,\n\twriteRevocation,\n\trevocationRefused,\n\trevocationName,\n\trevocationStranger,\n\tmanagedAccount,\n];\n","/**\n * Harness identities.\n *\n * Multi-party checks need the harness to play parties that aren't the\n * target's operator: a reader (signing delegation tokens), a writer's PDS\n * (signing notifyWrite service auth) and a foreign space authority\n * (signing credentials and revocations). Each needs a DID the target can\n * resolve to the key the harness holds.\n *\n * Resolution is the caller's to arrange — it can't be solved in-library:\n *\n * - In an in-process fixture, wire the target's DID resolver to\n * {@link KeypairIdentityProvider.didDocument} (or to `didKey` for a\n * did:key-only resolver).\n * - Against a live target, publish each identity: serve\n * {@link KeypairIdentityProvider.didDocument} at a did:web the target\n * can fetch (the reference matrix runs one tiny server per identity on\n * `did:web:localhost%3A<port>`), or register a did:plc.\n *\n * What a published identity document must carry, per the alpha: a\n * `#atproto` verification method (it signs every space token and service\n * JWT) and — for an identity that receives calls, such as a syncer inbox\n * or a managing app — an `#atproto_pds` service, which is how a bare DID\n * service identifier resolves to an endpoint. Identities never serve\n * repos, so they publish no `#atproto_kem`.\n */\n\nimport { Secp256k1Keypair } from \"@atproto/crypto\";\nimport type { HarnessIdentity, IdentityProvider } from \"./model.js\";\n\n// Credential keys are WebCrypto and browser-safe, so they live in\n// ./space-auth.ts; re-exported here for the full entry's callers.\nexport { createCredentialKey } from \"./space-auth.js\";\nexport type { CredentialKey } from \"./space-auth.js\";\n\nexport interface HarnessIdentityWithKey extends HarnessIdentity {\n\t/** The did:key form of the identity's `#atproto` key, for resolver wiring. */\n\tdidKey: string;\n}\n\nexport interface IdentityDocumentOptions {\n\t/** Publish an `#atproto_pds` service at this endpoint (inboxes, managing apps). */\n\tserviceEndpoint?: string;\n\t/** A handle to list in `alsoKnownAs`. */\n\thandle?: string;\n}\n\n/**\n * An identity provider backed by secp256k1 keypairs. Identities are keyed\n * by role label and reused within a run, so \"reader\" is stable across the\n * checks that mint and then present its tokens.\n *\n * `didFor` gives each identity a resolvable DID (e.g.\n * `did:web:localhost%3A61234`), and may be async — a harness can start the\n * server that will publish the document there. When omitted, the\n * identity's DID is its own `did:key`, which only works against a target\n * whose resolver this provider is wired into.\n */\nexport class KeypairIdentityProvider implements IdentityProvider {\n\tprivate cache = new Map<string, Promise<HarnessIdentityWithKey>>();\n\n\tconstructor(\n\t\tprivate readonly didFor?: (\n\t\t\trole: string,\n\t\t\tdidKey: string,\n\t\t) => string | Promise<string>,\n\t) {}\n\n\tidentity(role: string): Promise<HarnessIdentityWithKey> {\n\t\tlet existing = this.cache.get(role);\n\t\tif (!existing) {\n\t\t\texisting = this.mint(role);\n\t\t\tthis.cache.set(role, existing);\n\t\t}\n\t\treturn existing;\n\t}\n\n\tprivate async mint(role: string): Promise<HarnessIdentityWithKey> {\n\t\tconst keypair = await Secp256k1Keypair.create({ exportable: true });\n\t\tconst didKey = keypair.did();\n\t\tconst did = this.didFor ? await this.didFor(role, didKey) : didKey;\n\t\treturn {\n\t\t\tdid,\n\t\t\tdidKey,\n\t\t\tjwtAlg: keypair.jwtAlg,\n\t\t\tsign: (bytes) => keypair.sign(bytes),\n\t\t};\n\t}\n\n\t/**\n\t * The DID document a resolvable identity must publish: its `#atproto`\n\t * key as a Multikey and, optionally, the `#atproto_pds` service the\n\t * target delivers to.\n\t */\n\tstatic didDocument(\n\t\tidentity: Pick<HarnessIdentityWithKey, \"did\" | \"didKey\">,\n\t\topts: IdentityDocumentOptions = {},\n\t): Record<string, unknown> {\n\t\treturn {\n\t\t\t\"@context\": [\n\t\t\t\t\"https://www.w3.org/ns/did/v1\",\n\t\t\t\t\"https://w3id.org/security/multikey/v1\",\n\t\t\t],\n\t\t\tid: identity.did,\n\t\t\t...(opts.handle ? { alsoKnownAs: [`at://${opts.handle}`] } : {}),\n\t\t\tverificationMethod: [\n\t\t\t\t{\n\t\t\t\t\tid: `${identity.did}#atproto`,\n\t\t\t\t\ttype: \"Multikey\",\n\t\t\t\t\tcontroller: identity.did,\n\t\t\t\t\tpublicKeyMultibase: identity.didKey.slice(\"did:key:\".length),\n\t\t\t\t},\n\t\t\t],\n\t\t\t...(opts.serviceEndpoint\n\t\t\t\t? {\n\t\t\t\t\t\tservice: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tid: \"#atproto_pds\",\n\t\t\t\t\t\t\t\ttype: \"AtprotoPersonalDataServer\",\n\t\t\t\t\t\t\t\tserviceEndpoint: opts.serviceEndpoint,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t};\n\t}\n\n\t/** All minted identities so far, for resolver wiring in fixtures. */\n\tminted(): Promise<HarnessIdentityWithKey[]> {\n\t\treturn Promise.all(this.cache.values());\n\t}\n}\n","/**\n * The full check catalog and the identity provider.\n *\n * This entry imports `@atproto/space`, so it pulls the spaces crypto libs\n * and their (node-ish) transitive graph. Import it from the CLI and the\n * vitest adapter — anywhere WebCrypto and those libs run — but never\n * from a browser bundle. The browser adapter imports the base catalog from\n * the package root instead.\n */\n\nimport { buildCatalog } from \"./registry.js\";\nimport { baseChecks } from \"./checks/base.js\";\nimport { operatorChecks } from \"./checks/operator.js\";\nimport { cryptoChecks } from \"./full/checks.js\";\n\nexport { KeypairIdentityProvider, createCredentialKey } from \"./identity.js\";\nexport type {\n\tCredentialKey,\n\tHarnessIdentityWithKey,\n\tIdentityDocumentOptions,\n} from \"./identity.js\";\n\nexport {\n\tcreateProbeSpace,\n\tdeleteProbeSpace,\n\tobtainCredential,\n\tobtainCredentialViaDelegation,\n\tobtainPublicCredential,\n\tcredentialCall,\n\tcredentialGet,\n\trequestCredential,\n\tmintCredential,\n\tmintDelegation,\n\tserviceJwt,\n\toperatorCreateRecord,\n} from \"./full/helpers.js\";\nexport type { Credential, ProbeSpace } from \"./full/helpers.js\";\n\nexport { createSyncerInbox } from \"./inbox.js\";\nexport type { SyncerInboxHandle } from \"./inbox.js\";\n\nexport { cryptoChecks } from \"./full/checks.js\";\nexport { operatorChecks } from \"./checks/operator.js\";\nexport { baseChecks } from \"./checks/base.js\";\n\n/**\n * The complete catalog: the browser-safe base and operator checks plus\n * the crypto-bound ones only this entry can run.\n */\nexport const fullCatalog = buildCatalog([\n\t...baseChecks,\n\t...operatorChecks,\n\t...cryptoChecks,\n]);\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,SAAS,WAAW,UAA2B;AAC9C,QAAO;EACN,QAAQ,SAAS;EACjB,OAAO,UAAsB,SA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CACX,gCACA,wCACA;GACD,IAAI,SAAS;GACb,GAAI,KAAK,SAAS,EAAE,aAAa,CAAC,QAAQ,KAAK,SAAS,EAAE,GAAG,EAAE;GAC/D,oBAAoB,CACnB;IACC,IAAI,GAAG,SAAS,IAAI;IACpB,MAAM;IACN,YAAY,SAAS;IACrB,oBAAoB,SAAS,OAAO,MAAM,EAAkB;IAC5D,CACD;GACD,GAAI,KAAK,kBACN,EACA,SAAS,CACR;IACC,IAAI;IACJ,MAAM;IACN,iBAAiB,KAAK;IACtB,CACD,EACD,GACA,EAAE;GACL;;;CAIF,SAA4C;AAC3C,SAAO,QAAQ,IAAI,KAAK,MAAM,QAAQ,CAAC;;;;;;;;;;;;;;;;;;;AChFzC,MAAa,cAAc,aAAa;CACvC,GAAG;CACH,GAAG;CACH,GAAG;CACH,CAAC"}
package/dist/full.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import { H as CheckContext, J as IdentityProvider, O as CredentialKey, P as createCredentialKey, S as XrpcResult, V as Check, _ as obtainPublicCredential, a as Credential, d as credentialCall, f as credentialGet, g as obtainCredentialViaDelegation, i as createSyncerInbox, l as ProbeSpace, n as operatorChecks, p as deleteProbeSpace, q as HarnessIdentity, r as SyncerInboxHandle, t as baseChecks, u as createProbeSpace, v as operatorCreateRecord, x as requestCredential } from "./base-CGsQgOwR.js";
2
+ import "@atproto/space";
2
3
 
3
4
  //#region src/identity.d.ts
4
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"full.d.ts","names":[],"sources":["../src/identity.ts","../src/full/helpers.ts","../src/full/checks.ts","../src/full.ts"],"sourcesContent":[],"mappings":";;;;AC0GsB,UDvEL,sBAAA,SAA+B,eC0EtC,CAAA;;;;ACqgCG,UF1kCI,uBAAA,CE0kCe;;;;ECjkCnB,MAAA,CAAA,EAAA,MAIX;;;;;;;;;;;;;cHKW,uBAAA,YAAmC;;;mEAOhC;0BAGS,QAAQ;;;;;;;+BA2BrB,KAAK,kDACT,0BACJ;;YA+BO,QA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A;;iBF2CgB,cAAA,YACJ,iDAGT;;iBAUmB,UAAA,WACX;;;;IAER;;;;cCqgCU,cAAc;;;;;;AD3jC3B;AAkBsB,cExBT,WFwByB,EEpBpC,KAAA,EFoBoC"}
package/dist/full.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as mintDelegation, i as mintCredential, n as KeypairIdentityProvider, o as obtainCredential, r as cryptoChecks, s as serviceJwt, t as fullCatalog } from "./full-Bomm2urj.js";
2
- import { C as operatorCreateRecord, D as requestCredential, S as obtainPublicCredential, V as createCredentialKey, a as operatorChecks, g as deleteProbeSpace, h as credentialGet, i as createSyncerInbox, m as credentialCall, p as createProbeSpace, u as baseChecks, x as obtainCredentialViaDelegation } from "./descriptors-YEk3XoDL.js";
1
+ import { C as operatorCreateRecord, D as requestCredential, S as obtainPublicCredential, V as createCredentialKey, a as operatorChecks, g as deleteProbeSpace, h as credentialGet, i as createSyncerInbox, m as credentialCall, p as createProbeSpace, u as baseChecks, x as obtainCredentialViaDelegation } from "./descriptors-BUCV_BuG.js";
2
+ import { a as mintDelegation, i as mintCredential, n as KeypairIdentityProvider, o as obtainCredential, r as cryptoChecks, s as serviceJwt, t as fullCatalog } from "./full-CKsHg6ox.js";
3
3
 
4
4
  export { KeypairIdentityProvider, baseChecks, createCredentialKey, createProbeSpace, createSyncerInbox, credentialCall, credentialGet, cryptoChecks, deleteProbeSpace, fullCatalog, mintCredential, mintDelegation, obtainCredential, obtainCredentialViaDelegation, obtainPublicCredential, operatorChecks, operatorCreateRecord, requestCredential, serviceJwt };
package/dist/index.d.ts CHANGED
@@ -91,12 +91,11 @@ declare function descriptorToStub(d: CheckDescriptor): Check;
91
91
  //#endregion
92
92
  //#region src/alpha.d.ts
93
93
  /**
94
- * The alpha build the suite's verifiers are pinned to: the
95
- * `@atproto/space` / `@atproto/crypto` versions bundled into dist, cut from
96
- * bluesky-social/atproto `permissioned-data-alpha` at the vendored lexicon
97
- * commit. Runners stamp it on every report.
94
+ * The `@atproto/space` release the suite's verifiers and vendored lexicons
95
+ * are calibrated against: the spaces beta. Runners stamp it on every report.
96
+ * The name predates the beta and is kept for compatibility.
98
97
  */
99
- declare const ALPHA_BUILD = "0.0.0-spaces-alpha-20261124235736";
98
+ declare const ALPHA_BUILD = "0.1.0";
100
99
  //#endregion
101
100
  //#region src/changesets.d.ts
102
101
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/registry.ts","../src/did.ts","../src/descriptors.ts","../src/alpha.ts","../src/changesets.ts","../src/proposal.ts","../src/runner.ts","../src/lexicons.ts","../src/coverage.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;AA0BA;AAaA;;;;;AAMA;AAgBA;AACU,iBAhDM,WAAA,CAgDN,KAAA,EAhDyB,KAgDzB,CAAA,EAhDiC,KAgDjC;AACD,UArCQ,aAAA,CAqCR;EACN,KAAA,CAAA,EArCM,IAqCN,EAAA;EAAe;iBAnCF;;;ECbH;EAEI,IAAA,CAAA,EAAA,OAAW;EAaZ;EAeM,KAAA,CAAA,EAAA,MAAA,EAAA;EACX,GAAA,CAAA,EAAA,MAAA,EAAA;;AAEA,UDVM,eAAA,CCUN;EAAR,QAAA,EDTQ,KCSR,EAAA;EAAO;EA0BM,OAAA,EDjCN,KCiCM,CAAA;IA8BA,KAAA,ED/DS,KC+DT;;;;ACvFC,iBF2BD,YAAA,CE3BgB,MAAA,EF2BK,KE3BL,EAAA,CAAA,EF2Be,KE3Bf,EAAA;;;;;AAwBhC;AAmTgB,iBFhSA,aAAA,CEgSoB,OAAA,EF/R1B,KE+R4C,EAAA,EAAA,MAAK,EF9RlD,aE8RkD,CAAA,EF7RxD,eE6RwD;;;AF/RjD,cC9CG,qBAAA,GD8CH,uBAAA;AACD,UC7CQ,WAAA,CD6CR;EACN,EAAA,EAAA,MAAA;EAAe,WAAA,CAAA,EAAA,MAAA,EAAA;uBC3CI;;;IALT,UAAA,CAAA,EAAA,MAAA;IAEI,kBAAW,CAAA,EAAA,MAG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AA,CF/CW,IAAA,CAAA,EEgDpB,UFhDoB,EAAA,CAAA,EEiDxB,mBFjDwB,EAAA;AACjB,iBEsFM,cAAA,CFtFN,OAAA,EEuFA,KFvFA,EAAA,EAAA,IAAA,CAAA,EEwFH,UFxFG,EAAA,EAAA,UAAA,CAAA,EEyFG,iBFzFH,EAAA,CAAA,EE0FP,cF1FO;;;;;;AJhBV;;;;;AAwBA;AAmTA;cO9Oa,gBAIX,KAAA"}
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../src/registry.ts","../src/did.ts","../src/descriptors.ts","../src/alpha.ts","../src/changesets.ts","../src/proposal.ts","../src/runner.ts","../src/lexicons.ts","../src/coverage.ts","../src/index.ts"],"sourcesContent":[],"mappings":";;;;AA0BA;AAaA;;;;;AAMA;AAgBA;AACU,iBAhDM,WAAA,CAgDN,KAAA,EAhDyB,KAgDzB,CAAA,EAhDiC,KAgDjC;AACD,UArCQ,aAAA,CAqCR;EACN,KAAA,CAAA,EArCM,IAqCN,EAAA;EAAe;iBAnCF;;;ECbH;EAEI,IAAA,CAAA,EAAA,OAAW;EAaZ;EAeM,KAAA,CAAA,EAAA,MAAA,EAAA;EACX,GAAA,CAAA,EAAA,MAAA,EAAA;;AAEA,UDVM,eAAA,CCUN;EAAR,QAAA,EDTQ,KCSR,EAAA;EAAO;EA0BM,OAAA,EDjCN,KCiCM,CAAA;IA8BA,KAAA,ED/DS,KC+DT;;;;ACvFC,iBF2BD,YAAA,CE3BgB,MAAA,EF2BK,KE3BL,EAAA,CAAA,EF2Be,KE3Bf,EAAA;;;;;AAwBhC;AAmTgB,iBFhSA,aAAA,CEgSoB,OAAA,EF/R1B,KE+R4C,EAAA,EAAA,MAAK,EF9RlD,aE8RkD,CAAA,EF7RxD,eE6RwD;;;AF/RjD,cC9CG,qBAAA,GD8CH,uBAAA;AACD,UC7CQ,WAAA,CD6CR;EACN,EAAA,EAAA,MAAA;EAAe,WAAA,CAAA,EAAA,MAAA,EAAA;uBC3CI;;;IAL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IAEf,OAAA,EAAA,MAAA;;;;ACAb;AAwBiB,iBE+CD,oBAAA,CF/CW,IAAA,CAAA,EEgDpB,UFhDoB,EAAA,CAAA,EEiDxB,mBFjDwB,EAAA;AACjB,iBEsFM,cAAA,CFtFN,OAAA,EEuFA,KFvFA,EAAA,EAAA,IAAA,CAAA,EEwFH,UFxFG,EAAA,EAAA,UAAA,CAAA,EEyFG,iBFzFH,EAAA,CAAA,EE0FP,cF1FO;;;;;;AJhBV;;;;;AAwBA;AAmTA;cO9Oa,gBAIX,KAAA"}
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { B as SPACE_CREDENTIAL_SCHEME, C as operatorCreateRecord, D as requestCredential, E as publicRead, F as serviceEndpoint, G as isP256DidKey, H as credentialSigMembers, I as verificationMethodDidKey, K as spaceSigHeaders, L as COMMIT_MAC_PROFILE, M as DEFAULT_PLC_DIRECTORY, N as didDocumentUrl, P as resolveDidDocument, R as MAC_COVERED_HEADER, S as obtainPublicCredential, U as encapsulate, V as createCredentialKey, W as formatMacRequest, a as operatorChecks, at as xrpcGet, ct as xrpcUrl, dt as filterCatalog, ft as fail, g as deleteProbeSpace, h as credentialGet, i as createSyncerInbox, it as operatorHeaders, lt as buildCatalog, m as credentialCall, ot as xrpcPost, p as createProbeSpace, pt as pass, r as descriptorToStub, t as cryptoCheckDescriptors, u as baseChecks, ut as defineCheck, v as managedspace, w as personalspace, x as obtainCredentialViaDelegation, y as memberspace, z as RECORD_MAC_PROFILE } from "./descriptors-YEk3XoDL.js";
2
- import { a as renderReport, i as lexicons, n as coverageReport, o as runChecks, r as coverageRequirements, s as ALPHA_BUILD, t as coverageExemptions } from "./coverage-zCMup3Nb.js";
1
+ import { B as SPACE_CREDENTIAL_SCHEME, C as operatorCreateRecord, D as requestCredential, E as publicRead, F as serviceEndpoint, G as isP256DidKey, H as credentialSigMembers, I as verificationMethodDidKey, K as spaceSigHeaders, L as COMMIT_MAC_PROFILE, M as DEFAULT_PLC_DIRECTORY, N as didDocumentUrl, P as resolveDidDocument, R as MAC_COVERED_HEADER, S as obtainPublicCredential, U as encapsulate, V as createCredentialKey, W as formatMacRequest, a as operatorChecks, at as xrpcGet, ct as xrpcUrl, dt as filterCatalog, ft as fail, g as deleteProbeSpace, h as credentialGet, i as createSyncerInbox, it as operatorHeaders, lt as buildCatalog, m as credentialCall, ot as xrpcPost, p as createProbeSpace, pt as pass, r as descriptorToStub, t as cryptoCheckDescriptors, u as baseChecks, ut as defineCheck, v as managedspace, w as personalspace, x as obtainCredentialViaDelegation, y as memberspace, z as RECORD_MAC_PROFILE } from "./descriptors-BUCV_BuG.js";
2
+ import { a as renderReport, i as lexicons, n as coverageReport, o as runChecks, r as coverageRequirements, s as ALPHA_BUILD, t as coverageExemptions } from "./coverage-cK1NBo-P.js";
3
3
 
4
4
  //#region src/changesets.ts
5
5
  /**
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["knownChangesets: readonly string[]","knownProposalAnchors: readonly string[]","build","base","operator","descriptors","stub"],"sources":["../src/changesets.ts","../src/proposal.ts","../src/index.ts"],"sourcesContent":["/**\n * The upstream changesets the suite may cite, from bluesky-social/atproto\n * `permissioned-data-alpha` at the vendored commit (see\n * ../lexicons/MANIFEST.json). For alpha mechanics no lexicon can express —\n * the credential HTTP signature, the MAC exchange, key discovery — a\n * changeset is the alpha's only normative prose. Citations are checked\n * against this list, the same typo guard lexicon citations get; re-vendor\n * it alongside the lexicons.\n */\nexport const knownChangesets: readonly string[] = [\n\t\"alpha-kem-key-backfill\",\n\t\"alpha-space-uris\",\n\t\"baseline-space-policies\",\n\t\"brave-spaces-exist\",\n\t\"clear-spaces-sweep\",\n\t\"funky-dryers-draw\",\n\t\"neat-guests-pull\",\n\t\"olive-crabs-fly\",\n\t\"open-spaces-greet\",\n\t\"patient-managers-answer\",\n\t\"pds-space-uri-migration\",\n\t\"plain-keys-resolve\",\n\t\"quiet-spaces-mac\",\n\t\"quiet-writers-leave\",\n\t\"removed-writers-notify\",\n\t\"shared-writer-defs\",\n\t\"small-hornets-jam\",\n\t\"space-hpke-secret-export\",\n\t\"space-mac-http-signatures\",\n\t\"space-takedown-parity\",\n\t\"spaces-sdk-shape\",\n\t\"spaces-syntax\",\n\t\"star-spaces-shine\",\n\t\"sturdy-spaces-depart\",\n\t\"tidy-spaces-settle\",\n\t\"webhook-syncers-register\",\n];\n","/**\n * The section anchors of proposal 0016 (Atproto Spaces), as combined in\n * bluesky-social/proposals#143 at b54ec685 — the spec this alpha\n * implements. A `proposal` citation's ref is `0016#<anchor>`, checked\n * against this list (the typo guard lexicon and changeset citations get).\n * Regenerate it from the proposal's headings when the alpha moves.\n */\nexport const PROPOSAL_COMMIT = \"b54ec6853bab77edd4fd373804a480633094b324\";\n\nexport const knownProposalAnchors: readonly string[] = [\n\t\"introduction\",\n\t\"relationship-to-public-broadcast\",\n\t\"terminology\",\n\t\"spaces\",\n\t\"addressing\",\n\t\"space-authority\",\n\t\"space-type\",\n\t\"space-type-declarations\",\n\t\"space-key-skey\",\n\t\"access-control\",\n\t\"credential-key-binding\",\n\t\"delegation-token\",\n\t\"client-attestation\",\n\t\"space-credential\",\n\t\"authorizing-space-sync\",\n\t\"presenting-a-space-credential\",\n\t\"credential-flow\",\n\t\"credential-expiration-and-revocation\",\n\t\"space-repos\",\n\t\"repo-lifecycle\",\n\t\"commit-digest\",\n\t\"commit-authenticity\",\n\t\"kem-key\",\n\t\"shared-secret\",\n\t\"requesting-a-mac\",\n\t\"commit-mac\",\n\t\"record-mac\",\n\t\"repo-serialization\",\n\t\"archive-limits\",\n\t\"sync\",\n\t\"incremental-sync\",\n\t\"full-state-recovery\",\n\t\"blob-sync\",\n\t\"write-notifications\",\n\t\"registering-for-notifications\",\n\t\"the-sync-boundary-writer-set\",\n\t\"space-deletion\",\n\t\"moderation\",\n\t\"label-records\",\n\t\"takedowns\",\n\t\"oauth-scopes\",\n\t\"read-access\",\n\t\"matching\",\n\t\"examples\",\n\t\"consent\",\n\t\"permission-sets\",\n\t\"xrpc-api\",\n\t\"space-policy\",\n\t\"baseline-policies\",\n\t\"publishing-to-readers\",\n\t\"personalspace\",\n\t\"memberspace\",\n\t\"managedspace\",\n\t\"account-migration\",\n\t\"space-meta-archive\",\n\t\"considerations\",\n\t\"access-control-in-applications\",\n\t\"scaling\",\n\t\"account-lifecycle\",\n\t\"appendix-shared-secret-without-hpke\",\n];\n","/**\n * @getcirrus/space-conformance – black-box conformance suite for atproto\n * spaces implementations (alpha).\n *\n * One check model, multiple runners: the same tiered, citation-carrying\n * checks run in-process against a local implementation, from a CLI against\n * a live host, or inside a web checker. `must` checks cite specified\n * behaviour; `should` checks are calibrated against the reference\n * implementation; `info` checks never fail anyone.\n */\n\nexport { pass, fail } from \"./model.js\";\nexport type {\n\tCapability,\n\tCheck,\n\tCheckContext,\n\tCheckOutcome,\n\tCheckResult,\n\tCheckStatus,\n\tCitation,\n\tHarnessIdentity,\n\tIdentityProvider,\n\tInboxDelivery,\n\tSyncerInbox,\n\tTarget,\n\tTier,\n} from \"./model.js\";\n\nexport { buildCatalog, defineCheck, filterCatalog } from \"./registry.js\";\nexport type { CatalogFilter, FilteredCatalog } from \"./registry.js\";\n\nexport { xrpcGet, xrpcPost, xrpcUrl, operatorHeaders } from \"./http.js\";\nexport type { XrpcResult } from \"./http.js\";\n\nexport { baseChecks } from \"./checks/base.js\";\nexport {\n\toperatorChecks,\n\tcreateProbeSpace,\n\tdeleteProbeSpace,\n\toperatorCreateRecord,\n\tobtainCredentialViaDelegation,\n\tobtainPublicCredential,\n\trequestCredential,\n\tcredentialCall,\n\tcredentialGet,\n\tmemberspace,\n\tpersonalspace,\n\tmanagedspace,\n\tpublicRead,\n} from \"./checks/operator.js\";\nexport type {\n\tCredential,\n\tCredentialCallOptions,\n\tCredentialResult,\n\tPolicy,\n\tProbeSpace,\n} from \"./checks/operator.js\";\n\nexport {\n\tcreateCredentialKey,\n\tcredentialSigMembers,\n\tencapsulate,\n\tformatMacRequest,\n\tisP256DidKey,\n\tspaceSigHeaders,\n\tCOMMIT_MAC_PROFILE,\n\tRECORD_MAC_PROFILE,\n\tMAC_COVERED_HEADER,\n\tSPACE_CREDENTIAL_SCHEME,\n} from \"./space-auth.js\";\nexport type {\n\tCredentialKey,\n\tCredentialSigOptions,\n\tMacProfile,\n} from \"./space-auth.js\";\nexport { createSyncerInbox } from \"./inbox.js\";\nexport type { SyncerInboxHandle } from \"./inbox.js\";\nexport {\n\tDEFAULT_PLC_DIRECTORY,\n\tdidDocumentUrl,\n\tresolveDidDocument,\n\tserviceEndpoint,\n\tverificationMethodDidKey,\n} from \"./did.js\";\nexport type { DidDocument } from \"./did.js\";\n\nexport { cryptoCheckDescriptors, descriptorToStub } from \"./descriptors.js\";\nexport type { CheckDescriptor } from \"./descriptors.js\";\n\nexport { ALPHA_BUILD } from \"./alpha.js\";\nexport { knownChangesets } from \"./changesets.js\";\nexport { knownProposalAnchors, PROPOSAL_COMMIT } from \"./proposal.js\";\n\nimport { baseChecks as base } from \"./checks/base.js\";\nimport { operatorChecks as operator } from \"./checks/operator.js\";\nimport { buildCatalog as build } from \"./registry.js\";\nimport {\n\tcryptoCheckDescriptors as descriptors,\n\tdescriptorToStub as stub,\n} from \"./descriptors.js\";\n\n/**\n * A catalog for transports that cannot run the crypto-bound checks (the\n * browser). The base checks run anonymously; the operator checks — writes,\n * space management, blobs, credential issuance and presentation — are real\n * and run whenever the harness supplies an operator session (an OAuth\n * sign-in in the web checker). Only the checks that genuinely need the\n * alpha crypto libs or foreign identities are metadata stubs, reported as\n * skipped (\"not testable here\") — listed rather than omitted, so a green\n * run never silently reads as fuller conformance than it proved.\n */\nexport const browserCatalog = build([\n\t...base,\n\t...operator,\n\t...descriptors.map(stub),\n]);\n\nexport { renderReport, runChecks } from \"./runner.js\";\nexport type { RunOptions, RunReport } from \"./runner.js\";\n\nexport {\n\tcoverageExemptions,\n\tcoverageReport,\n\tcoverageRequirements,\n} from \"./coverage.js\";\nexport type {\n\tCoverageExemption,\n\tCoverageReport,\n\tCoverageRequirement,\n} from \"./coverage.js\";\n\nexport { lexicons } from \"./lexicons.js\";\nexport type { LexiconDoc } from \"./lexicons.js\";\n"],"mappings":";;;;;;;;;;;;;AASA,MAAaA,kBAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;AC7BD,MAAa,kBAAkB;AAE/B,MAAaC,uBAA0C;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;ACyCD,MAAa,iBAAiBC,aAAM;CACnC,GAAGC;CACH,GAAGC;CACH,GAAGC,uBAAY,IAAIC,iBAAK;CACxB,CAAC"}
1
+ {"version":3,"file":"index.js","names":["knownChangesets: readonly string[]","knownProposalAnchors: readonly string[]","build","base","operator","descriptors","stub"],"sources":["../src/changesets.ts","../src/proposal.ts","../src/index.ts"],"sourcesContent":["/**\n * The upstream changesets the suite may cite, from bluesky-social/atproto\n * `permissioned-data-alpha` at the vendored commit (see\n * ../lexicons/MANIFEST.json). For alpha mechanics no lexicon can express —\n * the credential HTTP signature, the MAC exchange, key discovery — a\n * changeset is the alpha's only normative prose. Citations are checked\n * against this list, the same typo guard lexicon citations get; re-vendor\n * it alongside the lexicons.\n */\nexport const knownChangesets: readonly string[] = [\n\t\"alpha-kem-key-backfill\",\n\t\"alpha-space-uris\",\n\t\"baseline-space-policies\",\n\t\"brave-spaces-exist\",\n\t\"clear-spaces-sweep\",\n\t\"funky-dryers-draw\",\n\t\"neat-guests-pull\",\n\t\"olive-crabs-fly\",\n\t\"open-spaces-greet\",\n\t\"patient-managers-answer\",\n\t\"pds-space-uri-migration\",\n\t\"plain-keys-resolve\",\n\t\"quiet-spaces-mac\",\n\t\"quiet-writers-leave\",\n\t\"removed-writers-notify\",\n\t\"shared-writer-defs\",\n\t\"small-hornets-jam\",\n\t\"space-hpke-secret-export\",\n\t\"space-mac-http-signatures\",\n\t\"space-takedown-parity\",\n\t\"spaces-sdk-shape\",\n\t\"spaces-syntax\",\n\t\"star-spaces-shine\",\n\t\"sturdy-spaces-depart\",\n\t\"tidy-spaces-settle\",\n\t\"webhook-syncers-register\",\n];\n","/**\n * The section anchors of proposal 0016 (Atproto Spaces), as combined in\n * bluesky-social/proposals#143 at b54ec685 — the spec this alpha\n * implements. A `proposal` citation's ref is `0016#<anchor>`, checked\n * against this list (the typo guard lexicon and changeset citations get).\n * Regenerate it from the proposal's headings when the alpha moves.\n */\nexport const PROPOSAL_COMMIT = \"b54ec6853bab77edd4fd373804a480633094b324\";\n\nexport const knownProposalAnchors: readonly string[] = [\n\t\"introduction\",\n\t\"relationship-to-public-broadcast\",\n\t\"terminology\",\n\t\"spaces\",\n\t\"addressing\",\n\t\"space-authority\",\n\t\"space-type\",\n\t\"space-type-declarations\",\n\t\"space-key-skey\",\n\t\"access-control\",\n\t\"credential-key-binding\",\n\t\"delegation-token\",\n\t\"client-attestation\",\n\t\"space-credential\",\n\t\"authorizing-space-sync\",\n\t\"presenting-a-space-credential\",\n\t\"credential-flow\",\n\t\"credential-expiration-and-revocation\",\n\t\"space-repos\",\n\t\"repo-lifecycle\",\n\t\"commit-digest\",\n\t\"commit-authenticity\",\n\t\"kem-key\",\n\t\"shared-secret\",\n\t\"requesting-a-mac\",\n\t\"commit-mac\",\n\t\"record-mac\",\n\t\"repo-serialization\",\n\t\"archive-limits\",\n\t\"sync\",\n\t\"incremental-sync\",\n\t\"full-state-recovery\",\n\t\"blob-sync\",\n\t\"write-notifications\",\n\t\"registering-for-notifications\",\n\t\"the-sync-boundary-writer-set\",\n\t\"space-deletion\",\n\t\"moderation\",\n\t\"label-records\",\n\t\"takedowns\",\n\t\"oauth-scopes\",\n\t\"read-access\",\n\t\"matching\",\n\t\"examples\",\n\t\"consent\",\n\t\"permission-sets\",\n\t\"xrpc-api\",\n\t\"space-policy\",\n\t\"baseline-policies\",\n\t\"publishing-to-readers\",\n\t\"personalspace\",\n\t\"memberspace\",\n\t\"managedspace\",\n\t\"account-migration\",\n\t\"space-meta-archive\",\n\t\"considerations\",\n\t\"access-control-in-applications\",\n\t\"scaling\",\n\t\"account-lifecycle\",\n\t\"appendix-shared-secret-without-hpke\",\n];\n","/**\n * @getcirrus/space-conformance – black-box conformance suite for atproto\n * spaces implementations (beta).\n *\n * One check model, multiple runners: the same tiered, citation-carrying\n * checks run in-process against a local implementation, from a CLI against\n * a live host, or inside a web checker. `must` checks cite specified\n * behaviour; `should` checks are calibrated against the reference\n * implementation; `info` checks never fail anyone.\n */\n\nexport { pass, fail } from \"./model.js\";\nexport type {\n\tCapability,\n\tCheck,\n\tCheckContext,\n\tCheckOutcome,\n\tCheckResult,\n\tCheckStatus,\n\tCitation,\n\tHarnessIdentity,\n\tIdentityProvider,\n\tInboxDelivery,\n\tSyncerInbox,\n\tTarget,\n\tTier,\n} from \"./model.js\";\n\nexport { buildCatalog, defineCheck, filterCatalog } from \"./registry.js\";\nexport type { CatalogFilter, FilteredCatalog } from \"./registry.js\";\n\nexport { xrpcGet, xrpcPost, xrpcUrl, operatorHeaders } from \"./http.js\";\nexport type { XrpcResult } from \"./http.js\";\n\nexport { baseChecks } from \"./checks/base.js\";\nexport {\n\toperatorChecks,\n\tcreateProbeSpace,\n\tdeleteProbeSpace,\n\toperatorCreateRecord,\n\tobtainCredentialViaDelegation,\n\tobtainPublicCredential,\n\trequestCredential,\n\tcredentialCall,\n\tcredentialGet,\n\tmemberspace,\n\tpersonalspace,\n\tmanagedspace,\n\tpublicRead,\n} from \"./checks/operator.js\";\nexport type {\n\tCredential,\n\tCredentialCallOptions,\n\tCredentialResult,\n\tPolicy,\n\tProbeSpace,\n} from \"./checks/operator.js\";\n\nexport {\n\tcreateCredentialKey,\n\tcredentialSigMembers,\n\tencapsulate,\n\tformatMacRequest,\n\tisP256DidKey,\n\tspaceSigHeaders,\n\tCOMMIT_MAC_PROFILE,\n\tRECORD_MAC_PROFILE,\n\tMAC_COVERED_HEADER,\n\tSPACE_CREDENTIAL_SCHEME,\n} from \"./space-auth.js\";\nexport type {\n\tCredentialKey,\n\tCredentialSigOptions,\n\tMacProfile,\n} from \"./space-auth.js\";\nexport { createSyncerInbox } from \"./inbox.js\";\nexport type { SyncerInboxHandle } from \"./inbox.js\";\nexport {\n\tDEFAULT_PLC_DIRECTORY,\n\tdidDocumentUrl,\n\tresolveDidDocument,\n\tserviceEndpoint,\n\tverificationMethodDidKey,\n} from \"./did.js\";\nexport type { DidDocument } from \"./did.js\";\n\nexport { cryptoCheckDescriptors, descriptorToStub } from \"./descriptors.js\";\nexport type { CheckDescriptor } from \"./descriptors.js\";\n\nexport { ALPHA_BUILD } from \"./alpha.js\";\nexport { knownChangesets } from \"./changesets.js\";\nexport { knownProposalAnchors, PROPOSAL_COMMIT } from \"./proposal.js\";\n\nimport { baseChecks as base } from \"./checks/base.js\";\nimport { operatorChecks as operator } from \"./checks/operator.js\";\nimport { buildCatalog as build } from \"./registry.js\";\nimport {\n\tcryptoCheckDescriptors as descriptors,\n\tdescriptorToStub as stub,\n} from \"./descriptors.js\";\n\n/**\n * A catalog for transports that cannot run the crypto-bound checks (the\n * browser). The base checks run anonymously; the operator checks — writes,\n * space management, blobs, credential issuance and presentation — are real\n * and run whenever the harness supplies an operator session (an OAuth\n * sign-in in the web checker). Only the checks that genuinely need the\n * alpha crypto libs or foreign identities are metadata stubs, reported as\n * skipped (\"not testable here\") — listed rather than omitted, so a green\n * run never silently reads as fuller conformance than it proved.\n */\nexport const browserCatalog = build([\n\t...base,\n\t...operator,\n\t...descriptors.map(stub),\n]);\n\nexport { renderReport, runChecks } from \"./runner.js\";\nexport type { RunOptions, RunReport } from \"./runner.js\";\n\nexport {\n\tcoverageExemptions,\n\tcoverageReport,\n\tcoverageRequirements,\n} from \"./coverage.js\";\nexport type {\n\tCoverageExemption,\n\tCoverageReport,\n\tCoverageRequirement,\n} from \"./coverage.js\";\n\nexport { lexicons } from \"./lexicons.js\";\nexport type { LexiconDoc } from \"./lexicons.js\";\n"],"mappings":";;;;;;;;;;;;;AASA,MAAaA,kBAAqC;CACjD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;AC7BD,MAAa,kBAAkB;AAE/B,MAAaC,uBAA0C;CACtD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;;;;;;;;;;;;;;ACyCD,MAAa,iBAAiBC,aAAM;CACnC,GAAGC;CACH,GAAGC;CACH,GAAGC,uBAAY,IAAIC,iBAAK;CACxB,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "source": "https://github.com/bluesky-social/atproto",
3
- "branch": "permissioned-data-alpha",
4
- "commit": "1f510f8e3",
5
- "vendoredAt": "2026-11-25",
6
- "note": "Vendored verbatim from lexicons/com/atproto/{space,memberspace,personalspace,managedspace} by scripts/vendor-lexicons.mjs. A diff here identifies affected checks via their citations."
3
+ "branch": "main",
4
+ "commit": "209184efa",
5
+ "vendoredAt": "2026-12-01",
6
+ "note": "Vendored verbatim from lexicons/com/atproto/{space,memberspace,personalspace,managedspace} by scripts/vendor-lexicons.mjs at permissioned-data-alpha@1f510f8e3, then brought to the spaces beta (@atproto/space 0.1.0, merged to main as 209184efa): the only lexicon change was two descriptions on `data`, checked against the documents published in @atproto/api 0.32.11. Changeset citations still name the alpha branch's changesets. A diff here identifies affected checks via their citations."
7
7
  }
@@ -43,7 +43,8 @@
43
43
  "format": "tid"
44
44
  },
45
45
  "data": {
46
- "type": "bytes"
46
+ "type": "bytes",
47
+ "description": "SHA-256 digest of the repo's LtHash state."
47
48
  },
48
49
  "spaceRev": {
49
50
  "type": "string",
@@ -24,7 +24,8 @@
24
24
  "format": "tid"
25
25
  },
26
26
  "data": {
27
- "type": "bytes"
27
+ "type": "bytes",
28
+ "description": "SHA-256 digest of the repo's LtHash state."
28
29
  }
29
30
  }
30
31
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@getcirrus/space-conformance",
3
- "version": "0.1.0",
4
- "description": "Black-box conformance suite for atproto spaces implementations (alpha)",
3
+ "version": "0.2.0",
4
+ "description": "Black-box conformance suite for atproto spaces implementations (beta)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "files": [
@@ -14,10 +14,6 @@
14
14
  },
15
15
  "devDependencies": {
16
16
  "@arethetypeswrong/cli": "^0.18.2",
17
- "@atproto/crypto": "0.0.0-spaces-alpha-20261124235736",
18
- "@atproto/lex-data": "0.1.11",
19
- "@atproto/oauth-client-node": "0.0.0-spaces-alpha-20261124235736",
20
- "@atproto/space": "0.0.0-spaces-alpha-20261124235736",
21
17
  "publint": "^0.3.16",
22
18
  "tsdown": "^0.18.3",
23
19
  "typescript": "^5.9.3",
@@ -41,6 +37,12 @@
41
37
  "bin": {
42
38
  "space-conformance": "./dist/cli.js"
43
39
  },
40
+ "dependencies": {
41
+ "@atproto/crypto": "^0.5.9",
42
+ "@atproto/lex-data": "^0.1.11",
43
+ "@atproto/oauth-client-node": "^0.5.22",
44
+ "@atproto/space": "^0.1.0"
45
+ },
44
46
  "scripts": {
45
47
  "build": "tsdown",
46
48
  "dev": "tsdown --watch",
@@ -1 +0,0 @@
1
- {"version":3,"file":"coverage-zCMup3Nb.js","names":["logs: string[]","ctx: CheckContext","results: CheckResult[]","checkCtx: CheckContext","id","lines: string[]","lexicons: LexiconDoc[]","space_applyWrites","space_authorizeSpaceSync","space_clearRecords","space_confirmRegistration","space_createRecord","space_createSpace","space_defs","space_deleteRecord","space_deleteSpace","space_exportSpaceMeta","space_getBlob","space_getDelegationToken","space_getLatestCommit","space_getRecord","space_getRepo","space_getSpace","space_importRepo","space_importSpaceMeta","space_listBlobs","space_listRecords","space_listRepoOps","space_listSpaces","space_listWriters","space_notifyCredentialsRevoked","space_notifyRepoUpdate","space_notifySpaceUpdate","space_policy","space_putRecord","space_removeWriter","space_updateSpace","memberspace_defs","memberspace_listMembers","memberspace_member","memberspace_policy","memberspace_putMembers","memberspace_removeMembers","personalspace_policy","managedspace_checkAccess","managedspace_policy","coverageExemptions: CoverageExemption[]","requirements: CoverageRequirement[]","dangling: CoverageReport[\"danglingCitations\"]","exempt: CoverageReport[\"exempt\"]","gaps: CoverageRequirement[]"],"sources":["../src/alpha.ts","../src/runner.ts","../lexicons/space/applyWrites.json","../lexicons/space/authorizeSpaceSync.json","../lexicons/space/clearRecords.json","../lexicons/space/confirmRegistration.json","../lexicons/space/createRecord.json","../lexicons/space/createSpace.json","../lexicons/space/defs.json","../lexicons/space/deleteRecord.json","../lexicons/space/deleteSpace.json","../lexicons/space/exportSpaceMeta.json","../lexicons/space/getBlob.json","../lexicons/space/getDelegationToken.json","../lexicons/space/getLatestCommit.json","../lexicons/space/getRecord.json","../lexicons/space/getRepo.json","../lexicons/space/getSpace.json","../lexicons/space/importRepo.json","../lexicons/space/importSpaceMeta.json","../lexicons/space/listBlobs.json","../lexicons/space/listRecords.json","../lexicons/space/listRepoOps.json","../lexicons/space/listSpaces.json","../lexicons/space/listWriters.json","../lexicons/space/notifyCredentialsRevoked.json","../lexicons/space/notifyRepoUpdate.json","../lexicons/space/notifySpaceUpdate.json","../lexicons/space/policy.json","../lexicons/space/putRecord.json","../lexicons/space/removeWriter.json","../lexicons/space/updateSpace.json","../lexicons/memberspace/defs.json","../lexicons/memberspace/listMembers.json","../lexicons/memberspace/member.json","../lexicons/memberspace/policy.json","../lexicons/memberspace/putMembers.json","../lexicons/memberspace/removeMembers.json","../lexicons/personalspace/policy.json","../lexicons/managedspace/checkAccess.json","../lexicons/managedspace/policy.json","../src/lexicons.ts","../src/coverage.ts"],"sourcesContent":["/**\n * The alpha build the suite's verifiers are pinned to: the\n * `@atproto/space` / `@atproto/crypto` versions bundled into dist, cut from\n * bluesky-social/atproto `permissioned-data-alpha` at the vendored lexicon\n * commit. Runners stamp it on every report.\n */\nexport const ALPHA_BUILD = \"0.0.0-spaces-alpha-20261124235736\";\n","/**\n * The core runner: executes a filtered catalog against one target and\n * produces a report. Transport- and environment-agnostic — the vitest\n * adapter, the CLI and the web checker all call this.\n */\n\nimport type { Check, CheckContext, CheckResult, Target } from \"./model.js\";\nimport type { FilteredCatalog } from \"./registry.js\";\n\nexport interface RunReport {\n\tsuite: { name: string; version: string };\n\t/** The alpha build the suite's verifiers are pinned to. */\n\talphaBuild: string;\n\ttarget: Target;\n\tstartedAt: string;\n\tfinishedAt: string;\n\tresults: CheckResult[];\n\tlogs: string[];\n\tsummary: {\n\t\tpass: number;\n\t\tfail: number;\n\t\tmustFail: number;\n\t\t/**\n\t\t * must-tier checks that errored (threw or timed out). A CI gate must\n\t\t * treat these as failures too: an unreachable or hung target errors\n\t\t * its checks rather than failing them, and must not exit 0.\n\t\t */\n\t\tmustError: number;\n\t\tskipped: number;\n\t\terror: number;\n\t};\n}\n\nexport interface RunOptions {\n\tcatalog: FilteredCatalog;\n\tcontext: Omit<CheckContext, \"state\" | \"log\">;\n\tsuiteVersion: string;\n\talphaBuild: string;\n\t/** Per-check timeout; a hung target must not hang the run. */\n\tcheckTimeoutMs?: number;\n\t/**\n\t * Called with each result as it is determined, in run order — so a UI\n\t * can render progress live instead of waiting for the whole report.\n\t * Skipped results are delivered too (at the end). A throwing callback\n\t * is contained: it must not be able to abort the run.\n\t */\n\tonResult?: (result: CheckResult) => void;\n}\n\nexport async function runChecks(options: RunOptions): Promise<RunReport> {\n\tconst logs: string[] = [];\n\tconst state = new Map<string, unknown>();\n\tconst ctx: CheckContext = {\n\t\t...options.context,\n\t\tstate,\n\t\tlog: (message) => logs.push(message),\n\t};\n\tconst timeoutMs = options.checkTimeoutMs ?? 30_000;\n\tconst startedAt = new Date().toISOString();\n\tconst results: CheckResult[] = [];\n\tconst emit = (result: CheckResult) => {\n\t\tresults.push(result);\n\t\ttry {\n\t\t\toptions.onResult?.(result);\n\t\t} catch {\n\t\t\t// The callback is an observer; its bugs must not abort the run.\n\t\t}\n\t};\n\n\t// Sequential on purpose: checks share probe state, and hammering a\n\t// live target in parallel makes failures racy and reports unreadable.\n\tfor (const check of options.catalog.runnable) {\n\t\tconst began = Date.now();\n\t\t// A per-check abort so a timed-out check's in-flight requests are\n\t\t// cancelled rather than continuing to fetch and mutate shared state\n\t\t// alongside the next check (the sequential invariant above).\n\t\tconst controller = new AbortController();\n\t\tconst checkCtx: CheckContext = {\n\t\t\t...ctx,\n\t\t\tfetch: (input, init) =>\n\t\t\t\tctx.fetch(input, {\n\t\t\t\t\t...init,\n\t\t\t\t\tsignal: init?.signal ?? controller.signal,\n\t\t\t\t}),\n\t\t};\n\t\ttry {\n\t\t\tconst outcome = await withTimeout(\n\t\t\t\tcheck.run(checkCtx),\n\t\t\t\tMath.max(timeoutMs, check.timeoutMs ?? 0),\n\t\t\t\tcheck.id,\n\t\t\t\tcontroller,\n\t\t\t);\n\t\t\temit({\n\t\t\t\tid: check.id,\n\t\t\t\ttier: check.tier,\n\t\t\t\tstatus: outcome.status,\n\t\t\t\tdetail: outcome.detail,\n\t\t\t\tcitations: check.citations,\n\t\t\t\t...(outcome.evidence !== undefined\n\t\t\t\t\t? { evidence: outcome.evidence }\n\t\t\t\t\t: {}),\n\t\t\t\tdurationMs: Date.now() - began,\n\t\t\t});\n\t\t} catch (err) {\n\t\t\t// A thrown error means the CHECK broke (or the target hung) —\n\t\t\t// reported distinctly from a failing target so suite bugs don't\n\t\t\t// masquerade as non-conformance.\n\t\t\temit({\n\t\t\t\tid: check.id,\n\t\t\t\ttier: check.tier,\n\t\t\t\tstatus: \"error\",\n\t\t\t\tdetail: err instanceof Error ? err.message : String(err),\n\t\t\t\tcitations: check.citations,\n\t\t\t\tdurationMs: Date.now() - began,\n\t\t\t});\n\t\t}\n\t}\n\n\tfor (const { check, reason } of options.catalog.skipped) {\n\t\temit({\n\t\t\tid: check.id,\n\t\t\ttier: check.tier,\n\t\t\tstatus: \"skipped\",\n\t\t\tdetail: reason,\n\t\t\tcitations: check.citations,\n\t\t});\n\t}\n\n\tconst summary = {\n\t\tpass: results.filter((r) => r.status === \"pass\").length,\n\t\tfail: results.filter((r) => r.status === \"fail\").length,\n\t\tmustFail: results.filter((r) => r.status === \"fail\" && r.tier === \"must\")\n\t\t\t.length,\n\t\tmustError: results.filter((r) => r.status === \"error\" && r.tier === \"must\")\n\t\t\t.length,\n\t\tskipped: results.filter((r) => r.status === \"skipped\").length,\n\t\terror: results.filter((r) => r.status === \"error\").length,\n\t};\n\n\treturn {\n\t\tsuite: {\n\t\t\tname: \"@getcirrus/space-conformance\",\n\t\t\tversion: options.suiteVersion,\n\t\t},\n\t\talphaBuild: options.alphaBuild,\n\t\ttarget: options.context.target,\n\t\tstartedAt,\n\t\tfinishedAt: new Date().toISOString(),\n\t\tresults,\n\t\tlogs,\n\t\tsummary,\n\t};\n}\n\nfunction withTimeout<T>(\n\tpromise: Promise<T>,\n\tms: number,\n\tid: string,\n\tcontroller: AbortController,\n): Promise<T> {\n\treturn new Promise<T>((resolve, reject) => {\n\t\tconst timer = setTimeout(() => {\n\t\t\t// Abort the check's in-flight requests so it stops touching shared\n\t\t\t// state before the next check begins.\n\t\t\tcontroller.abort();\n\t\t\treject(new Error(`check ${id} timed out after ${ms}ms`));\n\t\t}, ms);\n\t\tpromise.then(\n\t\t\t(value) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\tresolve(value);\n\t\t\t},\n\t\t\t(err) => {\n\t\t\t\tclearTimeout(timer);\n\t\t\t\treject(err);\n\t\t\t},\n\t\t);\n\t});\n}\n\n/** Render a compact human-readable summary of a report. */\nexport function renderReport(report: RunReport): string {\n\tconst lines: string[] = [];\n\tconst icon = { pass: \"✓\", fail: \"✗\", skipped: \"-\", error: \"!\" } as const;\n\tlines.push(\n\t\t`# ${report.suite.name}@${report.suite.version} vs ${report.target.implementation ?? report.target.origin}`,\n\t);\n\tlines.push(`alpha build: ${report.alphaBuild}`);\n\tfor (const result of report.results) {\n\t\tlines.push(\n\t\t\t`${icon[result.status]} [${result.tier}] ${result.id} — ${result.detail}`,\n\t\t);\n\t}\n\tconst s = report.summary;\n\tlines.push(\n\t\t`${s.pass} pass, ${s.fail} fail (${s.mustFail} must), ${s.skipped} skipped, ${s.error} errored`,\n\t);\n\treturn lines.join(\"\\n\");\n}\n","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","/**\n * Vendored lexicon access. Generated by scripts/vendor-lexicons.mjs whenever\n * lexicons/ is re-vendored — imports are explicit so bundlers carry the\n * documents without filesystem access at runtime.\n */\n\nimport space_applyWrites from \"../lexicons/space/applyWrites.json\" with { type: \"json\" };\nimport space_authorizeSpaceSync from \"../lexicons/space/authorizeSpaceSync.json\" with { type: \"json\" };\nimport space_clearRecords from \"../lexicons/space/clearRecords.json\" with { type: \"json\" };\nimport space_confirmRegistration from \"../lexicons/space/confirmRegistration.json\" with { type: \"json\" };\nimport space_createRecord from \"../lexicons/space/createRecord.json\" with { type: \"json\" };\nimport space_createSpace from \"../lexicons/space/createSpace.json\" with { type: \"json\" };\nimport space_defs from \"../lexicons/space/defs.json\" with { type: \"json\" };\nimport space_deleteRecord from \"../lexicons/space/deleteRecord.json\" with { type: \"json\" };\nimport space_deleteSpace from \"../lexicons/space/deleteSpace.json\" with { type: \"json\" };\nimport space_exportSpaceMeta from \"../lexicons/space/exportSpaceMeta.json\" with { type: \"json\" };\nimport space_getBlob from \"../lexicons/space/getBlob.json\" with { type: \"json\" };\nimport space_getDelegationToken from \"../lexicons/space/getDelegationToken.json\" with { type: \"json\" };\nimport space_getLatestCommit from \"../lexicons/space/getLatestCommit.json\" with { type: \"json\" };\nimport space_getRecord from \"../lexicons/space/getRecord.json\" with { type: \"json\" };\nimport space_getRepo from \"../lexicons/space/getRepo.json\" with { type: \"json\" };\nimport space_getSpace from \"../lexicons/space/getSpace.json\" with { type: \"json\" };\nimport space_importRepo from \"../lexicons/space/importRepo.json\" with { type: \"json\" };\nimport space_importSpaceMeta from \"../lexicons/space/importSpaceMeta.json\" with { type: \"json\" };\nimport space_listBlobs from \"../lexicons/space/listBlobs.json\" with { type: \"json\" };\nimport space_listRecords from \"../lexicons/space/listRecords.json\" with { type: \"json\" };\nimport space_listRepoOps from \"../lexicons/space/listRepoOps.json\" with { type: \"json\" };\nimport space_listSpaces from \"../lexicons/space/listSpaces.json\" with { type: \"json\" };\nimport space_listWriters from \"../lexicons/space/listWriters.json\" with { type: \"json\" };\nimport space_notifyCredentialsRevoked from \"../lexicons/space/notifyCredentialsRevoked.json\" with { type: \"json\" };\nimport space_notifyRepoUpdate from \"../lexicons/space/notifyRepoUpdate.json\" with { type: \"json\" };\nimport space_notifySpaceUpdate from \"../lexicons/space/notifySpaceUpdate.json\" with { type: \"json\" };\nimport space_policy from \"../lexicons/space/policy.json\" with { type: \"json\" };\nimport space_putRecord from \"../lexicons/space/putRecord.json\" with { type: \"json\" };\nimport space_removeWriter from \"../lexicons/space/removeWriter.json\" with { type: \"json\" };\nimport space_updateSpace from \"../lexicons/space/updateSpace.json\" with { type: \"json\" };\nimport memberspace_defs from \"../lexicons/memberspace/defs.json\" with { type: \"json\" };\nimport memberspace_listMembers from \"../lexicons/memberspace/listMembers.json\" with { type: \"json\" };\nimport memberspace_member from \"../lexicons/memberspace/member.json\" with { type: \"json\" };\nimport memberspace_policy from \"../lexicons/memberspace/policy.json\" with { type: \"json\" };\nimport memberspace_putMembers from \"../lexicons/memberspace/putMembers.json\" with { type: \"json\" };\nimport memberspace_removeMembers from \"../lexicons/memberspace/removeMembers.json\" with { type: \"json\" };\nimport personalspace_policy from \"../lexicons/personalspace/policy.json\" with { type: \"json\" };\nimport managedspace_checkAccess from \"../lexicons/managedspace/checkAccess.json\" with { type: \"json\" };\nimport managedspace_policy from \"../lexicons/managedspace/policy.json\" with { type: \"json\" };\n\nexport interface LexiconDoc {\n\tlexicon: number;\n\tid: string;\n\tdefs: Record<string, unknown>;\n}\n\nexport const lexicons: LexiconDoc[] = [\n\tspace_applyWrites as LexiconDoc,\n\tspace_authorizeSpaceSync as LexiconDoc,\n\tspace_clearRecords as LexiconDoc,\n\tspace_confirmRegistration as LexiconDoc,\n\tspace_createRecord as LexiconDoc,\n\tspace_createSpace as LexiconDoc,\n\tspace_defs as LexiconDoc,\n\tspace_deleteRecord as LexiconDoc,\n\tspace_deleteSpace as LexiconDoc,\n\tspace_exportSpaceMeta as LexiconDoc,\n\tspace_getBlob as LexiconDoc,\n\tspace_getDelegationToken as LexiconDoc,\n\tspace_getLatestCommit as LexiconDoc,\n\tspace_getRecord as LexiconDoc,\n\tspace_getRepo as LexiconDoc,\n\tspace_getSpace as LexiconDoc,\n\tspace_importRepo as LexiconDoc,\n\tspace_importSpaceMeta as LexiconDoc,\n\tspace_listBlobs as LexiconDoc,\n\tspace_listRecords as LexiconDoc,\n\tspace_listRepoOps as LexiconDoc,\n\tspace_listSpaces as LexiconDoc,\n\tspace_listWriters as LexiconDoc,\n\tspace_notifyCredentialsRevoked as LexiconDoc,\n\tspace_notifyRepoUpdate as LexiconDoc,\n\tspace_notifySpaceUpdate as LexiconDoc,\n\tspace_policy as LexiconDoc,\n\tspace_putRecord as LexiconDoc,\n\tspace_removeWriter as LexiconDoc,\n\tspace_updateSpace as LexiconDoc,\n\tmemberspace_defs as LexiconDoc,\n\tmemberspace_listMembers as LexiconDoc,\n\tmemberspace_member as LexiconDoc,\n\tmemberspace_policy as LexiconDoc,\n\tmemberspace_putMembers as LexiconDoc,\n\tmemberspace_removeMembers as LexiconDoc,\n\tpersonalspace_policy as LexiconDoc,\n\tmanagedspace_checkAccess as LexiconDoc,\n\tmanagedspace_policy as LexiconDoc,\n];\n","/**\n * Coverage is computed, not remembered.\n *\n * The vendored lexicons define what a conforming implementation exposes:\n * every method, and every error it declares. Each of those wants at least\n * one `must` check citing it. When the weekly sync re-vendors a changed\n * lexicon, new methods and error names surface here as gaps the moment\n * they land — no human has to notice that an endpoint grew.\n *\n * A requirement no black-box harness can exercise is exempted explicitly,\n * with the reason, in {@link coverageExemptions}. An exemption is a\n * reviewed statement, not a silencer: one that names no requirement, or a\n * requirement a check now covers, is reported as stale so the list cannot\n * quietly outgrow its reasons.\n */\n\nimport type { Check } from \"./model.js\";\nimport { lexicons, type LexiconDoc } from \"./lexicons.js\";\n\nexport interface CoverageRequirement {\n\t/** `<nsid>` for the method itself, `<nsid>@error:<Name>` for an error. */\n\tref: string;\n\tkind: \"method\" | \"error\";\n}\n\n/**\n * A requirement the suite deliberately does not cover. `ref` is an exact\n * requirement, or `*@error:Name` for that error on every method declaring\n * it.\n */\nexport interface CoverageExemption {\n\tref: string;\n\treason: string;\n}\n\nconst TAKEDOWN_REASON =\n\t\"Needs a moderation or account-status action on the target (a takedown, suspension or deactivation of the account being read), which only the host's administrator can take. No black-box harness can arrange it without admin authority, and deactivating the operator's own account would end the session the run depends on.\";\n\nconst READ_SPACE_NOT_FOUND_REASON =\n\t\"Declared on the repo-host reads, but neither the lexicons nor proposal 0016 name a condition under which a repo host answers it: reads are answered from the repo, and an empty or never-written repo is equivalent to a nonexistent one (proposal, Repo lifecycle). A must check would be the suite's own reading. The 1105 deleteSpace description said reads of a deleted space fail with SpaceNotFound; 1112 dropped that sentence, and the check that relied on it with it.\";\n\nconst INVALID_CURSOR_REASON =\n\t\"Cursors are opaque, host-issued strings. Neither the lexicons nor the proposal define a value every host must reject, so which cursors are invalid is the host's choice. The should check request.garbage-cursor-rejected calibrates what the reference does.\";\n\nexport const coverageExemptions: CoverageExemption[] = [\n\t{ ref: \"*@error:RepoTakendown\", reason: TAKEDOWN_REASON },\n\t{ ref: \"*@error:RepoSuspended\", reason: TAKEDOWN_REASON },\n\t{ ref: \"*@error:RepoDeactivated\", reason: TAKEDOWN_REASON },\n\t{ ref: \"*@error:InvalidCursor\", reason: INVALID_CURSOR_REASON },\n\t...[\n\t\t\"getRecord\",\n\t\t\"listRecords\",\n\t\t\"getLatestCommit\",\n\t\t\"listRepoOps\",\n\t\t\"getRepo\",\n\t\t\"listBlobs\",\n\t\t\"getBlob\",\n\t].map((method) => ({\n\t\tref: `com.atproto.space.${method}@error:SpaceNotFound`,\n\t\treason: READ_SPACE_NOT_FOUND_REASON,\n\t})),\n];\n\nexport interface CoverageReport {\n\trequirements: CoverageRequirement[];\n\tcovered: Array<{ ref: string; by: string[] }>;\n\t/** Requirements no `must` check covers and no exemption explains. */\n\tgaps: CoverageRequirement[];\n\t/** Requirements excused by an exemption, with its reason. */\n\texempt: Array<{ ref: string; reason: string }>;\n\t/**\n\t * Exemptions that excuse nothing: they match no requirement, or every\n\t * requirement they match is covered by a check after all.\n\t */\n\tstaleExemptions: CoverageExemption[];\n\t/** Lexicon citations on checks that match no requirement (typo guard). */\n\tdanglingCitations: Array<{ checkId: string; ref: string }>;\n}\n\n/** Extract the coverage requirements from the vendored lexicons. */\nexport function coverageRequirements(\n\tdocs: LexiconDoc[] = lexicons,\n): CoverageRequirement[] {\n\tconst requirements: CoverageRequirement[] = [];\n\tfor (const doc of docs) {\n\t\tconst main = doc.defs.main as\n\t\t\t| { type?: string; errors?: Array<{ name: string }> }\n\t\t\t| undefined;\n\t\tif (!main || (main.type !== \"query\" && main.type !== \"procedure\")) {\n\t\t\tcontinue;\n\t\t}\n\t\trequirements.push({ ref: doc.id, kind: \"method\" });\n\t\tfor (const error of main.errors ?? []) {\n\t\t\trequirements.push({\n\t\t\t\tref: `${doc.id}@error:${error.name}`,\n\t\t\t\tkind: \"error\",\n\t\t\t});\n\t\t}\n\t}\n\treturn requirements;\n}\n\n/**\n * A citation covers a requirement when it names the method (which covers\n * the method requirement) or the exact `@error:` form. A citation with a\n * `#def` fragment covers its method.\n */\nfunction citationRefs(check: Check): string[] {\n\treturn check.citations\n\t\t.filter((c) => c.source === \"lexicon\")\n\t\t.map((c) => c.ref);\n}\n\nfunction exemptionMatches(exemption: CoverageExemption, ref: string): boolean {\n\tif (exemption.ref.startsWith(\"*@error:\")) {\n\t\treturn ref.endsWith(exemption.ref.slice(1)) && ref.includes(\"@error:\");\n\t}\n\treturn exemption.ref === ref;\n}\n\nexport function coverageReport(\n\tcatalog: Check[],\n\tdocs: LexiconDoc[] = lexicons,\n\texemptions: CoverageExemption[] = coverageExemptions,\n): CoverageReport {\n\tconst requirements = coverageRequirements(docs);\n\tconst known = new Set(requirements.map((r) => r.ref));\n\tconst methodIds = new Set(\n\t\trequirements.filter((r) => r.kind === \"method\").map((r) => r.ref),\n\t);\n\t// Every vendored lexicon id, so a citation to a non-method document\n\t// (e.g. `com.atproto.space.defs`, the commit shape) is\n\t// recognised as real rather than flagged as a typo.\n\tconst knownDocIds = new Set(docs.map((d) => d.id));\n\n\tconst coveredBy = new Map<string, string[]>();\n\tconst dangling: CoverageReport[\"danglingCitations\"] = [];\n\tconst credit = (ref: string, checkId: string) =>\n\t\tcoveredBy.set(ref, [...(coveredBy.get(ref) ?? []), checkId]);\n\n\tfor (const check of catalog) {\n\t\tif (check.tier !== \"must\") continue;\n\t\tfor (const ref of citationRefs(check)) {\n\t\t\tconst methodRef = ref.split(\"@\")[0]!.split(\"#\")[0]!;\n\n\t\t\t// An `@error:` citation covers ONLY the exact error requirement.\n\t\t\t// It must never fall back to crediting the method: doing so would\n\t\t\t// silently absorb an error-name typo (or an upstream rename) and\n\t\t\t// falsely mark the method covered — defeating the typo guard this\n\t\t\t// report exists to provide.\n\t\t\tif (ref.includes(\"@error:\")) {\n\t\t\t\tif (known.has(ref)) {\n\t\t\t\t\tcredit(ref, check.id);\n\t\t\t\t} else {\n\t\t\t\t\tdangling.push({ checkId: check.id, ref });\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t// A method (or `#def`) citation.\n\t\t\tif (methodIds.has(methodRef)) {\n\t\t\t\tcredit(methodRef, check.id);\n\t\t\t} else if (!knownDocIds.has(methodRef)) {\n\t\t\t\t// Names no vendored document at all — a typo.\n\t\t\t\tdangling.push({ checkId: check.id, ref });\n\t\t\t}\n\t\t\t// else: a `#def` reference to a real non-method document (e.g.\n\t\t\t// defs) — valid, contributes no method coverage, not dangling.\n\t\t}\n\t}\n\n\tconst uncovered = requirements.filter((r) => !coveredBy.has(r.ref));\n\tconst exempt: CoverageReport[\"exempt\"] = [];\n\tconst gaps: CoverageRequirement[] = [];\n\tconst used = new Set<CoverageExemption>();\n\tfor (const requirement of uncovered) {\n\t\tconst exemption = exemptions.find((e) =>\n\t\t\texemptionMatches(e, requirement.ref),\n\t\t);\n\t\tif (exemption) {\n\t\t\tused.add(exemption);\n\t\t\texempt.push({ ref: requirement.ref, reason: exemption.reason });\n\t\t} else {\n\t\t\tgaps.push(requirement);\n\t\t}\n\t}\n\treturn {\n\t\trequirements,\n\t\tcovered: Array.from(coveredBy, ([ref, by]) => ({ ref, by })),\n\t\tgaps,\n\t\texempt,\n\t\tstaleExemptions: exemptions.filter((e) => !used.has(e)),\n\t\tdanglingCitations: dangling,\n\t};\n}\n"],"mappings":";;;;;;;AAMA,MAAa,cAAc;;;;AC2C3B,eAAsB,UAAU,SAAyC;CACxE,MAAMA,OAAiB,EAAE;CACzB,MAAM,wBAAQ,IAAI,KAAsB;CACxC,MAAMC,MAAoB;EACzB,GAAG,QAAQ;EACX;EACA,MAA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