feat(registry): re-check verified domains and withdraw lost ones #357
Loading…
Reference in a new issue
No description provided.
Delete branch "loop/343-domain-recheck"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Verified domains (#341) are checked again once a day, and a domain whose record is gone is withdrawn (#343).
src/domains.trb:domainProofanswers aProof-Held,Missing(a name server answered without the record: no such name, noTXTrecord, only other owners') orUnanswered(timeout,SERVFAIL).recheckDuedecides when a domain is due: once in each of its days, which start at the time of day it was verified, and at least half a day after its last check.src/registry.trb:recheckDomain(domain, now)checks one domain outside the write lock, re-reads the row under it, and stores the outcome.Missingcounts a day infailures; the 3rd in a row withdraws the domain (row deleted, ownerchangedmoved, owner file and package pages rewritten, eventdomain-withdrawnbyregistry).Heldresets the count.Unansweredonly moveschecked.recheckDomains(now)checks every due domain one after the other, sharing the claim's limit of 2 lookups;recheckingDomains()runs it every minute.src/main.trb: startsrecheckingDomains()beside the documentation worker and cancels it when the server stops. It runs on the server's worker, since it shares the registry's lock and lookup slots.src/database.trb:domains.checkedanddomains.failures, added to old databases by an idempotent step (checked = verified,failures = 0). A claim setscheckedtoo.Why
A domain can be lost or sold; a badge that is never checked again would keep showing it. Three missing days, because a DNS change or a provider outage is not a loss of the domain; no answer counts nothing for the same reason.
Test
tools/registry/tests/domain-recheck.test.trb, against the loopback name server of #341's tests (fake-dns.trbcan now make one domain answer like another,Asked.answerAs), with a clock the test moves a day at a time:domain-withdrawnevent;SERVFAILcount nothing and break no count;recheckDuecases;domainstable is migrated twice.Locally only
torb checkandtorb format --checkoftools/registry, andtorb docs skill --check; the suite and gates run in forge CI.Closes #343
Checklist (head
15184a9):domain-recheck.test.trbcovers every acceptance criterion of #343 (record kept, 2 missing days kept / 3rd withdraws, owner file still verifies, page loses badge, onedomain-withdrawnevent, re-claim at once, reset after success, timeout/SERVFAIL count nothing, due-sweep,recheckDue, double migration). CI green on this head.Gone);recheckDueday/half-day logic is consistent with a claim settingchecked;Unansweredmoves onlychecked.checked = verified, no data discarded.Non-blocking:
migrateaddscheckedandfailuresin two separateALTERs guarded only by thecheckedcolumn; a crash between them would leavefailuresmissing. Guarding each column on its own would close that.