# Spaces: policies and the space lifecycle What this server does as a space's authority and host for the spaces its accounts own: creating, changing, describing and deleting them (`com.atproto.space.createSpace`, `updateSpace`, `getSpace`, `deleteSpace`); the policy that decides who may read a space and whose writes it tracks, and asking a managedspace's managing app (`com.atproto.managedspace.checkAccess`); a memberspace's member list (`com.atproto.memberspace.putMembers`, `removeMembers`, `listMembers`); taking an account out of the writer set (`com.atproto.space.removeWriter`); publishing the policy and members to readers; a space's host-side state as an archive, for migration (`com.atproto.space.exportSpaceMeta`, `importSpaceMeta`); and what these answer for an account taken down or deactivated. Spaces, their URIs, roles and keys are as [`SPACES.md`](SPACES.md) says; what every method shares, and how the server is checked, is in [`PDS.md`](PDS.md). The methods' lexicons are in `lexicons/com/atproto/{space,memberspace}` (a member, `com.atproto.memberspace.defs#member`, in `lexicons/com/atproto/memberspace/defs.json`); the policies' in `lexicons/com/atproto/{personalspace,memberspace,managedspace}/policy.json`, and the two published records' in `lexicons/com/atproto/space/policy.json` and `lexicons/com/atproto/memberspace/member.json`. `com.atproto.managedspace.checkAccess` is a method the server calls and does not serve, so its lexicon stays in `spaces/lexicons/com/atproto/managedspace/`. ## What every method here shares **Who calls.** Every method here takes a session's `accessJwt` as its bearer token, from a password or an app password (`SESSIONS.md`), except `importSpaceMeta`, which an app-password session may not call: `400 InvalidToken`. No token is `401 AuthMissing`; a token the server did not give out, `400 InvalidToken`. An OAuth access token is taken as well, allowed what its `space:` permissions allow (`OAUTH-SCOPES.md`, "Spaces"). **What is checked, in order**, the first failure answered: 1. For a procedure, the token, then its input against the lexicon; for a query, its parameters, then the token (`PDS.md`). Input the lexicon refuses, such as a malformed `space`, `did`, `repo`, `spaceType` or `skey`, a `members` or `dids` list of more than 100, a member without its `did`, `read` or `write`, a `policy` that is not an object with a `$type`, or a policy field of the wrong type, is `400 InvalidRequest`; so is `importSpaceMeta`'s body of another `Content-Type` (there). The account's status is checked with the token (Takedown and deactivation, below). 2. Ownership: the space's authority, the DID in its URI, must be the caller's own DID. Any other is `400 NotAuthorized`, whether or not such a space exists and whoever hosts it. (`importSpaceMeta` reads its archive first: there.) 3. For `createSpace`, `updateSpace` and `importSpaceMeta`, the policy (below): before whether the space exists. 4. The space: one that was never created here, or was deleted, is `400 SpaceNotFound`. A space is its whole URI, so the same authority with another type or key is another space. 5. For the member methods, the policy's type: `400 PolicyMismatch` for a space not governed by `com.atproto.memberspace.policy`. 6. For `listMembers`, its `cursor` (The member list): `400 InvalidCursor`. **What they answer.** `createSpace`, `getSpace` and `listMembers` answer JSON, `exportSpaceMeta` an archive; every other method here answers `200` with an empty body and no `Content-Type`. ## Policies A space's `policy` is an object whose `$type` names the policy and whose other fields configure it. The server implements the three baseline policies, and only them. A `$type` other than these is `400 UnsupportedPolicy`. The policy stored, and answered by `getSpace` and published, is the one given with its defaults filled in and every field its lexicon does not define dropped: | `$type` | Stored | | --- | --- | | `com.atproto.personalspace.policy` | `{$type}` alone | | `com.atproto.memberspace.policy` | `publicRead`, `publicWrite`, `publishPolicy`, `publishMembers`, each `false` unless given; `allowedApps` as given, an empty list too, and absent when not given | | `com.atproto.managedspace.policy` | `managingApp` as given; `publishPolicy`, `false` unless given | `managingApp` is required, and must be a service reference `#`, with exactly one `#`: - `` an atproto DID, as `PROXY.md`'s `getServiceAuth` takes `aud` (step 3): `did:plc:` and 24 characters of `a-z` and `2-7`, or a `did:web` with no path, and with no port but on `localhost` (`did:web:localhost%3A2583`); - `` not empty, of the characters RFC 3986 allows in a fragment: `A-Z`, `a-z`, `0-9`, `-._~!$&'()*+,;=:@/?`, and `%` followed by two hex digits. Anything else is `400 InvalidRequest`: a bare DID with no fragment, `did:`, `did:key:…#x`, `did:example:…#x`, `did:plc:abc#x`, `#`, `#a#b`, `#a b`, `#%4`, `did:web:app.example:path#x`, `did:web:app.example%3A443#x`. Nothing more of it is checked when it is stored: it need not resolve. ### Who is authorized Each policy decides two things for an account, separately: **read**, whether the authority issues a space credential for it; and **write**, whether the authority tracks its writes (the writer set, below). Neither stops an account writing its own repo in any space. A space's authority is authorized to read and write its own space under every policy, without a member list or a managing app. | Policy | Read | Write | | --- | --- | --- | | personalspace | the authority only | the authority only | | memberspace | anyone if `publicRead`; otherwise a member whose entry has `read: true` | a member as its entry's `write` says; an account not on the list, only if `publicWrite` | | managedspace | as the managing app's `read` | as the managing app's `write` | So under `publicWrite` a member whose entry has `write: false` is not tracked, and an account taken off the list is tracked again by its next write. A credential asked for with no delegation token names no account. A memberspace with `publicRead` authorizes it; a managedspace asks its app, with no `repo`; every other space refuses it. A memberspace's `allowedApps` is a second gate on reads alone, decided after the account's and applied to the authority too: when it is present, the client must have presented an attestation whose `client_id` is in the list; with no attestation, or one not listed, the app is refused. When it is absent, or under any other policy, every app is authorized. How a refused account and a refused app are answered is the credentials' part. Each decision reads the policy and member list as they are when it is made. ### Asking a managing app: checkAccess Under managedspace, each read decision (a credential, `authorizeSpaceSync`, `SPACES-CREDENTIALS.md`) and each write decision (a write notification, `notifyRepoUpdate`, `SPACES-SYNC.md`) for an account other than the authority asks the managing app, afresh each time; no answer is remembered. 1. **Where.** `managingApp` is `#`. The DID is resolved (`atproto/did.md`): a `did:plc` through the directory the server uses, a `did:web` from its host, fetched as `SPACES-CREDENTIALS.md` fetches an issuer's ("Issuers' keys": through `PROXY.md`'s guard, so with protection on never from an IP address or `localhost`, and never over `http`; no redirect; at most 65536 bytes; 10 seconds; in `LIMITS.md`'s pool for `did:web` documents). The endpoint is the document's service whose `id` is `#` (or the DID and `#`), of any `type`. Its `serviceEndpoint` must be a string that starts with `http://` or `https://` and parses as a URL; any other (`ftp://…`, `app.example`, an object) is no endpoint. 2. **The request.** `GET /xrpc/com.atproto.managedspace.checkAccess`, `` the endpoint's scheme, host and port: its path, query and fragment are not used, so `https://app.example/base?x=` is asked at `https://app.example/xrpc/com.atproto.managedspace.checkAccess`. An endpoint with a user name or password is asked nothing. The parameters are `space` (the space's URI); `repo`, the account's DID, when there is one (a read with no delegation token has none); and, for a read whose client presented an attestation, `clientId`, the attested `client_id`. A write never carries `clientId`, nor does a read without an attestation. No other parameter is sent. The request goes through `PROXY.md`'s guard ("SSRF protection"): with protection on, only to an `https` endpoint whose host is a public name, no IP address and no `localhost`, resolving only to public unicast addresses; one it will not send is as a request that failed. With protection on or off it follows no redirect, reads at most 524288 bytes of the answer, and is given up after 10 seconds. 3. **Its service auth** (`atproto/xrpc.md`): `Authorization: Bearer `, the JWT's header `{"typ": "JWT", "alg": "ES256K"}` and its body exactly `iss` (the authority's DID), `aud` (`managingApp` as stored, fragment and all), `lxm` (`com.atproto.managedspace.checkAccess`), `iat`, `exp` (`iat` + 60, in seconds) and `jti` (a fresh random string), signed with the authority's `#atproto` key as `atproto/cryptography.md` signs. 4. **The answer.** The app answers when its status is `2xx` (`201` too), its `Content-Type` is `application/json` (its media type compared without regard to case; parameters such as `charset` allowed), and its body is a JSON object whose `read` and `write` are both booleans; other fields are ignored. A read decision is its `read`, a write decision its `write`: `false` refuses, `true` authorizes. 5. **No answer.** Anything else is a failure to decide, neither a refusal nor an authorization: a DID that does not resolve, a document with no such service or no endpoint, a request not sent, one that fails or takes more than 10 seconds, a redirect, any other status (`204`, `3xx`, `4xx`, `5xx`), no `Content-Type` or another, a body that is not JSON, not an object, or longer than 524288 bytes, and `read` or `write` absent or not a boolean (`"true"`, `1`, `null`; an answer of the form `{"authorized": true}` too). The method that asked then answers `502 UpstreamFailure`: `authorizeSpaceSync` (`SPACES-CREDENTIALS.md`) and `notifyRepoUpdate` (`SPACES-SYNC.md`), the write not tracked. ## createSpace `{spaceType, skey?, policy}` creates a space whose authority is the caller: `at:///space//`. With no `skey`, the key is a new TID (`atproto/tid.md`). It answers `{space}`, that URI, and nothing else. A space of that URI that exists is `400 SpaceAlreadyExists`, whether it was created or imported; the policy is checked first, so an unsupported one is `UnsupportedPolicy` even then. A deleted space may be created again: it starts afresh, with the new policy, no members and an empty writer set. When the policy asks for publishing, the published records are written as the space is created (Publishing, below). ## getSpace `?space=` answers `{space, policy}`: `space` the space as asked, and `policy` the stored policy. ## updateSpace `{space, policy}` replaces the policy wholesale with the one given, stored as above: a field not given takes its default, not its old value. - The same `$type` is a change of configuration: a memberspace's member list stays. - Another `$type` migrates the space: its member list is deleted, and migrating back to memberspace does not restore it. - Either way the writer set is not changed: writers tracked under the old policy stay until removed. Publishing follows the new policy (below). ## deleteSpace `{space}` deletes the space. Deleting a space already deleted answers `200` again, and changes nothing; one never created is `SpaceNotFound`. Deleting drops the space's policy, member list and writer set (its removals too), its syncers' registrations, and the authority's own repo in the space: its records, commit and operation log (the space repo's part). Members' repos, on this server or others, are not touched. From then on every method here answers the space `SpaceNotFound`, except `createSpace`, which creates it again, and `importSpaceMeta`. The server remembers that it was deleted: `authorizeSpaceSync` answers it `400 SpaceDeleted` whatever the request's delegation token, client attestation or `notify` (`SPACES-CREDENTIALS.md`, "authorizeSpaceSync"); and the syncers registered for it when it is deleted, those whose registration has lapsed too, are owed `notifySpaceUpdate` with `#spaceDeleted` (`SPACES-SYNC.md`). ## The member list A memberspace keeps a list of members, each a DID with two booleans, `read` and `write` (`com.atproto.memberspace.defs#member`). The list is not part of the policy object. Any DID may be a member, the authority's own too. **putMembers** `{space, members}`, at most 100 members, each `{did, read, write}`, adds each DID to the list, or replaces both booleans of one already listed. A DID given more than once takes its last entry. Each DID given `write: false` is also taken out of the writer set (The writer set). An empty `members` changes nothing and answers `200`. **removeMembers** `{space, dids}`, at most 100 DIDs, takes each DID that is a member off the list and out of the writer set. A DID that is not a member is ignored, its entry in the writer set, if any, left as it is; a DID given twice is as once. An empty `dids` answers `200`. **listMembers** `?space=&limit=&cursor=` answers `{members, cursor?}`, each member `{did, read, write}`, in ascending byte order of the DID as stored. `limit` is 1 to 1000, 100 by default. `cursor`, if given and not empty, must be a DID (the lexicon's `did` format, `atproto/did.md`): any other string is `400 InvalidCursor`, checked last (What every method here shares); it answers only the members whose DID is after it in that order. An empty `cursor` is as none. The answer's `cursor` is the last member's DID whenever the page has any member, even when it is the last page, and is absent from an empty page. ## The writer set The writer set is the authority's record of the accounts whose writes to the space it tracks: each entry a DID, with the `repoRev` and `data` of that account's repo in the space as last notified, and the space-wide `spaceRev` it was tracked at; the notifications' part keeps it, and the removals from it, in order (`SPACES-SYNC.md`). Writes enter it as the notifications' part says, each only if the policy authorizes the writer to write (Who is authorized), the authority's own writes included. This page changes it only so: - **removeWriter** `{space, repo}` takes the DID `repo` out of the writer set, under any policy, the authority's own DID too. It answers `200` whether or not the DID was in it. A DID in it is removed: a removal the notifications' part sequences, lists and tells the space's syncers (`SPACES-SYNC.md`); one not in it changes nothing. The DID is tracked again by its next write the policy authorizes. - `putMembers` takes out each DID it gives `write: false`, and `removeMembers` each DID that was a member: each a removal as above. - `deleteSpace` empties it; a space created again starts with it empty. - `importSpaceMeta` replaces it with the archive's. `updateSpace`, `putMembers` with `write: true`, and `removeMembers` of a DID that is not a member do not change it. ## Publishing to readers A memberspace or managedspace whose policy has `publishPolicy: true`, and a memberspace with `publishMembers: true`, keep copies of that state as records in the authority's own repo in the space, where they sync to readers as any record does: | Flag | Collection | Record key | Value | | --- | --- | --- | --- | | `publishPolicy` | `com.atproto.space.policy` | `self` | `{"$type": "com.atproto.space.policy", "policy": }` | | `publishMembers` | `com.atproto.memberspace.member` | the member's DID, as below | `{"$type": "com.atproto.memberspace.member", "read": …, "write": …}` | A member's record key is the DID with its first `%3A` written as `:`, so that a `did:web` with a port is a valid record key: `did:web:localhost%3A2583` is keyed `did:web:localhost:2583`. Other DIDs are keyed as they are. The server writes these records itself, each change below as one commit of the authority's repo in the space, as any write of that repo is made (the space repo's part), so that it is notified and tracked like the authority's other writes. A change that writes or deletes nothing makes no commit. - `createSpace` with `publishPolicy` writes the policy record. - `updateSpace` writes the policy record, a new version even when the policy is unchanged, if the new policy publishes it, and deletes it if not and it is there. If whether members are published differs between the old policy and the new one, it also writes a record for each member (now published) or deletes each member's record that is there (no longer published, a migration away from memberspace included), in the same commit. - `putMembers`, when members are published, writes each given DID's record, once however often the DID is given, in one commit, even a record that was already so; an empty `members` makes no commit. - `removeMembers` deletes each removed member's record that is there, in one commit; one that removes no member makes no commit. - `importSpaceMeta` writes nothing: the records arrive with the authority's repo (`importRepo`). - `deleteSpace` deletes the repo, records and all. The policy and member list are what is enforced; the records are copies. Direct writes of either collection, to any repo, are refused, and `clearRecords` leaves them in the authority's repo; both are the space repo's part. ## Space meta archives ### exportSpaceMeta `?space=` answers the space's host-side state as a STAR archive (`SPACES.md`) of the profile `atproto-space-meta`, `Content-Type: application/vnd.dasl.star`. The archive of a space's state is one string of bytes: - **The metadata** is the DRISL map `{"$type": "atproto-space-meta", "ver": 1, "space": }`. - **The pairs**, each value DRISL, in three sections in this order, and within each in strict ascending order of the key's bytes: 1. the key `policy`: the stored policy; 2. for a memberspace, one pair per member, keyed `com.atproto.memberspace.member/`, its value `{"$type": "com.atproto.memberspace.member", "read": …, "write": …}`; no pairs for the other policies; 3. one pair per entry of the writer set, keyed `writer/`, its value `{"repoRev": , "data": , "spaceRev": }`. The writer set's removals are not in it. - **Limits**: as the space repo profile's, 65536 bytes of metadata, 4096 of a key, 1048576 of a value. ### importSpaceMeta The body is such an archive, as `Content-Type: application/vnd.dasl.star`, parameters allowed; another type (`application/octet-stream`, `application/json`, …), or none, is `400 InvalidRequest`, with the token, before the body is read. It is read, in this order, and the first fault answered: 1. STAR's own faults, an empty body too, and the limits above: `400 InvalidSpaceMeta`. 2. The metadata: `$type` must be `atproto-space-meta`, `ver` the integer `1`, and `space` a valid space URI; else `400 InvalidSpaceMeta`. Other metadata fields are ignored. 3. The pairs, as they come: each value must be DRISL, and a map. The first pair must be `policy`; then any pairs that are neither `policy` nor start `writer/`, the policy state; then the `writer/` pairs. No pairs, or none `policy`, a section out of that order, and keys out of order or repeated within a section are faults. A `writer/` key's rest must be a DID, and its value a map with `repoRev` and `spaceRev` TIDs and `data` bytes (of any length), other fields ignored. Each fault is `400 InvalidSpaceMeta`. 4. Ownership: the metadata's space must be the caller's, else `400 NotAuthorized`. 5. The policy: one its lexicon refuses (no `$type`, a field of the wrong type) is `400 InvalidSpaceMeta`; a `$type` other than the three, `400 UnsupportedPolicy`; a bad `managingApp`, `400 InvalidRequest`, as for `createSpace`. Unknown fields are dropped. 6. The policy state: under memberspace each key must be `com.atproto.memberspace.member/` and a member record key that is a DID (read back by writing `:` before trailing digits of a `did:web::` as `%3A`), its value a valid `com.atproto.memberspace.member` with its `$type`, `read` and `write`. Any other key, any key under another policy, or a bad value is `400 InvalidSpaceMeta`: a host never drops access state it does not know. Then it replaces whatever the server holds for the space, all at once: the space exists (again, if it was deleted), with the archive's policy as stored, the archive's members as its member list, and the archive's writers, `repoRev`, `data` and `spaceRev` as given, as its writer set, with no removals. It publishes nothing. So `exportSpaceMeta` of the space then answers the archive imported, byte for byte, when that was as `exportSpaceMeta` writes one. ## Takedown and deactivation For an account deactivated (`com.atproto.server.deactivateAccount`) or taken down by the server's operator: | Methods | Deactivated | Taken down | | --- | --- | --- | | `createSpace`, `updateSpace`, `deleteSpace`, `putMembers`, `removeMembers`, `removeWriter` | `401 AccountDeactivated` | `401 AccountTakedown` | | `importSpaceMeta` | answered as for an active account | `401 AccountTakedown` | | `getSpace`, `listMembers`, `exportSpaceMeta` | answered as for an active account | answered as for an active account | These come with the token, before the input is read. A taken-down account can still get a session from `createSession` with `allowTakendown: true`; `exportSpaceMeta` takes that session, and every other method here answers it `400 InvalidToken`. `getSpace` and `exportSpaceMeta` do not take the admin token: `400 InvalidToken`. A space whose authority is deactivated or taken down is suspended, not deleted; what that changes for credentials (`authorizeSpaceSync` refuses it, `SPACES-CREDENTIALS.md`) and the writer set is theirs. The account's own space repo writes and `getDelegationToken` are refused too (`SPACES-REPO.md`, `SPACES-CREDENTIALS.md`). *Note:* `exportSpaceMeta` takes that session so that the account can migrate its spaces away. An account's state is `LIFECYCLE.md`'s, taken down before deactivated. ## For other slices These are what the other spaces parts rely on from this one, as behaviour; each reads the space's state as it is when asked. - **Whether a space exists.** A space is live from `createSpace` or `importSpaceMeta` until `deleteSpace`; deleted after that, until it is created or imported again; and otherwise unknown. The space repo's part needs a live space for the authority's own writes; `authorizeSpaceSync` answers a deleted one `SpaceDeleted`. - **`authorize_read(space, repo?, client_id?) -> yes | no | undecided`**: the read column of Who is authorized, for a live space. `repo` absent (no delegation token) is yes for a memberspace with `publicRead`, as the managing app answers for a managedspace, and no otherwise. `client_id`, the attested client, is passed to a managing app and decides nothing else here. - **`authorize_app(space, client_id?) -> bool`**: the `allowedApps` gate, asked only once `authorize_read` is yes: false only for a memberspace with `allowedApps` and no `client_id`, or one not listed. - **`authorize_write(space, repo) -> yes | no | undecided`**: the write column, for a live space; a managing app is asked without a client. - **Undecided** is a managing app's failure to decide (Asking a managing app: checkAccess); the method that asked answers `502 UpstreamFailure`. - **The writer set's changes from here**: take a DID out (`removeWriter`, `putMembers` with `write: false`, `removeMembers` of a member), each a removal the notifications' part sequences and tells the syncers; empty it (`deleteSpace`); replace it (`importSpaceMeta`). The notifications' part keeps the set; this part only changes it so. - **Published records** are written through the space repo's own write path as the authority's writes, so `on_commit(space, repo, rev, data)` follows each commit as for any write. Their collections, `com.atproto.space.policy` and `com.atproto.memberspace.member`, are the ones the space repo refuses to write directly, keeps on `clearRecords` in the authority's repo, and imports as they are. - **Deletion**: the syncers registered for the space when it is deleted, lapsed registrations too, are owed `notifySpaceUpdate` with `#spaceDeleted`; delivering it is the notifications' part. ## Commands The methods here are commands and tools as `COMMANDS.md` makes them, in the groups `space` and `memberspace`: `pds space create-space`, `space_create_space`; `pds memberspace put-members`, `memberspace_put_members`; `pds memberspace remove-members`, `memberspace_remove_members`. As there, a required `repo` (`removeWriter`'s) may be left out with a token, and is then the caller's own DID. Two are not JSON: - `exportSpaceMeta` answers an archive: `pds space export-space-meta` writes its bytes to standard output, as `get-repo` writes a CAR file, and it has no MCP tool. - `importSpaceMeta` takes an archive: `pds space import-space-meta` sends standard input as the body, `Content-Type: application/vnd.dasl.star`, and it has no MCP tool. ## Where the reference departs from this page - **A managing app's redirect.** The reference follows it, and takes the answer at its target; the server follows none, a failure to decide. ## How it is checked The spaces run (`harness/spaces/compare.mjs`, `SPACES.md`) checks this page in `harness/spaces/policies.mjs`, with the server as a space's authority and host beside the alpha's: on each side an authority account (the server's on the server, the reference's on the alpha PDS), and peers on a second alpha PDS, the same accounts for both sides, as members and writers. Each request goes to both sides alike, with the space's URI on the side's authority, and the answers must be equal with each authority's DID named alike, as `PDS.md` says. Every draw (the members, their booleans, how they are batched, page sizes, keys) comes from the run's seed. In order, each stage on what the one before needs: 1. **Policies and lifecycle**, which need nothing else: every method's answers and refusals above, in their order, the policies stored as `getSpace` answers them, `managingApp`s of each form above, taken and refused; the member list put in batches, a DID given twice in one, an empty batch, 100 members and 101, removals of members, of DIDs never listed and of a DID twice, and its pages, with cursors before and after every DID, an empty one, and ones that are no DID; `removeWriter`'s answers; and deletion and creating again, with `authorizeSpaceSync` of the deleted space answering `SpaceDeleted` with no delegation token, one that is no JWT, and a `notify`, and `InvalidRequest` for a `credentialKey` that is no key. Each archive `exportSpaceMeta` answers is read on each side as this page says, its `Content-Type`, section order, key order, value shapes and limits, and must be the bytes of its own contents written again; then the two sides' contents must be equal, each `writer/` entry by its DID and `data` (`repoRev` and `spaceRev` must be TIDs, and differ between servers). `importSpaceMeta` is sent archives the harness writes: one valid, which `exportSpaceMeta` must then answer byte for byte; one for each fault above, and pairs of faults that show their order; and bodies of other `Content-Type`s and none. 2. **Publishing**, which reads the authority's repo with the space repo's `listRecords`, `getRecord`, `getLatestCommit` and `listRepoOps`: the records each change above writes and deletes, their values and CIDs; which changes make a commit, by the repo's `rev`; that a batch of `putMembers` or `removeMembers` is one commit holding an operation for each member, by `listRepoOps`; the refused direct writes; and `clearRecords` keeping the records. 3. **The writer set**, which needs write notifications: peers on the second PDS write into each side's space, the same records on both, and `exportSpaceMeta`'s `writer/` entries must show the same writers with the same `data` on both sides: who is tracked under each policy, the authority too; under `publicWrite`, an account not listed tracked and a member with `write: false` not; `removeWriter`, `putMembers` with `write: false` and `removeMembers` of a member taking writers out, and `removeMembers` of a writer not listed leaving it; a removed writer tracked again; `updateSpace` leaving the set; deletion emptying it; and the managing app asked about writes, and a write it fails to decide not tracked. That a write is not tracked is seen once a later write by a tracked peer, made after it, is. Writes enter the writer set only by write notifications, the notifications' part: until the server serves `com.atproto.space.notifyRepoUpdate` (the run probes it, and takes a `501` or `404` as not served), the writes are made on both sides, but only the reference's writer set is held to the page; compared from then on. 4. **Reads**, which need credentials: delegation tokens from each user's PDS traded with each side's `authorizeSpaceSync`, whose answers must agree (a credential, `SpaceNotFound`, `AppNotAuthorized` or `UpstreamFailure`) for members and others, `publicRead`, `allowedApps` with no attestation, a personalspace, and a managedspace. 5. **Takedown and deactivation**, each held to the reference alone until the server can deactivate and take down an account (it probes the server's `deactivateAccount`, and the admin's `updateSubjectStatus` with `PDS_ADMIN_PASSWORD`, which the run sets); compared from then on. With the account's token from before: the methods above, its space repo's five writes (and `createRecord` with a body past the limit, input the lexicon refuses, and another account's `repo`), and `getDelegationToken`; and `authorizeSpaceSync` of its space, as `SPACES-CREDENTIALS.md`'s "How it is checked" says. A managing app, played by the harness at a `did:plc` of its own with a `#forum` service, answers `checkAccess` from a table, and errs on purpose: it must be asked exactly for the accounts above, a read with no delegation token with no `repo`, with the parameters above, and every call's JWT must be as above, verified against the authority's key in the directory. An answer with another field, and one of status `201`, are taken; an error status (`500`, `401`), a `read` of `"true"`, an answer with no `write`, `{"authorized": true}`, a body that is not JSON, one of `Content-Type: text/plain`, and a fragment the app's document lacks each fail to decide (`502 UpstreamFailure`), the last with no call. Its document has services with other endpoints too, compared: with a path, a query, a bare `?` after a path, and a fragment, each asked at `/xrpc/com.atproto.managedspace.checkAccess` with the parameters above alone; and with a user and password, `ftp://`, and no scheme, each failing with no call. An answer in 600000 bytes fails, and one in 400000 bytes is taken, compared. Held to this page alone, as the reference follows redirects: an app whose endpoint answers `302` to the app fails to decide, the app not asked. With SSRF protection on, the server alone (`harness/spaces/ssrf.mjs`, near the end of the run, the server started again without `PDS_DISABLE_SSRF_PROTECTION`, then as before): a managing app `did:web:localhost%3A#forum`, and a `did:plc` whose services' endpoints are `http://127.0.0.1:`, `https://127.0.0.1:` and `https://localhost:`, each a plain TCP listener of the harness counting connections: a user's credential fails to decide (`502 UpstreamFailure`), and no listener sees a connection. Not compared: - OAuth `space:` scopes (`manage=create`, `read_self`, …): the run uses password sessions; `OAUTH-SCOPES.md`'s spaces checks call these methods with OAuth tokens. - Client attestations: `allowedApps` is checked only with none given, and a managing app is never sent `clientId`; that a listed client's attestation is accepted is the credentials'. - The time a managing app is waited for. - A managing app's redirect: the reference follows it; the server is held to this page. - SSRF protection: the reference runs without it. - What syncers are told of the writer set's changes, and `listWriters`: the notifications' part. - The server's writer set, until it serves `notifyRepoUpdate` (stage 3, above): the notifications' part. - Takedown and deactivation on the server, as above.