chadtmiller.com/knotless
git that lives in your Atmosphere account
knotless-serve: An account is dropped as deleted only when its host says so
MergedThis makes an #account deletion event drop an account only when an answer says it is gone: the DID document is 404 or 410, or the host answers RepoNotFound, or active: false with status: deleted. Any other answer is Unknown and is asked again with backoff, then the account is kept. I found nothing that must change.
http_status:identity::documentwrapserror_for_status()inanyhowcontext. That keeps thereqwest::Errorin the error chain, sohttp_statusfinds the404/410as intended.- Tests: they cover each answer and the retry paths, and
settleis exercised for kept, purged and gave-up. - Docs:
docs/design/serve.mdis updated with the table of answers. - Checks:
test,check,docsande2ewere still queued when I looked, so the 100% coverage gate is unconfirmed. Watch for theAsked::Unknownandgone/settlelog branches. did:web: a404from adid:webhost counts as gone, so a misconfigured host that briefly returns404would drop the account. The docs table states this, so I take it as intended.
This round adds only telemetry. The tracing log lines in accounts::gone and accounts::settle now go through a new telemetry::account_asked helper. The deletion logic and the tests are unchanged from the version I approved. The new helper maps cleanly onto the logging fields, and the log level at each call site matches the one it replaces.
The test, check, docs and e2e checks were still queued when I looked, so the build and the 100% coverage gate are unconfirmed on this commit. Check that the new account_asked helper and its call sites are covered, since it now holds the branches that were bare tracing calls.
I found nothing that must change.
All seven checks pass at df1146135ba7, test's 100% coverage gate among them, so account_asked and every branch of gone and settle are covered. On did:web: a 404 or 410 for the DID document is gone whichever way it is read, as with PLC. A did:web host that answers 404 for its own did.json has no resolvable identity at that moment, and nothing short of that 404 drops the account. Kept as it is.
8 passed, 2 skipped
What changes
An
#accountevent saying an account was deleted drops what knotless-serve holds of it only when an answer says it is gone: its DID document is404or410(a PLC tombstone), or the host that document names answersgetRepoStatuswithRepoNotFound, or withactive: falseandstatus: deleted. Active, or inactive for any other reason (deactivated, suspended, taken down, logged), it is kept. Anything else, a network error, a timeout, a5xx, no#atproto_pdsservice, an answer withoutactive, is asked again: 30 s, doubling to a 10-minute cap, six asks in all, then the account is kept.accounts::gonereturnsAsked::{Gone, Active, Unknown};accounts::settledoes the asking again and purges only onGone.accountsis public so the tests can reach them.docs/design/serve.md(Accounts that go) says which answers count.Why
deleted()returned true for any failed lookup:identity::resolvefailing for any reason, orgetRepoStatusfailing or saying anything butactive: true. A PLC outage, a host restarting or a timeout while a deletion event came in dropped an account's index rows, mirrors and sessions for good, as did a host answeringdeactivatedto one. grain's port of this code had the same flaw and fixed it this way (crates/grain-serve/src/accounts.rs), which this follows.The document is read with
identity::document, notresolve, so the check sees the identity as PLC has it now rather than a cached one, and can tell a404/410from an outage.How it was checked
crates/knotless-serve/tests/accounts.rs, against a stand-in that is PLC and every account's host: each answer above maps to theAskedit should (active, deactivated, suspended, taken down; deleted,RepoNotFound, tombstone, unregistered; PLC503, host502, host unreachable, noactive, no host);settlekeeps one active or deactivated with its mirrors, purges one whose PLC fails once and then is deleted, and gives up on and keeps one PLC never answers. The existing deletion flow intests/forge.rs(an account still active kept; one deleted at the reference PDS,RepoNotFound, dropped) still holds. Built and tested on the runner.Shortcomings
A retry lives in a spawned task: a restart during the half hour forgets it, and the account is kept, the safe way to fail. A host that answers
active: falsewith a status of its own that is notdeletedkeeps the account, as one that can be undone.Changeset: none