chadtmiller.com/group-host
atmosphere group host
A site's pages read a group's spaces whole, with an SDK
MergedThe pull adds @opensocial/sdk, space reads in a site's pages, and CORS on the space-read routes. I read AGENTS.md and the CORS change (space_api::cors and space_routes in lib.rs). I did not read the SDK, the shell, the console form or the docs. The diff is large because it includes the two pulls it sits on.
CORS. I found no problem with opening these routes to any origin.
- A search of
space_api.rsfound no cookie handling. The routes take a space credential bound to the caller's key, a MAC, or a delegation token. A cross-origin page therefore gets nothing from the visitor's session, and*without credentials is right. authorizeSpaceSynctakesnotify. A page could register a notify endpoint through it, but any server client can already do that. The endpoint must be https and the token is capped at 512 bytes.- The notify methods stay on the closed routes, as the body says.
corssets the headers on every response, including errors, and answers any OPTIONS request with 204 before routing. That is fine for these routes.
One thing to keep in mind: the allow-headers list must cover every header the SDK and lex-space send. If a browser read fails preflight, look there first. The e2e flows you list appear to cover it.
Approving.
The change since my approval at 34d1d75 is two commits. One moves the site publish flag parsing onto its own line. The other replaces os.records, os.onRecords and os.create/put/delete with os.space(uri), and moves the kit to web/shell/kit.js. I read web/shell/kit.js and web/shell/shell.ts in full. I did not re-read the docs, the SDK or the type definitions.
The CORS change I approved is untouched by these two commits.
The refactor holds up:
- The shell still checks every ask against the site's declaration.
syncneeds a space of a declared type, andcreate,putanddeleteneed a declared(space, collection). All of them need a session. - The kit's
syncpairs correctly with the shell'srecordspush. A push that arrives before the reply sets what the kit holds, and the first sync fires the listeners once if no push did. drop()clears the shell's spaces, and signing out also deletes the member's kept records from IndexedDB.
One small thing, not a blocker. After a sign-out the kit's os.space(...).records() still returns what the page already held. The page reloads on the next sign-in, so this only matters to a page that keeps showing records after the visitor signs out.
My approval at 1b9f571 stands. Since then the pull only moves how CI builds the space alpha, so the e2e flows that write in a space run on it. I read the whole diff since that commit. It touches no product code, so the CORS change and the SDK I approved are unchanged.
harness/alpha.shis the alpha build lifted out oftest.yml. It is the same steps, with the same skip whenATPROTO_COMMITandBUILDmatch what was built. It sets its ownPATH, so the e2e workflow can call it.e2e.ymlnow runs that script and caches/opt/atproto. It setsGROUP_HOST_DEV_ENV, andalpha.shis added to the pull'spaths.harness/e2e/setup.mjsstops the world and throws ifGROUP_HOST_DEV_ENVis set but the build speaks no spaces. That prevents the space-writing flows from being silently skipped in CI.docs/development.mdmatches the change.
My approval at 542a8ea stands. The head, 44b0c64, has no differences from that commit, so only the pull's title or body changed. The code I approved is the same, including the CORS change, the SDK and the kit. Nothing in the new text contradicts what I reviewed.
My approval at 542a8ea stands. This head has the same code as my last review, which found no differences from that commit, so only the title or body changed. I did not re-read the diff this round. The CORS change, the SDK and the kit I approved are unchanged, and nothing in the current description contradicts them.
Carried forward: the change this pull makes at ed69081950a0471d9ef67045fc44a1297cb13b59 is the one reviewed at 59e482b82ba96ff5c103dc3434e4fd89ad70a35b, so that review stands. What is new comes from its base.
A group's site can now read the group's spaces whole, in the visitor's browser, with a new
@opensocial/sdkbuilt on atproto's lex-space, so a page can list, count and thread what members wrote with no index in the host. This branch sits on site/reports and site/writes (at://did:plc:bcgltzqazw5tb6k2g3ttenbj/space/dev.knotless.space/group-host/did:plc:bcgltzqazw5tb6k2g3ttenbj/dev.knotless.pull/3n2hmbla3oq6n); until they merge, its diff shows their commits too. It changes who may call the host's space-read routes from a browser (CORS): that part wants a careful look.Claude Opus 5.5
What changes
The SDK (
packages/sdk,@opensocial/sdk). For apps on group hosts, in lex-space's own shape:GroupClient.open(agent, group)(by DID or handle) withgetGroup,members(),join,leave,report;GroupSpace, lex-space'sSpaceClientfor one of the group's spaces plus the records it read kept, and read on from each writer's head after (writers({cursor}),pullRepo), with an optional store to keep them between visits;listActorGroups,listActorInvites. Writes take lex-space's order (put(ns, value, {rkey})). A writer whose host fails keeps their last records and is retried next time; only a failure to list the writers fails a read. The host's methods are asked through the member's PDS (servicethe host's#opensocial).A site's spaces. A site's record, and
putSite, may namespaces: the space types its pages read whole as the visitor. Its sign-in asksspace:<type>?authority=<group>&action=readfor each. The host's page answers with the SDK, oneGroupSpaceper space, kept in IndexedDB at the address's origin.opensocial site publish --spacesand thesite_publishtool take them.The kit in the SDK's shape. A page asks a space as an app asks the SDK:
os.space(uri)answers an object withsync(),records({collections}),onChange(fn),create(collection, value, {rkey}),put(collection, value, {rkey})anddelete(collection, {rkey}), which replaceos.create,os.putandos.delete(space, collection, rkey, record). The kit moved fromcrates/group-host/src/site_kit.jstoweb/shell/kit.js, beside the host's page that answers it;web/shell/protocol.tslists the messages between them once, andnpm run checkinweb/now type-checks the shell and the kit against it (it checked neither before).CORS on the space-read routes.
getRecord,listRecords,getRepo,getLatestCommit,listRepoOps,getBlob,listBlobs,authorizeSpaceSyncandlistWritersanswer any origin, allowing the headers a space credential and a MAC travel in, so a browser can read a space as any app does. The notify methods stay closed to browsers. Each of these calls is authorized by a space credential bound to the caller's key, or a delegation token, never a cookie.The console's site form keeps a site's
spacesandactsunder Advanced, and sends them when it publishes.Docs. The sites design page (why a site reads spaces in the browser, and to what size that fits), the site kit, the API, command and MCP references, a new reference for the SDK, the overview and
AGENTS.md's layout. CI, the Dockerfile andjust fmt/lintinstall, check and format the SDK.Why
The host was growing an index of every space, with counts, links and orders, to answer pages' questions (parked, not in this pull). Measured against a group host world, reading every member's repo directly, as lex-space does, is fine up to a few thousand records in a space (a first read of 0.5-0.8 s for ~2,000 records; views worked out in the browser in a couple of milliseconds), and reading on after is cheap at any size. So for groups of ordinary size, the host stays the group's PDS and authority and keeps no copy of its spaces: the access record decides what each visitor reads at every repo, and an app or a site reads the same way, with one SDK.
How it was checked
packages/sdk: 16 vitest tests (reading on with new, edited and deleted records; a removed writer; a gap falling back to a snapshot; an unavailable repo; one writer failing while the rest are kept; two syncs at once; collection filters; the store round trip; writes' order).tests/sites.rs: a site with only spaces is live, asks a read scope per type, its config carries them; a repeated or empty type is refused.tests/spaces.rs: a page anywhere may read a space (CORS), and a syncer's read answers its origin.os.records.just lookon desktop and phone, and critiqued.just lex,just docs,just lint, the coverage run (no test failed; nothing this branch added uncovered).Shortcomings
createdAt, which a writer chooses.getGroupAuth);fyi.opensocial.participatelacksgetGroup,listMembersandgetActorGroups, so an app asking only for it cannot make every SDK call.Review
Start with the CORS change (
crates/group-host/src/space_api.rs,cors, andlib.rs'sspace_routes): is opening these routes to any origin right? Thenweb/shell/shell.ts's records ask and its error mapping, andpackages/sdk/src/group-space.ts'ssync.