The domain · 12 min
The lifecycle
A claim is always in exactly one status. Exactly one function can move it. Everything else is built around those two facts.
Rather than a pile of booleans like isVerified and isExpired, which can contradict each other, a claim has one status and a fixed list of moves.
The state machineRuns the real transition function
Send an event
The claim right now
{
"status": "pending",
"failedChecks": 0,
"lastFailure": null
}What happened
Send an event to see what the function does.Predict it first
A verified owner clicks abandon. What should happen?
Who owns what
VerifiedAt riskare the only statuses that count as owning.
At risk still owns the domain on purpose. Records get removed by accident during migrations, so losing one starts a 7-day clock instead of an immediate loss. Nobody is silently revoked.
The whole table
Every status down the side, every event across the top. A dot means illegal.
All 56 combinationsRead from the code's TRANSITIONS table
| From | Passed | Failed | Code expired | New code | Missing | Grace over | Superseded | Abandoned |
|---|---|---|---|---|---|---|---|---|
| Pending | Verified | Pending | Expired | Pending | · | · | · | Abandoned |
| Verified | Verified | · | · | · | At risk | · | Transferred | · |
| At risk | Verified | · | · | · | · | Lapsed | Transferred | · |
| Lapsed | · | · | · | Pending | · | · | · | Abandoned |
| Expired | · | · | · | Pending | · | · | · | Abandoned |
| Transferred | · | · | · | · | · | · | · | · |
| Abandoned | · | · | · | · | · | · | · | · |
Not every check changes anything
A finished check only produces an event if it should. The cells that say nothing changes are as important as the ones that do.
From a check result to an eventCalls the real eventForOutcome
| Status | Verified | Propagating | Lookup error | Not found |
|---|---|---|---|---|
| Pending | CHECK_PASSED | CHECK_FAILED | CHECK_FAILED | CHECK_FAILED |
| Verified | CHECK_PASSED | Nothing changes | Nothing changes | RECORD_MISSING |
| At risk | CHECK_PASSED | Nothing changes | Nothing changes | Nothing changes |
When the worker comes back
How long the worker waitsFrom PENDING_BACKOFF_MS
Failure 130 s
Failure 21 min
Failure 32 min
Failure 45 min
Failure 515 min
Failure 630 min
Verified
24 h
Between re-checks.
At risk
6 h
Between re-checks, looking for it to return.
Grace period
7 days
To restore a missing record before it lapses.