Skip to content

fix(web): sync spaces with the 10-22 alpha's credential requests, MACs, and STAR repos - #235

Merged
botandbang merged 7 commits into
mainfrom
bnb/spaces-alpha-10-22
Oct 25, 2026
Merged

botandbang merged 7 commits into
mainfrom
bnb/spaces-alpha-10-22

Conversation

@botandbang

Copy link
Copy Markdown
Contributor

What and why

The spaces alpha's 10-22 release changed how syncers talk to space and repo hosts. The root account's PDS (spaces-alpha.host.bsky.network) runs it now and answers the Atproto-Space scheme this app sends with 400 InvalidToken: Unsupported authorization type: Atproto-Space, so space sync (audit, moderation, staff, bookings, press kits) fails. /healthz doesn't check sync, so it still says ok.

This moves every @atproto/* package from 0.0.0-spaces-alpha-20261001173819 to 0.0.0-spaces-alpha-20261022141228 and follows upstream's migration notes.

Changed:

  • getSpaceCredential gets {space, credentialKid, delegationToken} as a JSON body instead of a Bearer token and an HTTP signature. InvalidDelegationToken is logged and keeps the watch; SpaceDeleted still drops it.
  • Credentialed requests use the Atproto-Space-Credential scheme.
  • An authority's #atproto_pds is its space host. The #atproto_space_host lookup in identity.ts is gone.
  • Every listRepoOps page, getRepo, and space getRecord asks for a MAC with a fresh key share against the author's #atproto_kem key and checks it. On a MAC failure the DID document is re-resolved once and the request retried. An account that publishes no KEM key shows as a sync error that says so.
  • Full recovery reads STAR archives and still removes local records the archive doesn't have.
  • onSpaceDeleted waits out a running pass, then purges; repeats are no-ops, and a recreated space resyncs from scratch. The new bookings.forget removes a deleted booking space's thread so a recreated one starts clean.
  • A writer's repo host answering SpaceDeleted no longer drops the space; only getSpaceCredential and listRepos, which the authority answers, can.
  • readSpaceRecord moves from app.ts into credentials.readRecord.
  • The README's sync section describes the new protocol.

Added: a FakeSpaceHost test helper that speaks the 10-22 protocol, credentials.test.ts, a repo-host suite in engine.test.ts, and an integration flow that deletes and recreates a booking space against the real 10-22 PDS.

Re-resolving the overrides also moved oxlint-tsgolint from 7.0.2003 to 7.0.2004 and legacy-javascript from 0.0.3 to 0.0.4 in the lockfile. The app doesn't follow the firehose, so a rotated KEM key is picked up when the DID document cache expires (5 minutes) or on the first MAC failure.

How it was tested

  • pnpm test:integration against the in-process 10-22 PDS, including the new deletion and recreation flow
  • The new unit tests cover the credential request shape, the scheme, forged commit and record MACs, KEM rotation, a missing KEM key, STAR recovery, repeated deletion, deletion during a running pass, and a writer's host claiming the space was deleted
  • pnpm verify, pnpm test:coverage, and pnpm dev:network with every space syncing

Checklist

  • Tests cover the change
  • For the website: Storybook stories cover any new UI states
  • For locallibrary: apps/locallibrary/CHANGELOG.md has a line under Unreleased, if people using it will notice
  • The READMEs, docs/ and --help still say what the code does

…s, and STAR repos

The spaces alpha's 10-22 release changed how syncers talk to repo and space hosts, and PDSes on it reject the old Atproto-Space scheme, so space sync stopped. This moves every @atproto package to 0.0.0-spaces-alpha-20261022141228 and follows the new protocol: getSpaceCredential takes its delegation token in the body, requests use Atproto-Space-Credential, an authority's #atproto_pds is its space host, commits and records are checked with MACs derived from each author's #atproto_kem key, and full recovery reads STAR archives. Repeated space deletions are no-ops, and a recreated space resyncs from scratch.
A sync pass dropped a space, and now its booking thread too, on any SpaceDeleted or SpaceNotFound, including one from a writer's own repo host, so any member's PDS could make the app purge a space. Errors now carry the method that answered, and only SpaceDeleted from getSpaceCredential or SpaceDeleted/SpaceNotFound from listRepos, both answered by the authority, drop the space. Anything else is recorded on the repo and the space.
@botandbang
botandbang requested a review from bnb as a code owner October 25, 2026 09:44
@github-actions github-actions Bot added documentation Improvements or additions to documentation dependencies Pull requests that update a dependency file web The Local Network website (apps/web) web: bookings Booking inquiries and their threads web: server Spaces, sync, HappyView, the database and the server around them tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings labels Oct 25, 2026
# Conflicts:
#	apps/web/README.md
#	apps/web/tests/integration/flows.test.ts
@socket-security

socket-security Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatednpm/​@​atproto/​oauth-scopes@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122890 +21007199 +1100
Updatednpm/​@​atproto/​space@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122879 +110072 +197 +1100
Updatednpm/​@​atproto/​common-web@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-202610221412281001007599 +1100
Updatednpm/​@​atproto/​lex-cbor@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-202610221412281001007699 +1100
Updatednpm/​@​atproto/​lex-json@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-202610221412281001007799 +1100
Updatednpm/​@​atproto/​lex-data@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-202610221412281001007899 +1100
Updatednpm/​@​atproto/​lex-resolver@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122898 -11007899 +1100
Updatednpm/​@​atproto/​sync@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122883 -71009899 +1100
Updatednpm/​@​atproto/​identity@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122895 -21008399 +1100
Updatednpm/​@​atproto/​dev-env@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122884 +11008599 +1100
Updatednpm/​@​atproto/​crypto@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-2026102214122810010085 +198 +1100
Updatednpm/​@​atproto/​lexicon@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-202610221412281001008599 +1100
Updatednpm/​@​atproto/​oauth-client-node@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-20261022141228991009999 +1100
Updatednpm/​@​atproto/​api@​0.0.0-spaces-alpha-20261001173819 ⏵ 0.0.0-spaces-alpha-20261022141228100100100 +199 +1100

View full report

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/localtoolbox

Status Category Percentage Covered / Total
🟢 Lines 100% (🎯 100%)
🟰 ±0 pp
4284 / 4284
🟢 Statements 99.64% (🎯 95%)
🟰 ±0 pp
5839 / 5860
🟢 Functions 99.65% (🎯 95%)
🟰 ±0 pp
1713 / 1719
🟢 Branches 97.71% (🎯 50%)
🟰 ±0 pp
2774 / 2839
File CoverageNo changed files found.
Generated in workflow #452 for commit 092eb21 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Packaged (localtoolbox.zip) 360.6 KiB 360.6 KiB +22 B (+0%)
Unpacked (dist/) 836 KiB 836 KiB 0 B (0%)

@github-actions

github-actions Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

Coverage Report for apps/web

Status Category Percentage Covered / Total
🟢 Lines 94.31% (🎯 93%)
⬆️ +0.61 pp
5853 / 6206
🟢 Statements 92.66% (🎯 91%)
⬆️ +0.46 pp
9049 / 9765
🟢 Functions 93.25% (🎯 92%)
⬆️ +0.27 pp
2294 / 2460
🟢 Branches 81.97% (🎯 80%)
⬆️ +0.92 pp
4165 / 5081
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
apps/web/src/lib/server/app.ts 68.34%
⬆️ +0.76 pp
46.66%
⬆️ +3.81 pp
54.05%
⬆️ +1.28 pp
75.63%
⬆️ +0.63 pp
83, 115, 139, 141, 144, 199-212, 274, 284, 291, 294-295, 304, 310, 326-348, 352, 361-364, 374-379
apps/web/src/lib/server/atproto/credentials.ts 87.4%
⬆️ +21.85 pp
71.18%
⬆️ +35.89 pp
93.1%
⬆️ +24.35 pp
90.26%
⬆️ +21.51 pp
99, 129, 146, 153-160, 193, 231-248, 382
apps/web/src/lib/server/atproto/identity.ts 86.48%
⬆️ +4.56 pp
83.33%
⬆️ +5.81 pp
78.57%
⬇️ -1.43 pp
96.66%
⬆️ +4.13 pp
70, 87, 100, 108, 117, 120, 124, 136, 150, 173
apps/web/src/lib/server/services/bookings.ts 94.26%
⬆️ +0.72 pp
81.18%
⬆️ +0.99 pp
100%
🟰 ±0 pp
99.24%
⬆️ +0.01 pp
86, 94, 164, 217, 223, 252, 260, 301, 322
apps/web/src/lib/server/sync/engine.ts 89.28%
⬆️ +9.83 pp
77.27%
⬆️ +19.96 pp
87.17%
⬆️ +4.32 pp
92.35%
⬆️ +7.98 pp
125, 144, 150, 167, 199, 253, 262-280, 292, 410-411, 420, 445, 557, 579, 598
apps/web/src/lib/server/testing/space-host.ts 92.8% 84.72% 100% 97.14% 106, 125, 137, 157, 164, 167, 182, 192, 246
Generated in workflow #467 for commit 092eb21 by the Vitest Coverage Report Action

Size

Compared with main. KiB are 1,024 bytes.

This pull request main Change
Client JavaScript 619.1 KiB 619.1 KiB 0 B (0%)
Client JavaScript, brotli 204.5 KiB 204.5 KiB 0 B (0%)
Client CSS 87.6 KiB 87.6 KiB 0 B (0%)
Client CSS, brotli 12.5 KiB 12.5 KiB 0 B (0%)

bnb
bnb previously approved these changes Oct 25, 2026
@botandbang
botandbang merged commit 901089f into main Oct 25, 2026
50 checks passed
@botandbang
botandbang deleted the bnb/spaces-alpha-10-22 branch October 25, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation tests Tests, fixtures and test harnesses tooling Repo config, lint and build tooling, and GitHub settings web: bookings Booking inquiries and their threads web: server Spaces, sync, HappyView, the database and the server around them web The Local Network website (apps/web)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants