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

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
286 lines · 15.9 KB Raw History
# spaces alpha upgrades

> History: how ZDS followed each Spaces alpha from October 1 to November 12,
> 2026, with the interop evidence and measurements recorded at the time. Method
> names here are those of their alpha; the current contract is
> [permissioned data](https://tangled.org/zat.dev/zds/blob/main/docs/permissioned-data.md), and each release is in the
> [changelog](https://tangled.org/zat.dev/zds/blob/main/CHANGELOG.md).

## client-visible contract across implementations (2026-08-21)

This historical comparison informed plyr.fm (#1897, #1898). The behaviours were checked
against the reference PDS (`permissioned-data` branch), rsky, and
atproto-crates so that nobody mistakes them for ZDS quirks and "cleans them
up".

| behaviour | reference | rsky | atproto-crates | ZDS |
|---|---|---|---|---|
| `scopes_supported` lists `space:*` (or any granular scope) | no (`atproto` + `transition:*` only; "dynamic scopes can't be enumerated") | no | no | no (it did until 2026-08-21; the hints were a ZDS invention nobody consumed) |
| `authority=*` in a `space:` grant matches any authority; `self` resolves to the granting user at token issuance | yes | yes | yes | yes |
| `getDelegationToken` needs only a covering `read` grant, signs with the requester's own repo key, and never checks that the authority is local | yes | yes | yes | yes |
| `listMembers` (then `simplespace`) is the authority's private state | owner-only (`read_self` scope + owner assert) | owner-only (`manage=update`) | any *member* with `read_self` | owner-only (`manage=update`) |

Clients must not infer capability from `scopes_supported`: the grant on the
issued token is the only portable signal. `listMembers` is the one row where
implementations differ; a client should treat it as owner-only.

The September policy update supersedes the ZDS `listMembers` scope cell above:
ZDS now requires the owner and a covering read grant. Other implementations
in this historical table have not been rechecked for the October alpha.

## October 1 upgrade

Startup creates the revocation, sequence, and notification tables and backfills
existing writer rows with ordered space revisions. Existing records, blobs,
policies, and memberships retain their format. Old DID-based writer cursors
must be discarded; clients bootstrap again from `listWriters` without a cursor.
Clients must reacquire credentials and use HTTP signatures. The old Spaces
DPoP scheme and `type` request field are not compatibility paths.

The local consumers requiring follow-up are plyr.fm's Python client, Doodl's
browser/live/preview services, and Lore's extension and website. Doodl and Lore
also need the prior release's policy split and all three still have membership
callers to update. These are the downstream migration requirements for v0.4.0;
ZDS does not translate the previous wire contract for old clients.

## October 1 release verification

The implementation follows the October 1 migration prompt and pinned reference
implementation described above. HTTP signature parsing remains local to ZDS;
DID-key decoding and JOSE verification use `zat`. The published October 1 SDK
passes bidirectional signature interoperability checks, including unpadded
base64, reusable proofs, high-S signatures, and repository audience isolation.

Five alternating local ReleaseFast storage runs against the preceding committed
HEAD, with 1,000 seeded records, showed median throughput changes of +2.5% for
writes, +0.6% for single-record reads, -2.9% for record listings, -1.5% for repo
exports, and -4.7% for writer listings. These are synthetic storage measurements.
A separate ReleaseSafe HTTP probe completed 4,000 credential reads without
failure; at 16 concurrent callers it measured about 5,800 requests/second and
4.3 ms p95 latency. It is not a sustained production soak.

Cross-PDS performance comparison remains a follow-up: the existing official PDS
and Tranquil benchmark probes cover public repos, not equivalent Spaces work.
The SDK interop lane establishes wire compatibility, not performance parity.
Downstream application migrations are separate work.

## managing-app denial on 2026-10-05

One managing-app denial predates the failure logging ZDS now does and is not
explained. It happened under the
November 5 alpha's method names, before `checkAccess`: on 2026-10-05 a
managing-app space on `pds.zat.dev` (v0.4.1) refused a requester hosted on
another PDS, and the app's operator saw no `checkUserAccess` arrive. What was
established afterwards, without the operator:

- v0.4.1 and v0.5.0 builds both resolve that app's `did:web` and deliver
  `checkUserAccess` to it, so resolution, request shape, and transport are not
  at fault in either version.
- With the authority on one local zds, the requester on a second, and a
  managing app that verifies the token's signature against the authority's DID
  document, v0.5.0 issues the credential. The cross-PDS path and the token are
  valid.
- An `aud` comparison against the bare DID on the app's `checkUserAccess`
  route would produce exactly the reported symptom. It is not confirmed: the
  same app accepted forwarded `notifyWrite` calls, whose `aud` has the same
  form.

The stored policy row for that space was not read.

## October 21 upgrade

This is a hard cut with no compatibility path; Spaces is alpha. Clients must:

- send `getSpaceCredential` as a JSON body with `credentialKid` and
  `delegationToken`, and stop signing the credential request
- present credentials as `Atproto-Space-Credential` and sign under the
  `atproto-space-credential` label with the matching `tag`
- read `getRepo` as STAR rather than CAR, and stop passing `excludeValues`
- name the authority as `#atproto_pds` in delegation and service-auth audiences

The local consumers that mint credentials are plyr.fm's Python client, Doodl's
browser and sync worker, and Lore's extension and website. Stash and recite
use only self-owned spaces through OAuth and are unaffected. Clients can now
check `describeServer.spacesAlpha` instead of probing with an authenticated
request.

The interop lane passed against branch source `232b2cdce`: body-carried
credential requests, tagged signatures including high-S and unpadded forms,
cross-repo audiences, and STAR export verified by the upstream verifier.

Three alternating local ReleaseFast runs of `zds-bench --scenario space
--records 1000` against the preceding release commit `6a1baad` gave median
`getRepo` throughput of 643 ops/s for STAR against 587 ops/s for CAR, with the
archive about 30% smaller because it carries no CIDs or index. Full
verification measured 240 against 247 ops/s, since STAR verification derives
each record CID instead of reading it from the index. These are synthetic
storage measurements; no official PDS or Tranquil probe covers Spaces exports.

## October 22 upgrade

This is a hard cut with no compatibility path. Syncers holding a space
credential must:

- resolve the author's `#atproto_kem` key and send `Atproto-Space-Want-Mac` on
  `getLatestCommit`, `listRepoOps`, `getRepo`, and `getRecord`
- verify `Atproto-Space-Mac` against the shared secret instead of a commit
  signature
- read commits as `{ver, repo, space, rev, data}`; `hash`, `mac`, `ikm`, and
  `sig` are gone, in JSON and in the STAR metadata
- treat `getLatestCommit` on a repo with no writes as `RepoNotFound`; it
  previously answered `{}`

OAuth reads of the caller's own repo are unaffected unless they opt in to the
header.

The interop lane passed against the published
`0.0.0-spaces-alpha-20261022141228` snapshot: the SDK's `encapsulate`,
`verifyCommit`, `verifyRecord`, and `verifyRepoStarFull` accept ZDS responses
for all four reads. Unit tests pin the RFC 9180 §A.3.1 KEM vector, KEM, commit,
and record MAC vectors from that snapshot, and a STAR archive it serialized.

One known difference from the reference PDS at `3a0b8c6`: ZDS answers
`RepoNotFound` with HTTP 404, as it does for every other not-found read, where
the reference throws `InvalidRequestError` (400). The error name is the same,
and clients key off the name.

## October 29 upgrade

The October 29 alpha replaces `com.atproto.simplespace.*` with a single space
policy. ZDS cuts over without a compatibility path; the
[upgrade guide](https://tangled.org/zat.dev/zds/blob/main/docs/history/space-policy-upgrade.md) covers the client changes, the startup
migration, the pre-flight query, and where ZDS differs from the reference.

The interop lane passed against `0.0.0-spaces-alpha-20261029171913`. That
snapshot's `@atproto/lex-cbor` range also resolves `0.0.0`, which still names
`workspace:*` dependencies, so pin the `@atproto` packages with pnpm overrides
(pnpm 11 reads them from `pnpm-workspace.yaml`):

```yaml
packages: []
overrides:
  "@atproto/car": "0.0.0-spaces-alpha-20261029171913"
  "@atproto/crypto": "0.0.0-spaces-alpha-20261029171913"
  "@atproto/lex-cbor": "0.0.0-spaces-alpha-20261029171913"
  "@atproto/lex-data": "0.0.0-spaces-alpha-20261029171913"
  "@atproto/space": "0.0.0-spaces-alpha-20261029171913"
  "@atproto/syntax": "0.0.0-spaces-alpha-20261029171913"
```

then `pnpm add @atproto/space@0.0.0-spaces-alpha-20261029171913
@atproto/crypto@0.0.0-spaces-alpha-20261029171913` in that project. Beyond the
October 22 checks, the lane reads the authority's published records back with
`readRepoStar` and verifies a cleared repo with `verifyRepoStarFull`.

## November 5 upgrade

The November 5 alpha adopts the published STAR spec (dasl.ing, 2026-11-03):
a `0x01` control byte before every pair and a `0x00` byte ending the archive.
ZDS reads and writes it through zat 0.7.0-alpha, so `getRepo`,
`exportSpaceMeta`, and both imports use the new framing and reject STAR-lite
archives, including exports from hosts that have not upgraded.

The same alpha settles account status for spaces. A taken down, suspended, or
deactivated authority answers `getSpaceCredential` and `listRepos` with
`RepoTakendown`, `RepoSuspended`, or `RepoDeactivated`, while credentials it
already issued stay valid until they expire. Space writes and management need an
active account. A taken down account keeps a limited `allowTakendown` session
for `listSpaces`, `exportSpaceMeta`, and its own repo's `getRepo`, `listBlobs`,
and `getBlob` (see the takedown runbook). As in the reference, space reads
check the caller's token before the repo's status, so the limited session gets
`InvalidToken` outside its grant, and an admin token reads any repo that is not
deleted.

The interop lane passes against `0.0.0-spaces-alpha-20261105160032`, now pinned
in `tools/space-sdk`. That snapshot's `@atproto/space` depends on
`@atproto/star@0.0.0-stage`, whose npm tarball fails to extract, so the pin
overrides it with the snapshot's own `@atproto/star`. The snapshot no longer
exports a repo serializer; the reference writer is `@atproto/star`'s
`writeStar`, and it reproduces the repo fixture byte for byte (now in zat, see
[space-reference-repo.md](https://tangled.org/zat.dev/zat/blob/main/src/internal/space/testdata/space-reference-repo.md)).

## November 6 moderation

Proposal 0016's moderation section (bluesky-social/proposals#132) asks a repo
host for account takedown across all spaces, which the November 5 upgrade
covers, and for blob takedowns that reach space blobs. A space blob is the same
`(did, cid)` blob as a public one, so `com.atproto.admin.updateSubjectStatus`
with a `repoBlobRef` stops `space.getBlob` and `sync.getBlob` together (see the
takedown runbook).

Label records (`com.atproto.label.record`) are ordinary space records written by
the labeler or the space authority. ZDS stores any collection in a space, so it
needs nothing extra to host them; deciding which labels to honor is an app's job.

## lexicon review (bluesky-social/atproto#5800)

The lexicon review settles the names and shapes of the space lexicons. It merged
into the `permissioned-data` branch on 2026-11-11, and ZDS follows that branch's
tip. The November 5 names and shapes are removed, not translated: Spaces is an
alpha, so clients on the old names update rather than ZDS keeping them working.

- **Methods.** `listWriters`, `notifyRepoUpdate`, `notifyCredentialsRevoked`,
  `notifySpaceStatus` (status `deleted`), `memberspace.putMembers` and
  `removeMembers`, and `managedspace.checkAccess`. A service token's `lxm` must
  match the name it calls.
- **Fields.** `createSpace`, `getSpace`, and `listSpaces` carry `space`;
  `listWriters` entries carry `repo`. Requests take `credentialKey`, `repo`
  (`removeWriter`), and `spaceDid` (`listSpaces`). `listSpaces` entries add the
  caller's `repoRev` and `data`, and the authority's latest `spaceRev`.
  `listBlobs` takes no `since` and `listRecords` no `reverse`.
- **Errors and encodings.** `NotAuthorized`, `InvalidSpaceMac`,
  `AccountNotAuthorized`, `InvalidRepoFile`, `RepoMismatch`, `InvalidSpaceMeta`,
  `InvalidCursor`, and `application/vnd.dasl.star` for STAR bodies. A
  notification whose issuer, audience, or writer doesn't fit answers 403
  `Forbidden`; a service token whose `lxm` isn't the called method answers 401
  `BadJwtLexiconMethod`. `getSpaceCredential` answers `SpaceDeleted` with or
  without a delegation token.
- **Service references.** `managingApp` and the `registerNotify` service must be
  `did#serviceId` on a did:plc or a pathless did:web. The `service-refs-v1` migration rewrote stored bare DIDs to
  `did#atproto_pds`. `unregisterNotify` takes service auth from the
  registered service, addressed to the space authority.
- **Scopes.** A space scope names its type positionally (`space:<nsid>`) or with
  `spaceType` (`space?spaceType=<nsid>`), not both. Both forms resolve to the
  same grant at token issuance.
- **Managed spaces without a delegation token** ask the app about an anonymous
  reader (`checkAccess` without `repo`).
- **Archives.** Space metadata archives name the writer field `repoRev`.

The SDK lane installs the November 12 alpha from npm
(`0.0.0-spaces-alpha-20261112204144`). Its packages depend on each other with
caret ranges, which also match unrelated `0.0.0` releases, so
`pnpm-workspace.yaml` overrides every `@atproto` package in the tree to the
alpha. At this release `verifyCommit` and `verifyRecord` throw rather than
return a boolean, `createSpaceSigHeaders` takes `{authorization, audience,
keypair}`, and the archive writer is `writeSpaceMetaStar`. MACs are requested
with `formatMacRequest` and checked from the response's headers (`{keyShare,
sharedSecret, headers}`).

## November 12 alpha

The November 12 alpha settles the Spaces API's names and shapes ahead of beta;
ZDS v0.10.0 follows it at `d4def6e9f` (bluesky-social/atproto#5864 and the
tidy after #5877), with no aliases for the earlier names:

- `getSpaceCredential` is `authorizeSpaceSync`, which adds `spaceRev` to its
  output and takes `notify: {endpoint, token}` to register a syncer.
  `registerNotify`, `unregisterNotify` and `notifySpaceStatus` are gone; ZDS
  calls `confirmRegistration` before a new registration and sends
  `notifySpaceUpdate`. See the [access model](https://tangled.org/zat.dev/zds/blob/main/docs/permissioned-data.md#access-model).
- `com.atproto.space.defs#repoWrite` and `#repoRemoved` are whole entries,
  `{repo, repoRev, data, spaceRev}` and `{repo, spaceRev}`, shared by
  `listWriters` and `notifySpaceUpdate` (where they add `prevSpaceRev`).
- `notifyRepoUpdate` is only the repo host's call, `{space, repo, repoRev,
  data}`.
- The commit MAC tag is `atproto-space-commit`, through zat `v0.7.0-alpha.7`.
- A managing app that fails to answer is `UpstreamFailure`, not a denial.
- Imports require `application/vnd.dasl.star`; list cursors and `allowedApps`
  are validated as the lexicons declare.

Not applicable to ZDS: space type declarations' `title` (ZDS reads only a
declaration's `collections`, so its consent screen shows the NSID either way),
the moderation and access-control guidance, and the reference PDS's own
migrations. Garbage collection of empty repos and removed writers after 72
hours is optional, and ZDS does not collect. ZDS never revokes credentials as
a space host, so no registration is dropped for a revoked credential; it
honours `notifyCredentialsRevoked` as a repo host.