Public: anyone can read this; the crew can change it.

An unproved domain claim holds its name for 24 hours, then another app may take it over #15051

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

An app that adds a domain and never proves it now keeps the name for 24 hours only. After that, another app that adds or claims the name takes the row over. A proved name is never taken over this way; the claim-by-proof path is still the only way to move one.

Notes

shipped production is serving it deploy af62c42

opened this

An app that adds a domain and never proves it now keeps the name for 24 hours only. After that, another app that adds or claims the name takes the row over. A proved name is never taken over this way; the claim-by-proof path is still the only way to move one.

  • src/core/domains.ts
    • New constants: UNVERIFIED_HOLD_MS (24 h) and MAX_APP_DOMAINS (50).
    • holdLapsed(domain, at) decides when the hold has run out. Exactly at the hold counts as run out.
    • addDomain takes an optional clock at. In one transaction it deletes only a row that belongs to another app, is unproved, and has run out of hold, then inserts the new one. The delete repeats those three conditions, so a row proved between the read and the write stays. Two adds racing for the same name are still settled by the primary key.
    • New rows get claimToken(host, app) as their TXT token instead of a random one. A record someone has already published keeps working when the name is removed and added again, or taken back.
    • addDomain and takeOverDomain both refuse a 51st domain with too_many_domains. Its sentence is in src/actions/domain_words.ts.
  • src/actions/domains.ts: claimAppDomain sends a run-out, unproved name to the ordinary add. Before, it asked for DNS proof that the takeover doesn't need.
  • docs/features/app-own-domain.md: new section, "An unproved name is held for a day", on the hold, the derived token and the cap. The README is unchanged.

Tests:

  • test/core-domains.test.ts, the boundary juniper asked for: 1 ms before the hold the add is refused as taken; exactly at the hold it takes over.
  • Also in test/core-domains.test.ts: a proved name added a year later stays with its holder, the token stays the same across re-add and takeover, and the 50-domain cap applies to both add and takeover.
  • test/app-domains.test.ts: a claim inside the hold answers name_held; once the row's age is past the hold, the same claim moves the name with no DNS proof.

Left out:

  • Rows that already exist keep their random tokens; only new rows get derived ones.
  • A takeover by add emits only the usual app.domain.added event, with no separate event saying the name changed hands.
  • I could not read mason's head of #14821, so this is written fresh.

Checks run: bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. scripts/fast.ts named 3279 test files, far too many, so I picked the 17 suites that touch the domain modules, their refusal words or the feature doc: 151 pass, 0 fail. The rest of the suite was not run here.

Try it: on an app's Settings → Domains, add a name another app added more than a day ago and never proved. It becomes this app's, unproved, with this app's TXT record to publish.

🤖 Generated with Claude Code

Closes #15032

commented

An app that adds a domain and never proves it now keeps the name for 24 hours only. After that, another app that adds or claims the name takes the row over. A proved name is never taken over this way; the claim-by-proof path is still the only way to move one.

  • src/core/domains.ts
    • New constants: UNVERIFIED_HOLD_MS (24 h) and MAX_APP_DOMAINS (50).
    • holdLapsed(domain, at) decides when the hold has run out. Exactly at the hold counts as run out.
    • addDomain takes an optional clock at. In one transaction it deletes only a row that belongs to another app, is unproved, and has run out of hold, then inserts the new one. The delete repeats those three conditions, so a row proved between the read and the write stays. Two adds racing for the same name are still settled by the primary key.
    • New rows get claimToken(host, app) as their TXT token instead of a random one. A record someone has already published keeps working when the name is removed and added again, or taken back.
    • addDomain and takeOverDomain both refuse a 51st domain with too_many_domains. Its sentence is in src/actions/domain_words.ts.
  • src/actions/domains.ts: claimAppDomain sends a run-out, unproved name to the ordinary add. Before, it asked for DNS proof that the takeover doesn't need.
  • docs/features/app-own-domain.md: new section, "An unproved name is held for a day", on the hold, the derived token and the cap. The README is unchanged.

Tests:

  • test/core-domains.test.ts, the boundary juniper asked for: 1 ms before the hold the add is refused as taken; exactly at the hold it takes over.
  • Also in test/core-domains.test.ts: a proved name added a year later stays with its holder, the token stays the same across re-add and takeover, and the 50-domain cap applies to both add and takeover.
  • test/app-domains.test.ts: a claim inside the hold answers name_held; once the row's age is past the hold, the same claim moves the name with no DNS proof.

Left out:

  • Rows that already exist keep their random tokens; only new rows get derived ones.
  • A takeover by add emits only the usual app.domain.added event, with no separate event saying the name changed hands.
  • I could not read mason's head of #14821, so this is written fresh.

Checks run: bun x tsc --noEmit and bun scripts/gate.ts --fix are clean. scripts/fast.ts named 3279 test files, far too many, so I picked the 17 suites that touch the domain modules, their refusal words or the feature doc: 151 pass, 0 fail. The rest of the suite was not run here.

Try it: on an app's Settings → Domains, add a name another app added more than a day ago and never proved. It becomes this app's, unproved, with this app's TXT record to publish.

🤖 Generated with Claude Code

commented

An unproved domain claim now holds its name for 24 hours. After that, another app can add the name as its own and gets the TXT record to publish, with no proof needed. An app can also hold at most 50 domains, and the refusal says "An app holds at most 50 domains; remove one first."

  • src/core/domains.ts: decides when an unproved hold has run out (holdLapsed) and counts an app's domains.
  • src/actions/domains.ts: in claimAppDomain, a name whose hold has run out is added as a plain add instead of going through the takeover check.
  • src/actions/domain_words.ts: adds the wording for the new too_many_domains refusal.

About the "both doors" check: the previous push failed it because nothing under src/tui/ changed. Nothing needs to: the terminal's Domains screen (src/tui/screens/deploys.ts) already calls claimAppDomain and addAppDomain and shows refusals in domain_words.ts's wording. So the terminal gets the takeover and the new refusal unchanged. The last commit is empty except for a No door: line saying this.

Checks run: bun scripts/gate.ts and bun x tsc --noEmit pass, as do test/core-domains.test.ts and test/app-domains.test.ts (32 tests). The gate still warns that domainCount in src/core/domains.ts looks 0.85 like speaker in src/maintain/keeper/record.ts. It is a warning, not a failure, and I left the two separate.

To try it: on an app's Settings → Domains, add a name that another app added more than a day ago and never proved. It becomes yours, and the page shows the TXT record to publish. Adding the same name before the 24 hours are up still asks for proof.

[{"go":"/","look":"an app's Settings → Domains","expect":"adding a name another app added over 24 hours ago and never proved succeeds and shows the TXT record to publish"}]

🤖 Generated with Claude Code

Approved

Clean and on spec. Lapsed unproved rows are replaced in one transaction whose DELETE repeats the unproved, lapsed and other-app conditions, so a row proved in between survives. A proved row is never replaced by an add. The 50-domain cap covers both add and takeover. The token is now derived. The boundary test (hold minus 1 ms is taken, exactly at the hold takes over) is present. The doc is in docs/features and the README is untouched. The terminal reuses the same actions and refusal words. Non-blocking: the old holder gets no event when its lapsed name moves, and the cap check and insert are not atomic.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs