Concepts

Intents, verdicts, the hold queue, the ledger and checkpoints, planes, settings, rate limits, leases and aging.

One page for the ideas the rest of the docs lean on. Each section is how the crate behaves; Floodwall Cloud runs the same crate, with one tick per second.

Intents#

An intent is a change an agent wants to make, fully attributed. Agents never touch production directly: they submit intents, the plane decides what runs, when and alongside what, and the caller applies each admitted change and reports back. On the wire:

json
{"id":"1731600000000000","agent":"deployer",
 "action":{"kind":"apply","resource":"api","manifest":"registry.internal/api:v42"},
 "priority":"normal","blast_radius":"service","signature":null}
FieldValuesMeaning
ida whole number up to 2^64 − 1, as a number or a decimal stringUnique per agent: the agent and id together are the intent's key.
agenta nameWho asks. Rules, rate limits and the ledger know agents by this name.
actionapply, scale or destroyWhat would change, and on which resource.
prioritybulk < normal < urgent < pagerHow urgent. Higher priorities are ruled on first. Default normal.
blast_radiuscell < service < region < globalHow much it can break. Wider changes run with more to themselves. Default service.
signaturenull, or Ed25519 in hexRequired when the plane has a keyring: see signing below.

Action kinds#

KindFieldsSummary in the ledger
applyresource, manifest (any text: an image, a plan id, a commit)apply web
scaleresource, replicas (0 to 4,294,967,295)scale web to 5
destroyresourcedestroy web

An action is destructive if it is a destroy, or a scale to zero replicas. A resource is any name you choose: a service, a Terraform workspace, a database. Rules match on it.

Ids#

The clients default each id to the current time in microseconds, kept increasing, so an agent that restarts needs no saved state. Submitting the same intent again under the same agent and id answers with where it is now instead of an error, so an agent can retry after a lost answer; a different intent under a used key is 409 duplicate. With a keyring, ids must also increase per agent, so signed bytes can't be replayed.

Statuses#

StatusMeaning
queuedAdmitted past the rate limit, waiting for the scheduler and the gate.
in_flightAdmitted: apply it, then report the outcome. The first answer says verdict admit; a later status read says in_flight.
heldDeferred: waiting in the hold queue for a person.
rejectedRefused by the gate. Final.
expiredTaken off the hold queue by a person, its TTL, or a full hold. Final.
lapsedIn flight past a Fail lease without a report. Final; it can no longer be completed.
doneReported succeeded or failed. Final.

Verdicts#

The gate rules on each intent once it could start, and gives one of three verdicts:

  • admit: go ahead. The intent is in flight until you report its outcome.
  • defer: not yet. The intent is held for a person, who releases or expires it.
  • reject: no. The change must not be applied.

Deny-overrides#

The gate is a stack of policies, each a pure function from an intent to a verdict. They combine with deny-overrides: the harshest verdict wins, so one reject blocks a change no matter how many policies admit it, and one defer holds it unless something rejects it. Every policy's verdict is recorded in the ledger; the decision's reason is the first rejecting (or else deferring) policy's, in file order.

Besides your rules, the plane runs two checks of its own, which show in the breakdown by name: agent-signature (with a keyring) and conflict-window, which defers a change that contradicts another agent's recent change to the same resource (two scales to different counts, two applies of different manifests, or a destroy alongside anything but another destroy). An agent may always follow up on its own change.

Rules see only the intent. They never read the clock or the outside world, so a gate decides the same way every time, and a plane can be replayed from its ledger. See the rules language.

The hold queue#

A defer is "not yet", not "no". A deferred intent waits in the hold queue until one of these happens:

  • Release: a person signs off. The intent goes back to the queue and is ruled on again at once, with its deferrals waived. A rejection still applies.
  • Expire: a person turns it down. It is final.
  • TTL: with hold_ttl set, an intent held that many ticks expires on its own.
  • A full hold: at hold_capacity, a new hold evicts from the agent holding the most, so one agent's deferrals can't push out another's.

Releases and expiries are recorded in the ledger with who made them: the member's address from the console, key:<key name> from an operator key, or the linked user from Slack. On Floodwall Cloud the plane also tells its owner when something is held, by email and in Slack, with Release and Expire buttons: see alerts.

The ledger and checkpoints#

Every arrival (queued), decision (admit, defer, reject), release, expiry, outcome (succeeded, failed, lapsed) and settings change (reconfigured) is appended to a SHA-256 hash chain with its evidence: the intent, the reason, each policy's verdict, and for a decision the versioned policy bundles its rules came from. Each record folds in the previous record's digest, so changing any record breaks the chain from there on.

Every so many records the ledger cuts a checkpoint: the chain head and an RFC 6962 Merkle root of the records so far, signed by the plane's own Ed25519 key. An auditor who trusts one checkpoint can check everything after it without replaying from the start, and prove one record is in the ledger with a handful of hashes. Only signed checkpoints vouch for the verdicts, since record digests are plain SHA-256 anyone can recompute. See Auditing.

Signing intents#

With a keyring (each agent's Ed25519 public key), every intent must carry its agent's signature. Unsigned, unknown and forged intents are refused before they reach the queue or spend the agent's rate limit, and the ledger proves who asked for what. The signature covers the SHA-256 of the intent's fields (not the signature), in the encoding documented in src/intent.rs; both clients implement it. See the signed agent example.

Planes#

A plane is one wall: its own queue, rules and settings, rate limits, hold queue, keyring, API keys and ledger. Use one per environment or per team. On Floodwall Cloud a plane belongs to an account, whose members use it with a role; one tick is one second, and the plane ticks itself while anything is queued, in flight or held. Planes per account: Free 1, Team 5, Business unlimited.

Settings#

A plane's settings are one JSON object. Every key is optional; a change is recorded in the ledger (reconfigured), so a plane replays its past decisions under the settings they were made with.

json
{"rules": "format 1\n...",
 "burst": 8, "refill_millis": 1000,
 "default_limit": 1, "limits": {"web": 2}, "conflict_window": 0,
 "lease": {"kind": "fail", "ticks": 300},
 "aging": {"every": 60, "up_to": "urgent"},
 "hold_capacity": 1024, "hold_ttl": 86400}
FieldDefaultWhat it does
rulesnoneThe gate's rules file, as text (rules language). Empty: every intent is admitted, subject to the plane's own checks.
burst8Each agent's token bucket: how many intents it may send at once.
refill_millis1000Thousandths of an intent each agent's bucket regains per tick: 1000 is one a second on Cloud.
default_limit1How many narrow changes (cell, service) may be in flight on one resource at once. At least 1.
limits{}Per-resource overrides of default_limit, such as {"web": 2}.
conflict_window0Ticks a completed change keeps its claim on a resource, so another agent's contradicting change is deferred.
leasenullWhat happens to a change in flight too long: {"kind":"report"|"fail","ticks":N}. See leases.
agingnullHow long waits raise priority: {"every":N,"up_to":"urgent"}. See aging.
hold_capacity1024How many intents the hold queue keeps; past it, the agent holding the most loses its oldest.
hold_ttlnullTicks a held intent waits before it expires on its own; null keeps it until a person decides.

In the console, Policies edits the rules and the limits, with a dry run before saving. Over the API it is GET and PUT /v1/planes/{plane}/settings (see the API). A rules file that doesn't parse, or an unknown field, is refused with a sentence naming it; nothing is half-applied. What a change does to work already at the wall: waiting intents are ruled on by the new gate at the next pass; intents in flight stay in flight; held intents stay held, and a new TTL counts from when each was held.

Rate limits and backpressure#

Each agent has a token bucket of burst intents, refilling refill_millis/1000 a tick. An intent over it is refused at the door with 429 and Retry-After: 1, before it is queued. The queue itself is bounded: when it is full, new intents get 429 too (backpressure). Both clients wait out a 429 and try again, a few times, a minute at most each.

Floodwall Cloud also limits the API: 600 requests a minute per key (or console account) and 1,200 a minute per network. A Free account makes 25,000 decisions a month across its planes; past that, submitting answers 402 and the plane is not touched, so it never fails open.

Scheduling and blast radius#

The scheduler decides when each waiting intent may start. The wider its blast radius, the more it has to itself:

Blast radiusMay start whenWhile in flight
globalnothing at all is in flightnothing else starts
regionno other wide intent is in flight, and nothing is in flight on its resourcenothing else starts on its resource, and no other wide intent starts
service, cellno global is in flight, no region is in flight on its resource, and fewer than the resource's limit are in flight on it—

Higher priorities go first, first come first served within a priority. A blocked intent keeps what it waits for from lower-priority work behind it, so a wide change isn't starved by a stream of small ones.

Leases#

An admitted change holds its place until you report its outcome. A caller that crashes, or loses track of what it was given, would hold its resource forever. A lease bounds that:

  • {"kind":"report","ticks":N}: a change in flight N ticks is overdue and listed as such every tick until you report it. It keeps its place.
  • {"kind":"fail","ticks":N}: it lapses: recorded as lapsed, as a failure would be, and its resource is freed. It can no longer be completed.

Aging#

Priority is strict, so a steady stream of higher-priority work could keep a bulk change waiting forever. With {"every":N,"up_to":"normal"}, a waiting change is walked one priority higher for every N ticks it has waited, up to the ceiling. Only the order changes: the gate still sees, and the ledger records, the priority it was submitted with. A change at or above the ceiling doesn't age, so a ceiling below pager keeps incident work ahead of anything that has merely waited.