zat.dev/zds
atproto pds · mirror of https://tangled.org/zat.dev/zds
zds 0.25.1 Latest 2 packages, all images
Space policy upgrade (v0.7.0)
History: the v0.7.0 upgrade guide for the October 29, 2026 alpha. Later alphas renamed several methods it names (
getSpaceCredentialisauthorizeSpaceSync,listReposislistWriters); the current contract is permissioned data.
ZDS v0.7.0 adopts the October 29, 2026 Spaces alpha
(migration guide,
reference implementation at
5d88b414a).
A space is governed by one policy object instead of the simplespace read
policy, write policy, and app access. Old routes and request shapes are removed,
not translated.
Client changes
| October 22 | October 29 |
|---|---|
com.atproto.simplespace.{createSpace,updateSpace,getSpace,deleteSpace} | com.atproto.space.* |
com.atproto.simplespace.{putMember,removeMember,listMembers} | com.atproto.memberspace.* |
com.atproto.simplespace.checkUserAccess | com.atproto.managedspace.checkUserAccess |
readPolicy, writePolicy, appAccess | policy |
{
"spaceType": "example.shared.notes",
"policy": {"$type": "com.atproto.memberspace.policy", "publicRead": true}
}
updateSpacetakes{space, policy}and replaces the policy wholesale. To change one field, read it withgetSpaceand send the whole object back.getSpacereturns{uri, policy}to the owner only. A space credential gets 401; syncers read the publishedcom.atproto.space.policy/selfrecord.- Member methods on a space under another policy answer
PolicyMismatch. - A user the policy refuses gets
SpaceNotFoundfromgetSpaceCredential, notAccountNotAuthorized.AppNotAuthorizedcomes only after the user passes. - Managing apps serve
com.atproto.managedspace.checkAccess(the lexicon review's name), checklxmagainst that NSID, and answerreadandwritetogether. ZDS omitsrepofor a credential request that carries no delegation token. - The authority no longer appears in its own member list; it is authorized under every policy without one.
New methods: com.atproto.space.removeWriter and
com.atproto.space.clearRecords, and since v0.7.1 the account-migration methods
below.
Moving spaces with an account (v0.7.1)
After the usual account migration steps, a migration tool:
- Lists the account's spaces on the old host with
com.atproto.space.listSpaces, followingcursor. The spaces the account is the authority of are those whosespaceURI names the account's DID. - For each owned space, downloads
com.atproto.space.exportSpaceMeta?space=…and POSTs the bytes tocom.atproto.space.importSpaceMetaon the new host withContent-Type: application/vnd.dasl.star. This must come before importing the account's own repo in that space, which otherwise answersSpaceNotFound. - For each space the account holds a repo in, downloads
com.atproto.space.getRepofor its own repo and POSTs it tocom.atproto.space.importRepo, then copies the repo's blobs withcom.atproto.space.listBlobsandgetBlobon the old host andcom.atproto.repo.uploadBlobon the new one. A blob an imported record references is kept.
Imports replace what the new host holds, so a failed step can be retried. They
take the account's own session or OAuth (manage=create and manage=update for
importSpaceMeta, create for each collection in the archive for importRepo), not
an app password, and accept archives up to 128 MiB. Writer entries keep their
spaceRev, so syncers' listRepos cursors stay valid; the imported repo gets a
new rev with unchanged data. Notification registrations, credential revocations,
and deleted-space tombstones are not carried over.
Stored data
Startup converts each authority space once, in one transaction, as the
reference PDS's 006-space-policy does:
| stored simplespace configuration | policy |
|---|---|
| managing app on read, write, or both | managedspace with that app; member list and app allow-list deleted |
| otherwise, public read | memberspace with publicRead: true |
| otherwise, public write | memberspace with publicWrite: true |
| app access allow-list | memberspace allowedApps |
simplespace_members moves to memberspace_members without the authority's
own rows, and the per-side policy columns are dropped. Migrated spaces publish
nothing. A binary rollback cannot read the new schema, so back up the database
before upgrading.
A configuration with a managing app on only one side has no exact equivalent:
the app is then asked about both sides, a public read side stops issuing
credentials without a delegation token, and a member list or allow-list is
dropped. Before deploying, list affected spaces with the read-only query in
tools/space-policy-preflight.sql
against a copy of the database:
sqlite3 -readonly zds-copy.sqlite3 < tools/space-policy-preflight.sql
No rows means no space changes access.
Differences from the reference PDS
checkAccesson ZDS is the generic PDS answer, denying bothreadandwrite.- ZDS validates
managingAppas a DID with an optional non-empty service fragment; the reference checks only thedid:prefix. clearRecordsapplies no separate write rate limit; ZDS has none for space writes.- The space imports accept up to 128 MiB, as
com.atproto.repo.importRepodoes, and have no "accepting imports" switch.com.atproto.repo.importRepoitself still accepts app-password sessions; the space imports do not. Aligningrepo.importRepois a follow-up.
Validation
just test covers policy normalization and rejection, the legacy mapping, the
startup migration and its restart, published records through every flag and
$type change, writer removal, and clearRecords (scope checks, kept records,
the empty digest, no-op). just smoke-permissioned exercises the routes over
HTTP, including a stub managing app for read and write checks.