Identities for entities did.bot
agent llm did
didbot plan zone-scale.md
11 kB
Markdown
at commit 18ba4fe0


id: zone-scale title: The zone runs out of names before it runs out of accounts status: open crates: [didbot-pds, didbot-name, didbot-dns] dependsOn: [agent-accounts] exitCriterion: > A deployment holding a hundred thousand live accounts issues a name and publishes a hostname without failing, and an operator can see how close it is to the next limit before reaching it. #

zone-scale #

An account costs a name and a hostname, and both are finite in ways the rest of the system is not.

The default namer is mineral+creature, which is 128 words against 112: about fourteen thousand names. Naming::issue makes sixteen random attempts before giving up, so the failure rate is occupancy to the sixteenth — negligible at half full, around three per cent at eighty, around nineteen at ninety. The usable ceiling is therefore near eleven thousand simultaneously held names, not fourteen thousand, and provisioning starts failing intermittently rather than stopping.

With names released after thirty days, "held" tracks churn. Keep accounts instead, as account-types proposes, and it tracks the cumulative population inside the retention window. Adding word lists moves this a long way for almost nothing, which is the point of writing the numbers down: the fix is cheap and knowing when to apply it is not free.

Done #

  • | spec | pool size | leaks |
    | --- | --- | --- |
    | `mineral+creature` (word pair) | ~14,000 (usable ceiling ~11,000; see the arithmetic above) | nothing |
    | `Counter` (`counter`) | unbounded (`u64::MAX`) | the deployment's total mint count |
    | `Timestamp` (`timestamp`) | one per clock tick | roughly when each agent was minted |
    | `Uuid` (`uuid` / `uuid-compact`) | 2^122 | nothing |
    | `Random` (`random32:<n>` / `random36:<n>`) | `alphabet_size^n`, e.g. 36^10 ≈ 3.6 × 10^15 | nothing |
    
    `Random::pool_size` and `Fragments::capacity` both exist for the same
    reason: a deployment choosing a spec can read the number rather than
    compute it, and `describe()` folds it into the log line every namer
    already writes at startup.
    
    Every generated label goes through `didbot_name::check`, which no
    longer hand-maintains the DNS-label character rules: it calls
    `didbot_identity::validate_label` — now `pub`, and the same function
    `AgentDid::mint` checks an agent id against before it becomes part of a
    `did:web` identifier — so there is one legality rule for both places a
    label has to be legal, not two that could disagree. A UUID's canonical
    form is emitted with its hyphens in exactly the positions that rule
    allows; no other encoding (base64, uppercase) is offered, on purpose.
    
    `Counter` cannot collide with itself, so it declares
    `Namer::max_useful_attempts() == Some(1)` — a new default method on
    `Namer`, `None` for every other namer — and `Naming::issue` honours it
    rather than spending the usual sixteen-attempt budget on a namer that
    cannot need it.
    
    The counter survives a restart. `didbot-pds::names::DurableCounter`
    writes the value it is about to hand out into the write-ahead log
    *before* returning it — the same check-append-apply order
    `NameRegistry` already keeps for name claims — and replay resumes the
    counter past every value a previous run promised. That is a new `Entry`
    variant (`CounterAdvanced`), so it bumped `layout::LAYOUT` — which has
    moved several times since and reads 9 today, so do not take a number
    from this entry. `didbot-pds`'s `--names counter`
    shares the durable counter with `--names-if-down counter`, and runs
    in-memory, restarting at zero, without `--data` — the same split every
    other durable-optional store here makes.
    
  • **An open question this closed the easy half of, and left the hard
    half for the owner to overrule.** Two things collide over one
    hostname, and this closed the direction where a zone already exists:
    its apex is reserved, so the namer can never mint an agent there. The
    inverse direction also needed closing — `ZoneManager::add_zone` refuses
    to create a zone at a hostname a live agent already answers at, naming
    the DID so an operator knows what to delete first.
    
    What is left is the question in between: **may a zone be created at a
    name still inside its release hold?** Deleting an agent does not free
    its name immediately — `NameRegistry` holds it `Released` for thirty
    days precisely so an `at://` URI copied out of a log does not later
    point at a different agent. The conservative answer treats a zone apex
    as inheriting that same hold, on the grounds that the hold's whole
    purpose — a stale reference not silently repointing — applies just as
    much to a zone suddenly answering where an agent used to. The
    permissive answer notes that an agent DID and a zone apex are
    different identifiers, so the collision is weaker than agent-vs-agent
    and the wait may be needless caution.
    
    `ZoneManager::add_zone` implements the **conservative** answer: it
    refuses while the apex name is held, and reports when the hold
    expires. This is a judgment call, not a settled one — a deliberate
    operator override (free the name explicitly, then retry) is a
    reasonable follow-up and is not implemented. Documented here, per the
    project's own posture on this kind of decision, so the owner can
    overrule it rather than discover it.