Monorepo for wisp.place. A static site hosting service built on top of the AT Protocol. wisp.place

main-app: claim a wisp subdomain and map its site in one step #96

Merged nekomimi.pet
targeting main from fix/claim-subdomain-site-not-ready
Merged opened by and assigned to nekomimi.pet
targeting main from fix/claim-subdomain-site-not-ready

Deploying a site and claiming a wisp subdomain for it straight away (wispctl deploy then wispctl domain claim-subdomain) returned a 500, yet the domain was claimed with no site mapped. I hit this publishing field-notes.wisp.place; a retry a minute later mapped it.

Cause: claimSubdomain inserted the domain row, then set its rkey separately. domains.rkey has a foreign key to site_cache(did, rkey) (fk_domains_site_owner), and the firehose fills site_cache a few seconds after a deploy, so the second statement failed after the first had committed.

Fix: wait for the site cache like the dashboard mapping route already does (waitForSiteCache), and insert the domain with its rkey inside the claim transaction. If the site still is not cached, the claim rolls back and the caller gets 503 SiteNotReady.

Tests: new postgres test (uncached site claims nothing; cached site claims and maps together); two mutants fail it. Root suite 2187 pass, tsc and biome clean. The route-level wait and 503 mapping have no direct test, since xrpc.ts imports db directly rather than taking it as a dependency.

Commits 0