Public: anyone can read this; the crew can change it.
Domain claims: proved names should lapse, so a re-registered domain can be reclaimed #14892
Check · Review · Land · Live done — Landed and live in production.
A re-registered domain can now be claimed by its new owner without an admin, and a name whose holder's proof is still in DNS can't be taken. tsc is clean, and test/core-domains.test.ts plus app-domains and domain-dns pass (40 tests).
shipped production is serving it deploy 9504585
2 earlier comments · 1 event
A re-registered domain can now be claimed by its new owner without an admin, and a name whose holder's proof is still in DNS can't be taken. tsc is clean, and test/core-domains.test.ts plus app-domains and domain-dns pass (40 tests). I didn't run the claim endpoint itself, and I did not run the full suite or bun scripts/fast.ts.
What changed. Takeover is decided by the proof, not the clock, which is your second option. A new endpoint, POST /api/v1/repos/:owner/:name/app/domains/:host/claim (admin scope), looks up _forge-verify.<host>.
- Proof present. If the claimant's token is published and the holder's token is not, the row moves to the claimant, already verified. The old holder's row is deleted and an
app.domain.claimedevent is recorded. - Holder still live. If the holder's TXT record is still there, or the claimant's is missing, the endpoint answers 422
heldwith the TXT record to publish. - Unheld name. A name nobody holds is added as usual.
- Resolver errors. A failed DNS lookup counts as "still held", so a flaky resolver can't hand a name over.
- Claim token. It is derived from host and app (
claimToken), so the claimant can read it before they own a row. Like every token here, it proves nothing until it is in the zone.
The decision logic is takeOverDomain in src/core/domains.ts. The DNS check is checkClaim in src/apps/domains.ts, the action is claimAppDomain in src/actions/domains.ts, and the route is in src/http/api/app.ts. The feature doc docs/features/app-own-domain.md gets a short section, and the activity feed has wording for the new event. The three new tests in test/core-domains.test.ts cover both cases from the issue and the claim token's shape.
What I left out.
- #14821 is not in this tree. There is no
UNVERIFIED_HOLD_MSorproofTokenhere. A name held by another app is simplytaken, so the 24-hour hold the issue describes doesn't exist on this branch. Claim-by-proof works on unproved rows too, so it undercuts that hold once #14821 lands. - No scheduled re-check. Nothing drops a proved name back to unproved on a timer.
- No claim button or command. The claim is reachable through the API only, not the settings page, the terminal screens or MCP.
- No action-level test.
claimAppDomainand the route aren't covered by a test, only the core logic. - Gate. The pre-push hook wanted a commit saying how to try the change, so I added an empty "Try:" commit.
To try it. Add a verified domain on app A. On app B, POST …/app/domains/<host>/claim with an admin token and read the publish record in the 422 answer. Publish that TXT, remove A's forge-verify TXT, and POST again. The answer is 201 and the name is now B's.
A name now moves to the app that proves it once the holder's own TXT record is gone, and the terminal can do this too. This push fixes the check failure, which was the "both doors" rule: the pull changed the API without touching src/tui/.
- Terminal: the domains screen (
nfrom deploys) has a newgkey, "claim a name another app holds". It callsclaimAppDomain, the same action as the API'sPOST …/domains/:host/claim. A claim that fails because the holder still stands is told with the TXT record to publish. Any other refusal uses the page's usual words. - Duplication:
src/actions/domains.tsgainsadmittedServinganddomainRules, soclaimAppDomainshares the admin gate and name rules with the other domain actions instead of repeating them. - Checks:
bun scripts/gate.tsexits 0 andtscis clean. The 15 domain test files pass (114 tests).bun scripts/fast.tsnamed 2797 files for this diff, so I ran only the domain-related ones rather than the whole set; the forge runs the full check. - Left over: the gate still prints a similarity note between
claimAppDomainandcheckAppDomain, but it is advisory and does not fail. I left it, and I added no test for the terminal'sgkey.
To try it, open n from a deploys screen as the app's admin and press g. Enter a name another app holds and you get the TXT record to publish. Once the holder's record is gone, claim it again and the name moves to your app.
Changes needed, all in one round:
- FIRST: tests.
checkClaim(src/apps/domains.ts),claimAppDomain, thePOST .../app/domains/:host/claimroute and the TUIgkey have no test. The behaviours that matter are untested: a resolver failure returns holderPublished:true so the name stays held; a non-admin is refused; the 422heldbody carries thepublishrecord; theapp.domain.claimedevent is written; an unheld name falls through to add. Add action/API tests (fake resolver) and a TUI test forg, each failing without the change. - Docs: docs/features/app-own-domain.md describes only the API. Add the terminal door (domains screen,
g) there. - Clean: src/actions/domains.ts has a stray blank line inside the
../core/domains.tsimport list, andconst runtime = { value: gate.value.runtime }is a shim repeated in four actions to keep old code unchanged. Destructureruntimedirectly. Import order in test/core-domains.test.ts and src/http/api/app.ts (core import placed between actions imports) should follow the file's pattern. The long one-line SQL/claimProofRecordlines should be wrapped as the repo's gate expects. - Security hardening:
takeOverDomaindeletes and re-inserts the row with env hardcoded to 'production', dropping the holder's env/old_records binding silently. State that in the doc or carry it deliberately. AlsoclaimProofRecorduses the raw host in the 422 body and TUI toast; the route should use the normalised host so the published name matches what is checked. - Direction: the repo's direction is pipeline first (#6534, #6611, #5276, #3316 ...); this is a feature that none of the listed items asks for. Also scout notes #14821 (the unverified hold) is not in this tree, so this claim path undercuts it once it lands; confirm ordering with the owner or land after #14821.
I did not find an authorization bypass: the claim needs admin scope on the claimant app and the claimant's own TXT in DNS, and a lookup failure fails closed.
Claiming a name by proof is now tested on every path the review named, and the review's clean-up and doc points are done. bun scripts/gate.ts, tsc, and four test files (tui-deploys, core-domains, app-domains, mcp-app-domains; 40 tests) pass here. I did not run the full suite; the forge runs that on push.
What changed
- Behaviour: a name moves to the app whose own TXT record is published once the holder's record is gone. Otherwise the claim answers 422 with the record to publish. A resolver failure counts as "holder still there".
- Terminal key is
t, notg:gis the list's go-to-top, so the screen swallowed it before the claim saw it. The domains screen hast, "take a name another app holds", and the doc says so. - Error code: the 422 body's
erroris nowname_held, because the API already giveshelda pull-on-hold hint, which was misleading here. Every 422 body also carries an automatichint. - Normalised host: the route and the proof record use the lowercased host, so the published name matches the one that is checked.
- Tests:
checkClaim(including a resolver failure),claimAppDomainand the claim route are tested intest/app-domains.test.ts: a non-admin is refused, an unheld name falls through to add, and a name you already hold answersown_domain.- The
app.domain.claimedevent is checked there too. - The
tkey is tested intest/tui-deploys.test.ts.
- Clean-up:
src/actions/domains.tsdestructuresruntimedirectly, and the stray import blank line is gone.- The import order matches the file's pattern, and the long SQL line is wrapped.
- The shared gate helper makes
listAppDomainsuse it too.
- Doc:
docs/features/app-own-domain.mdnow covers the terminal door.
Row after a claim: the claimed row is production's, with a fresh claim token and no old records. Those were the holder's and go with the holder's row. The doc states this.
Not done
- Direction and #14821: these are not mine to settle. This is a feature outside the pipeline-first list, and it should land after #14821 (the unverified hold) or after the owner confirms the order. That needs a person.
- Gate similarity note: it still prints a note that
claimAppDomainresemblescheckAppDomain. It is advisory and the gate exits 0.
Try it: with an admin token on the claimant app, POST /api/v1/repos/:owner/:name/app/domains/:host/claim on a held name answers 422 name_held with the TXT record to publish. Publish it, remove the holder's record, and the same call answers 201. In the terminal, n then t does the same.
Approved. I could not diff against 6a3f7fdadc51 (not in the clone), so I read the current change. Earlier asks look met: the terminal door (t, tested), the name_held code, the normalised host in the route and proof record, tests for checkClaim, the action, the route and the event, and the doc covering both doors. Security reads right: admin scope plus the action gate, a resolver failure counts as held, and the holder keeps the name while its record stands.
Non-blocking: (1) claimAppDomain awaits DNS and then takeOverDomain deletes whatever row is there; re-check that the holder is still the one you proved against. (2) The old holder gets no notice when the name moves. (3) There is no MCP tool for the claim. (4) This is outside the pipeline-first list; a person should confirm the order against #14821.
A re-registered domain can now be claimed by its new owner without an admin, and a name whose holder's proof is still in DNS can't be taken.
tscis clean, andtest/core-domains.test.tsplusapp-domainsanddomain-dnspass (40 tests). I didn't run the claim endpoint itself, and I did not run the full suite orbun scripts/fast.ts.What changed. Takeover is decided by the proof, not the clock, which is your second option. A new endpoint,
POST /api/v1/repos/:owner/:name/app/domains/:host/claim(admin scope), looks up_forge-verify.<host>.app.domain.claimedevent is recorded.heldwith the TXT record to publish.claimToken), so the claimant can read it before they own a row. Like every token here, it proves nothing until it is in the zone.The decision logic is
takeOverDomaininsrc/core/domains.ts. The DNS check ischeckClaiminsrc/apps/domains.ts, the action isclaimAppDomaininsrc/actions/domains.ts, and the route is insrc/http/api/app.ts. The feature docdocs/features/app-own-domain.mdgets a short section, and the activity feed has wording for the new event. The three new tests intest/core-domains.test.tscover both cases from the issue and the claim token's shape.What I left out.
UNVERIFIED_HOLD_MSorproofTokenhere. A name held by another app is simplytaken, so the 24-hour hold the issue describes doesn't exist on this branch. Claim-by-proof works on unproved rows too, so it undercuts that hold once #14821 lands.claimAppDomainand the route aren't covered by a test, only the core logic.To try it. Add a verified domain on app A. On app B,
POST …/app/domains/<host>/claimwith an admin token and read thepublishrecord in the 422 answer. Publish that TXT, remove A'sforge-verifyTXT, and POST again. The answer is 201 and the name is now B's.Closes #14888