For the technical audience
Decisions ADR-171 to ADR-180
Every architecture decision record (ADR) behind TelltaleDNS: what we knew, what we chose, and what it costs. This page is built from the specification on every change, so it's always the current record.
ADR-171 The query log can be searched for what does not match: a "not" per filter, and a read an older peer doesn't knowGitHub issue #58: a user asked for "does not contain" in the query log search.
Context
GitHub issue #58: a user asked for "does not contain" in the query log search. The name filter matches in five ways (contains, exactly, with subdomains, wildcard, regex) and the other filters (client, status, type, response code) are "is one of"; nothing says "everything except", and a regex can't (the engine runs in linear time and has no lookaround). The analysis queries already have != and "not in".
Decision
- Five filters can be turned around: name (each of its five matches), client, status, type, and response code. They are typed booleans (
nameNot,clientNot,statusNot,qtypeNot,rcodeNot) onGET /api/v1/queries, the first four onGET /api/v1/queries/stream;--not-name,--not-client,--not-status,--not-qtypeontelltale qlog search; the Query log page's Match menu ("does not contain", "is not", "is not, or under", "does not match wildcard", "does not match regex"), a "not" box beside Client, Type, and Rcode, and a "not" chip before the statuses. Group, upstream, and slowness are not turned around. The Live view honours them (not regex, which it never had). - A flag without its filter is a 400 that names it (as
matchwithoutnameis), not ignored. The page drops such a flag from an old address instead of sending it. A negatedrcodekeeps the queries that got no response code. - The store's
Filtercarries aNot(five flags). The name and client predicates are resolved against each segment's dictionary into a yes/no per name, so a negated one only flips that set: no extra work per row. What a negation gives up is skipping by bloom filter (a bloom says "maybe present", never "absent from every row"): a negated name or client reads every block the time range and the other filters leave, as "contains", wildcard, and regex already do. A block is skipped for a negated status or response code only when every value in it is excluded (the header masks). Limits, threads, and the idle priority are the existing ones; the docs say to give a time range on a long log. - In a cluster, peers decode
QueryParamsandTailParamsleniently, so an older peer would ignore the new flags and answer rows that were not negated into a negated search. A negated search is sent as a new read (QueriesNegated,TailOpenNegated) that an older peer doesn't know, so it is listed among the nodes not reached (as other newer reads are) and never answers wrongly. - The address keeps the existing keys and adds the flags (
match=exact&nameNot=true): an old link keeps meaning what it did, and an older page opening a new link shows the un-negated search.
Not done
negating group, upstream, or slowness; combining filters with OR; lookaround in regex.
Consequences
- A negated name search costs about what a "contains" search does; a negated exact name no longer gets the one-block shortcut.
- The OpenAPI document, the UI types, and the MCP tool schema (
search_queries) gain five optional booleans. - During a rolling upgrade, a negated search of the whole cluster reaches only the upgraded nodes.
ADR-172 A cluster support package: each node redacts its own part under one key, with labels every node agrees onGitHub issue #55 (the later phase of #50, ADR-156): in a cluster the problem is often on another node, and a package of the node that answered covers only that one.
Context
GitHub issue #55 (the later phase of #50, ADR-156): in a cluster the problem is often on another node, and a package of the node that answered covers only that one. ADR-156 settled the direction (each node redacts before its data leaves it, the asking node's key travels over the mutually authenticated stream) and left three points: how the key reaches the others, what an older peer does, and the size cap across nodes. One more came up in building it: ADR-156 numbers a name by when it is first met (device-3), so two nodes would give one device two labels, and the issue asks that a device have one name on every node.
Decision
POST /api/v1/system/support-packagetakescluster: true;telltale support-package --cluster; a checkbox on the System page. It is the node that was asked that puts the package together. Admin only, no agent scope, no MCP tool, like the single-node package.- That node makes a random 256-bit key for the package and sends it in a new read (
SupportCollect) over the cluster stream to every reachable member. The key is held in memory for the call and never stored or logged. A member that is ephemeral (a resolver pod) may be asked but may not ask: the key lets its holder undo the address permutation, so only a member the cluster trusts with more than reads may hold one. - Each node makes its normal package (collectors, redaction, classification, the same limits) under that key, but with keyed labels: a name's label is
device-and eight hex digits of a keyed hash of the name (a few more if two names land on one label), not a number by first encounter. The same name is the same label on every node, in any order, and under another key it is another label. Addresses and MAC addresses were already a keyed permutation. A single-node package keeps its numbers. - A node sends back its part: its files as text, its manifest, and the counts, gzip-compressed JSON. The cluster channel carries about a mebibyte per answer, so the node cuts its largest files until the compressed part fits 1,000,000 bytes (the manifest says what was cut), and the asking node reads it with a limit on the unpacked size.
- The asking node puts the parts side by side (
nodes/<node>/...with each node's ownMANIFEST.json) under a summaryMANIFEST.json(kind: cluster) and a README. The size cap is the single-node 20 MiB divided into equal shares, one per reachable member; a part over its share, or a file whose path is not allowed, is left out and said so. A node that doesn't answer (45 s), is older than this feature (it doesn't know the read, so it answers an error), is busy making another package, or has no open stream is listed with a fixed reason: nothing a peer says is copied into the package. Real node names appear only at thenonelevel; otherwise the asking node names a missing node with the same keyed labels. - No pseudonym map: the names are replaced on the nodes they belong to, and a map would have to carry them over the network, so
keepMapwithclusteris refused (400) and--keep-mapwith--clusteris an error.
Alternatives rejected
numbering by first encounter and renaming at the asking node (the asking node would hold every node's names, which is what the design avoids); sending each node's data to the asking node to redact (the unredacted data would cross the network); a map the asking node assembles (same); a separate large-transfer channel for parts (the cap and the compression keep a part under a mebibyte, and a node that can't fit is listed, not hidden).
Consequences
- A cluster package is made with one request, and a device reads the same in every node's files. The labels are hashes, so they say less about order than
device-3; the manifest and README explain them. - Two different names that hash to one label get different labels on the node that sees both, but another node that sees only one of them may give it the shorter label: a rare ambiguity, harmless to reading.
- An older node is listed as missing until it is upgraded; a rolling upgrade gives a partial package for a while, and says which nodes.
- Each part is redacted the same way a single-node package is (best effort for free text), and the README says so.
Verification
pure tests in telltale-support (labels the same in any order and under one key, different under another; a part survives the wire and a damaged or oversized one is refused; a part is cut to fit; the package lists present, missing, and over-share nodes; paths that escape a node's folder are refused; two nodes with one name get two folders), the request checks, and the existing single-node package tests unchanged.
Builds on ADR-156
ADR-173 A replica forgets a peer it keeps no link to once that peer is silentA node's member list (telltale_cluster_peers, telltale_cluster_peer_up, the chart's TelltaleDNSClusterPeerDown) is every peer it has ever had a stream with since it started; a stream that ends only marks the peer disconnected.
Context
A node's member list (telltale_cluster_peers, telltale_cluster_peer_up, the chart's TelltaleDNSClusterPeerDown) is every peer it has ever had a stream with since it started; a stream that ends only marks the peer disconnected. On the primary that is right: every node is meant to dial it. On a replica it isn't. A replica's own stream goes to the primary, and to another eligible node only as a fallback while the primary doesn't answer (ADR-051, GitHub issue #4), until it moves back (issue #43). The streams under automatic failover (ADR-056) are the only other standing links. Seen on a home cluster (2026-11-18, 0.8.0-edge.393): two native replicas linked to each other for about a minute while the controller restarted for an upgrade, moved back to it, and then each listed the other as down until its next restart, so the alert fired on both replicas for days (across several builds, each restart opening a new fallback window) while the controller saw both up.
Decision
- A node forgets a member that is not connected, has no stream open to it, and hasn't been heard from within the up window (three heartbeats, 15 s), unless it keeps that peer: the primary keeps every peer; a replica keeps the primary and, while automatic failover is active, every voter in the registry.
- "The primary" is a member whose last Hello said it was primary, or the node the last version this replica applied names (
applied.json). A Hello is sent once, when a stream opens, so a node promoted on a stream that was already open still says "replica" there; the version it publishes next names it, and the replica applies that one. (Taking the highest epoch instead was rejected: every voter absorbs the newest epoch, so several members tie on it.) - The sweep runs on every node with the voter mesh's 3-second loop (
mesh), in any failover mode. A peer forgotten this way comes back with its next Hello, like any new stream, and is logged atinfo. - The sweep fails closed. Who the voters are comes from the registry file, and a read that fails leaves a registry with this node alone, which reads as "automatic failover isn't active". With automatic failover set and no other node in the registry, the sweep does nothing for that tick. (Skipping it whenever fewer than three voters are found was rejected: a replica that isn't a voter, or a cluster set to automatic with two voters, would then keep every passing stream for good.)
- A stream its dialer ends from outside (the
switcha replica uses to leave a peer for the primary) now marks the peer disconnected and logsdisconnected, like a stream that closes. It used to cancel that clean-up, so the replica that moved back kept the peer as connected (and, once silent, down) for good, and this sweep would never have dropped it. When two replicas had a stream each way, as in the incident, the stream the other side ended already cleared the flag, so this matters for a stream in one direction only. - Nothing else changes: the registry, the primary's member list, and the events log are untouched.
- Requirements: CLU-001 (the member list), CLU-005 (voters), CLU-008 (an alert fires when a node disappears).
Consequences
- After a passing replica-to-replica stream, each replica reports the other as down for at most about 18 seconds, below the alert's
for: 1m. A replica that is really down is still reported by the primary, which is where the alert fires for it. That depends on the primary being among the Prometheus scrape targets. - A replica's own member list (its metrics and the peers in
/api/v1/system/info) no longer shows another replica it had a passing stream with. Nor do the lists of nodes that didn't answer in a federated read, a simulation or a support package built on a replica (missingNodes, "not connected"): they are built from the member list, so a forgotten replica is not named in them, where before it was listed as not connected. The primary's lists are unchanged. - The sweep changes the member list and the Prometheus alert, not the in-app view. The Cluster page,
/api/v1/healthand the in-appNodeDownalert also list the registry's nodes that have no entry in the member list, as down with no link (thelast seencounted from when the node joined, and only once this node has been up for 90 seconds). On a replica, a forgotten replica becomes exactly that row. It is the row a replica that never had a stream to a sibling already shows, so the sweep doesn't add a false alarm there; it also doesn't remove the one that was there. Whether those views should apply the same "expected links" rule is left to the owner. - Forgetting a replica lifts the exclusion of its URL from
primary_urls()(the list of where the primary may be, which leaves out the URLs of nodes known to be replicas) until its next Hello. A node whose joining URL belongs to an old primary that is a replica now, and was forgotten, may try that URL once more: one needless move, healed by the next Hello. - A primary that was rebuilt under a new node ID stays in a replica's list as down until that replica restarts: its last Hello said it was the primary, and the sweep keeps the primary. That was so before the sweep too (a replica then forgot no peer at all), and the user guide says so (
docs/running.md, "Removing a node").
Requirements CLU-001 CLU-005 CLU-008
ADR-174 Federated reads never wait on a runtime worker: a sync-to-async bridge has an OS-level deadlineGitHub issue #7: nodes whose DNS, API, metrics and cluster ports stop answering while systemd says the service is active.
Context
GitHub issue #7: nodes whose DNS, API, metrics and cluster ports stop answering while systemd says the service is active. The reporter, nbacheller, traced a mechanism in the code and proposed a fix, and this decision builds on that work. Async API handlers called blocking Backend methods straight on a runtime worker, and on a replica a federated read (the configuration version for an ETag, the config entries, the devices with their identities, and the reads behind the stats) waited for the cluster channel with a scoped thread that ran Handle::block_on and was joined: no bound. That wait needs the runtime as well: the stream's writer and reader tasks run on a worker, and the RPC's own timer is advanced only by one. With every worker (as many as CPUs: two on the reporter's container) parked in such a wait, nothing can send the RPC, read its answer or fire its timeout, so nothing ends the wait. The API, the metrics port, the cluster stream, the accept loops, TCP, DoT, DoH and DoQ, and every cache miss (all on that runtime) stop, and the process doesn't act on SIGTERM; UDP answers from the cache go on. With TOKIO_WORKER_THREADS=1 a single request to GET /api/v1/config/entries on a replica shows it. The pattern is as old as the federated reads (v0.1.0). It is not proven that this caused the reporter's incident (DNS stopped some seconds before the node left the cluster), so the issue stays open; the watchdog's dump (ADR-163) is how a hang we have not found is read.
Decision
- The handlers whose backend calls can federate run them in
blocking()(the blocking pool), as about forty others already did: the device list and theETagreads of/clients,/records,/forwardsand/rules,/config/entries, and, in the write path every configuration change takes, the group check for a restricted agent token and the version read for theETag. Headers, status codes and JSON are unchanged. A test keeps it true for the next handler:clu_004_every_federating_backend_call_sits_behind_blockingreads the production code oftelltale-apiandtelltale, derives whichBackendmethods can federate from the bridge's callers (not from a list), and fails for a call of one that is not insideblocking(..)orspawn_blocking(..), apart from calls that are another type's method of the same name or already run inside one, each named in the test by file, function and method, with its reason and its exact count (an entry whose count is wrong fails, so a call added later to a listed function is found). - The bridge changes.
Federated::call_one,gatherand the cluster support package start their RPCs as tasks on the runtime and wait for them withrecv_timeouton astdchannel, for the RPC's own timeout plus 250 ms, instead of a scoped thread runningHandle::block_on. What has not come in by then is "didn't answer in time": listed inmissingNodes, or (for the configuration version and entries) answered from this node. A runtime that can't run the tasks costs a read its deadline, never the node its life, from whatever context it is called: a blocking-pool thread, a worker, a current-thread runtime. A task whose caller has gone is not sent. Noblock_in_place. - Bounds. Three, for the three things a read can use up. At most 32 federated reads wait at once (a count, no new dependency): each holds a blocking-pool thread for up to its deadline, so a slow or dead primary can't be used to use up the pool. The calls of all reads together are a budget of 32,768, counted from when a call starts until its read is done with its answer: a read takes a share of it for each of its calls, all of them or none, and the share travels with the call's answer and goes back when the read returns from its wait (or is dropped), or when the call's task is dropped. So the budget bounds the tasks that are running and the answers that wait for their read, together. One read has at most 4,096 calls. A read that is over a limit, or that the budget has no room for, is told "wasn't asked" without being sent: nothing is queued, and it takes no place and no share (a place and the shares are taken in one atomic step, so a refused read never holds either, not even for a moment). A place is given back when the read's last task ends, so tasks queued on a stuck runtime keep theirs, and each keeps its share. And bytes. A count does not bound memory: an answer is as big as its peer makes it, up to the cluster channel's 1 MiB frame, so 32,768 held answers could be 32 GiB. So each answer is weighed as it comes in, on the task that got it and before it is kept: its length is added to what its read holds and to what all reads hold, and if either would pass its cap (20 MiB a read, 40 MiB in all:
READ_BYTES,HELD_BYTES), the answer is dropped there and its call is "wasn't kept", whichgathertreats as a node that didn't answer (missingNodes, the same label and path as a timeout): no answer is cut short, the rest of the read is kept, and the read is counted (reasonbytes). The bytes are part of the call's share and go back with it (when the read returns from its wait or is dropped, or the task is dropped), and an answer that comes in after its read stopped waiting is not kept (once the read has given up it is not weighed at all; one that comes in between the end of the wait and that moment is weighed and given back at once). The read's own total is taken first and given back if everyone's has no room, so for an instant it can turn away another answer of the same read, never one of another read. Measured (a scratch program on the build VM that builds each read's largest legitimate answers as the code does and counts the heap; time buckets like a home network's, 1.5 KB each as JSON, or a busy one's, 4.5 KB): one call's answer is a window of 240 buckets, 360 KB (home) to 1.07 MB (busy, which is over the 1,047,552 bytes an answer may be: such a node's minute windows already fail with "answer too large"); a top list of 100 is 8 to 30 KB, a page of 1,000 query-log rows 355 KB, the settings entries tens of KB, a support part at most the frame. On a cluster of 5 nodes (4 peers asked), one read's answers are: for the dashboard's ranges 0.36 MiB (1 hour of minutes) to 16.9 MiB (48 hours of minutes; 50 MiB with busy buckets), for the API's longest ranges (7 days of minutes, 400 days of hours) 59 to 62 MiB (about 180 MiB with busy buckets, if they fitted the frame), and for a read of one call a peer at most 4 MiB. Parsed, answers take 3.3 to 4.5 times their bytes, and the whole read (parse, merge, response) peaks at 4.1 to 5.7 times them: 95 MiB for the dashboard's 48-hour read of 5 home nodes, 333 MiB for the API's 7-day one. On two real processes (a replica with one runtime worker, and a primary built to pad each of its time-bucket answers to about 900 KB), a 7-day read took the replica, which had no data of its own, from 42 MB resident to a high-water mark of 251 MiB with a first cap of 32 MiB (33 MB of answers kept), at the Pi's limit, and to 185 MiB with 20 MiB (20.7 MB kept): 6.6 to 7.3 times the answers above the node's own use. Eight times the largest legitimate read would be 500 MiB a read, more than the Pi's whole unit (MemoryMax=256M), so the caps are chosen from memory: with 20 MiB, a read of the peers' answers took that replica to 185 MiB, 72 % of the Pi's unit (the Helm controller has 512 MiB), and the cap is 1.2 times one of the dashboard's 48-hour reads on 5 home nodes (1.6 times on 4) and 5 times the largest read of one call a peer (4 MiB, a full frame from each of 4 peers; a page of 1,000 query-log rows from 4 peers is 1.4 MiB); 40 MiB for all held answers is two reads at their cap. The API's longest ranges come back partial on 5 nodes and on 3 (29.5 to 31 MiB of answers); before, such a read could not have finished on a Pi (333 MiB measured, for 5 nodes). What a caller does after the wait (parsing the answers, merging them, the response) is not covered: whenwaitreturns, the bytes go back while their parsed form is being built, so how many reads merge at once is bounded only by the blocking pool's 512 threads (there is no limit on concurrent HTTP requests), as before this change; each merging read is bounded by its 20 MiB of answers (about 145 MiB above the node's own use), so two reads at their cap merging at the same moment would not fit a Pi. The caps bound the peers' answers only. This node's own part of a read is not counted (Federated::timeseriesaddsself.local.timeseries(..)and the minutes shipped to it after the wait), so one read on a node with its own week of minutes and big buckets can pass a 256 MiB Pi too. That case is not measured (the 185 MiB above is a node with no data of its own); its arithmetic: the own part costs its windows × the bytes a window × the parse factor (3.3 to 4.5) × the merge factor (about 1.25), so a 7-day read of minutes on a node with home-sized buckets (43 windows of about 368 KB) adds about 15 MiB × 4.5 × 1.25 ≈ 85 MiB of heap to the peers' share (20 MiB × 4.5 × 1.25 ≈ 112 MiB), with the node's own 40 MiB or so on top: at or over a Pi's 256 MiB with the allocator's slack. The dashboard's 48-hour reads are 13 windows a node, under a third of that. Counting this node's own part against the read, refusing minute steps over 48 hours on a cluster, or accepting it as documented here is the owner's to choose. Covering the merge needswaitto return the answers with a guard the caller drops after merging (the final review's design note):gathercould carry that guard through its own loop without touching its callers, but the merge is in the callers (theBackendmethods that parse and merge, about 30), so the guard would be gone before the merge it is meant to cover, and holding it through the merge means changing each of them; not done. A merge that folds each window into the result as it comes (the parsed parts are 4.2 times the merged result for the 7-day read, so that read would peak near its answers plus its result, about 122 MiB, an estimate from the measured parts) or a cap on concurrent federated reads is a later design. 32,768 is 32 reads of 1,024 calls, the most that the first form of this bound (a flat 1,024 calls a read, with 32 reads) allowed to be running or waiting at once, so the number of calls and answers held is the one that was already accepted; the ceiling of 4,096 only lets one read use what many small ones could, and at most 8 reads of that size fit at once. Measured on the build VM, with both ends of the stream in one process and a peer that never answers: 32,768 calls outstanding (8 reads of 4,096) took 139 MiB of resident memory, about 4.4 KiB a call, of which one call's future is 1,632 bytes; no answer was in it, only calls out, and the asking node's own share is less than that, since the peer's handler tasks and buffers are in the number. That is what the flat cap allowed too, though nobody had measured it, and whether 32,768 is still the right budget is the owner's to say (it is one constant,CALL_BUDGET). Why 4,096: the longest range any step documents is 87 windows a node today (below), so a read for it from N peers is 87 N calls; the flat cap of 1,024 refused it whole from 12 peers (13 nodes), 7 days of minutes (43 windows) from 24 peers and 400 days of hours (41) from 25. Inmode: scaledthe controller asks each resolver pod as it asks any node, so each pod counts as one of those peers (the chart's default is 2 pods and nothing scales them on its own, so only a deliberately large deployment reached the flat cap). At 4,096 a read for a range goes whole for floor(4,096 / windows) peers: 47 for all of history by the day, 95 for 7 days of minutes and 99 for 400 days of hours. The day range gains one window every 240 days (88 from March 2027), and the number is floor(4,096 / windows), so the 47 falls to 46 then and after that by one every one or two windows (45 at 90 windows, mid-2028; 44 at 92); the others do not move. - A request for a range of time is one call to each peer for each window of 240 buckets of its step.
timeseries_chunkscounts the windows before it builds one, and a range of more than 256 windows a peer is asked of no peer: they are listed inmissingNodesand the answer is this node's own (and the minutes shipped to it), as for any read the bridge doesn't send. The longest range any step documents is 87 windows (step=day, since 1970; 7 days of minutes is 43, 400 days of hours 41, 15 minutes of seconds 4), so 256 is nearly three times that, and 4,096 calls a read lets floor(4,096 / windows) peers ask for a range whole: 47 for all of history by the day (one window more every 240 days, so 46 from March 2027), 95 for 7 days of minutes and 99 for 400 days of hours. This fan-out is not from this change: the windows were added on 2026-11-16 (in no tagged release when this was written), so that a busy peer's day of minutes fits the 1 MiB frame (CLU-002), and the final review of this change found that a request for a very long range at a fine step (a viewer'sstep=secondfrom the epoch, or to a year far ahead) made one call a peer for each of millions of windows, from a list as long as the range, before any cap saw it. A node that is not in a cluster is not affected: its own data is read with a range query that costs what is stored, not the span. (A clustered node with no reachable peer built the whole list of windows too, before asking anyone; it no longer builds any.) - A refused read is counted, in the counter
telltale_federated_refused_total{reason}(waits: too many reads waiting;spent: the budget of calls spent;ceiling: too much asked at once;bytes: sent, but an answer was dropped for its bytes; a closed set, never a node or anything a user sent; every reason has a sample from the start), and said in the log, atwarn, the first time and then at most once a minute with how many were refused since the last line, for each reason. A read that loses answers to the caps on bytes is counted once, on the thread that waited for it, and only for an answer that read saw. Before it was a line atdebugand healthy peers inmissingNodes. - The rule, in
spec/02§8: code on a runtime worker never waits for work only the runtime can do, and a synchronous bridge to async code has a deadline of the operating system's (astdtimeout), not the runtime's.
Alternatives rejected
tokio::task::block_in_placein the bridge (the reporter's proposal for it). It panics when the thread is not a worker of a multi-thread runtime (aHandle::block_onon another thread, a current-thread runtime, aLocalSet), and the release profile aborts on a panic, so a missed case would take DNS down with it. It also hands the worker's core to a new blocking-pool thread for each call, so the runtime's own liveness would depend on the pool (512 threads by default), and a pool used up wedges the runtime again.- A flat cap on the calls of one read (the first form of the bound: 1,024). It refused ranges the API documents, whole, once peers x windows passed it (12 peers at
step=dayover all of history), and a ceiling high enough for a large cluster would, with 32 reads, have raised the calls and answers a viewer can hold four-fold. A budget for all reads, counted until a read is done with its answers, with a ceiling per read, keeps that count and answers the large cluster. (A first version of the budget gave a call's share back when its task ended; answers that waited for their read then did not count, and 32 waiting reads could hold four times the flat cap's. The final review found it.) - Clipping a read that doesn't fit (a prefix of its windows, or fewer nodes) instead of refusing it whole. The answer would look complete and be a part; a refused read lists its nodes in
missingNodes, which the page shows as partial results. (The caps on bytes drop whole answers, never part of one, and list their nodes the same way.) - Caps on bytes eight times the largest legitimate read (about 500 MiB a read for the API's longest ranges on 5 nodes): more than the Pi's whole unit, so they would bound nothing there. Weighing an answer only when
waittakes it from the channel: the answers would already be held in the channel, unweighed, until the waiting thread got to them. - A floor under the worker count (
worker_threads(max(4, cpus))) or a cap on the blocking pool: lowers the odds, fixes nothing, and costs threads on a small node. - A runtime of its own for DNS (deferred answers, TCP, DoT, DoH, DoQ): the real gap in CLU-004 (an API or cluster mistake must not starve DNS), but it costs threads, which the footprint priority weighs, and it is a design of its own. Left to the owner.
Not done (the conservative choice): the Backend trait stays synchronous. Making its federated reads async retires the bridge and is the right long-term shape, but touches about 45 methods, the API backend, the fakes and the MCP tools: a later ADR. The watchdog (ADR-163) stays the backstop for a hang this does not cover; it restarts a stuck node after stall_secs, at most max_restarts_per_hour times, and does not see a partial stall (some workers parked, the others running). Known leftover (closed): the rule above was not literally true of one wait: alerts.rs evaluated the drill-report alert with Handle::block_on(b.drills(20, 0)) on a blocking-pool thread (inside spawn_blocking), a wait with no deadline of the operating system's. It now goes through the bridge (read_within: the read is a task under the same cap, and the thread waits on a std channel for 3 s and the grace), so a runtime that can't run it costs the alert that round's reports (each report is sent once, so the next round sends it), never the thread; and the node's own list of reports is read on that thread, not on the runtime. The alert loop itself is a task on the runtime, so on a runtime that runs nothing it waits like every task; the watchdog (ADR-163) is the backstop there. Test: clu_004_the_drill_report_alert_gives_up_on_a_wedged_runtime.
Consequences
- With a healthy runtime and a caller on a blocking-pool thread (every caller today) nothing changes: the same RPCs, the same answers in the same order, the same headers and JSON. On a stuck runtime a federated read costs its deadline (2 s; 1 s for the version) instead of for ever, and a handler that is missed in future costs a worker for that long, not the node.
- A read made on a worker thread of a multi-thread runtime costs its deadline even when the runtime is healthy: tokio puts a task a worker spawns in that worker's own LIFO slot, which no other worker steals, and that worker is parked in
recv_timeout, so the read's last (or only) task never runs, and the read falls back to this node's value (agatherof several peers loses the last). No caller does that: every federated call is underblocking()orspawn_blocking. It is a warning for the next handler, not a behavior to rely on. - A read can now say "didn't answer in time" for a peer that would have answered in the last 250 ms of its deadline, or when the runtime is so busy that it can't start the call within the grace: bounded, rare, and visible in
missingNodes. A read that asks for more than the bounds above is "wasn't asked" for all its peers: no range any step documents is near them for a cluster of up to 46 peers (the day range is 87 windows a peer today, and gains one every 240 days); a range of time over 256 windows a peer (more than 17 hours of seconds, 42 days of minutes, 7 years of hours, or atofar in the future) now gets this node's own data with the peers inmissingNodes, where before the peers were asked a window at a time (and, for a range of years, the requests could use up the node's memory). Whether such a request should be refused with a 400 instead is left to the owner. A read whose peers' answers pass 20 MiB comes back partial, its nodes inmissingNodesand the windows that did fit merged; the remedy is the same: a narrowerscope, a coarserstepor a shorter range. That is the API's longest ranges on 3 home-sized nodes or more. The dashboard at 48 hours makes two minute reads on each refresh (the summary and the chart; the previous period's summary is by the hour), each up to 2,881 buckets from every other node, so a refresh stays whole while those buckets average under about 3.6 KB as JSON on 3 nodes, 2.4 KB on 4 or 1.8 KB on 5 (20 MiB over 2,881 buckets a peer; counted as 13 full windows it is 2.2 KB on 4), and comes back partial above that; a live 4-node cluster measured 0.5 to 0.9 KB a bucket on average (1.3 KB at most), 1.8 MiB for one read, about ten times under. With windows near the frame's 1 MiB, 48 hours is partial from 3 nodes and 24 hours from 4. Two viewers refreshing at the same moment share the 40 MiB, so one of them can see a partial refresh, which the next poll, 15 s later, heals. - A saturated cap is shared by every federated read of the process: the alert task's, the support package's, the cache warm-up's, a replica's reads of the configuration version and the settings, and an administrator's cluster-wide pause, resume and flush among them. A viewer who keeps 32 slow reads waiting, or eight reads of 4,096 calls on peers that answer slowly (a call counts until its read is done with its answer, so a read held up by one silent peer holds all of its calls for up to 2.25 s), makes the others "wasn't asked" for as long as the primary or a peer is slow; two reads holding 20 MiB of answers each while one silent peer holds them up make the others' answers "wasn't kept" in the same way, for the same 2.25 s. The administrator's changes then report the peers as not answering ("didn't answer (an older version can't pause)", "not reachable: flush it when it's back"), which is not what happened. The warning above says so. A lane of its own for the alert task and for the administrator's changes is left to the owner.
- Known limit: a change can land after the caller was told it didn't answer. The reads that change a node (
BlockingPause,BlockingResumeandCacheFlush, sent throughcall_oneandblocking_fan) are tasks like the others. A task that has started goes on to the peer after the caller has given up, and the caller gives up at the call's timeout plus 250 ms counted from when the read was made, not from when its task first ran. On a runtime that is backed up, a pause or a flush can therefore reach the peer and be applied while the caller reports "didn't answer in time" for that node. Before, the caller waited for the real answer. The operations are safe to repeat (a pause is set to end a fixed time from now, so a repeat moves the end by the seconds that passed; a resume ends every pause; a flush empties the cache), so the cost is a second request, not a wrong state. A task that has not started when the caller gives up is not sent. - Known limit:
missingNodesis shared by the requests of a node. A node has oneFederatedand its list of nodes that didn't answer is a field of it, overwritten by every federated read, so a response can carry the list of another request that ran at the same time (older than this decision). The list is read right after the read, to put in the response'smissingNodes, byhealth(which folds it into its reasons), and byheatmap_networkandslo_partsto decide whether to ask older nodes again, which costs at most one more read; no write or access decision reads it. Three paths still write it in a second step after the read's own write, the shape the refused range lost:heatmap_networkandslo_parts(after the retry for older nodes) andqueries(when this node's own log is unavailable); none changes a decision. A range that is refused (more windows than the cap) used to write it in two steps, the nodes that are not connected and then the peers it did not ask, and now writes it in one, so it adds no interleaving of its own. Making the list belong to the request changes theBackendtrait (the list is read throughmissing_nodes()after the call): left to the owner. - The people who read the cluster's pages on a replica with few CPUs are served from the blocking pool: one pool thread per read, up to 32 at once.
Verification
clu_004_direct_handlers_never_park_a_runtime_worker (a runtime of one worker, every direct route, a configuration write, and a group-restricted agent); on two real nodes with one worker, clu_002_a_wedged_runtime_costs_a_federated_read_its_deadline, clu_002_a_wedged_runtime_costs_a_gathered_read_its_deadline and clu_004_a_read_on_the_only_worker_gives_up_and_frees_it; the bridge's tests (the order of answers, a call that never finishes, a wedged runtime and the late call not sent, the cap, a current-thread runtime); and a two-node run on the build VM with TOKIO_WORKER_THREADS=1 (again for the bytes, with a primary built to pad its time-bucket answers: the 7-day read answers with the primary in missingNodes, the bytes count goes up, the other reads and DNS go on). The bounds: clu_002_timeseries_windows_stop_at_the_cap and clu_002_the_documented_ranges_are_chunked_in_full (the windows), clu_004_a_read_over_the_ceiling_is_not_sent, clu_004_a_read_at_the_ceiling_is_sent_in_full, clu_002_the_documented_ranges_are_sent_in_full_to_forty_peers, clu_004_a_big_read_is_sent_when_the_budget_is_free_and_refused_when_it_is_not, clu_004_two_reads_over_the_budget_the_second_is_refused_and_takes_nothing, clu_004_a_finished_call_keeps_its_share_until_the_read_is_done_with_its_answer, clu_004_answers_held_while_waiting_never_pass_the_budget, clu_004_shares_come_back_when_the_caller_drops_a_read_with_answers_waiting, clu_004_shares_come_back_when_a_read_times_out_with_some_answers_in, clu_004_answers_waiting_when_the_runtime_is_dropped_keep_their_shares_until_the_read_is_done, clu_004_shares_stay_with_queued_tasks_after_the_caller_gives_up, clu_004_shares_come_back_when_the_runtime_drops_the_tasks, clu_004_the_worst_case_never_holds_more_than_the_budget and clu_004_reads_started_from_many_threads_never_pass_the_budget (the bridge; the tests of each path a share takes also check its bytes); the bytes: clu_004_an_answer_over_the_read_cap_is_dropped_and_the_rest_are_kept, clu_004_two_reads_over_the_held_cap_the_second_loses_only_the_excess, clu_004_an_answer_turned_away_by_the_held_cap_takes_nothing_from_its_read, clu_004_reads_from_many_threads_never_pass_the_caps_on_bytes (clu_004_the_caps_on_bytes_are_the_documented_ones only pins the constants and the arithmetic above), and on two real nodes clu_004_a_peer_whose_answer_is_over_the_cap_on_bytes_is_listed_as_missing; the metric: clu_004_refused_reads_are_a_metric_with_a_closed_set_of_reasons; and on two real nodes clu_004_a_timeseries_over_the_window_cap_asks_no_peer, clu_002_the_documented_ranges_are_asked_of_a_peer_in_full and clu_004_a_gathered_read_over_the_ceiling_asks_no_peer, and the step for long ranges in deploy/cluster/e2e.sh; one critical section for a refused range's missingNodes: clu_004_a_refused_range_lists_the_peers_in_one_step; the guard: clu_004_every_federating_backend_call_sits_behind_blocking, with the scanner's own tests (clu_004_the_scan_flags_a_call_outside_blocking, clu_004_the_scan_ignores_what_is_not_a_call, clu_004_the_scan_allow_list_is_exact, clu_004_an_allow_entry_hides_only_the_call_it_was_written_for, clu_004_the_scan_reads_rust_tokens, clu_004_the_scan_finds_the_test_code_of_a_file and clu_004_the_federating_methods_are_derived_from_the_bridge); the log: clu_004_refused_reads_are_logged_once_a_minute_with_their_count, clu_004_refusals_are_counted_exactly_under_concurrency and clu_004_a_refused_read_is_counted_for_the_log.
Requirements CLU-002 CLU-004
Builds on ADR-163
ADR-175 The break-glass policy is visible: a public yes or no, the networks for admins, a label and a Settings note; the default stays through 0.xGitHub issue #63 ("disable_local_login does nothing").
Context
GitHub issue #63 ("disable_local_login does nothing"). With the flag on and allowed_admin_networks left at its default (private networks and loopback, ADR-034), a client on a home, Docker, or Kubernetes network still sees the password form and can sign in, so the page looks the same as with the flag off. The cause is the Accepted default, not a defect; the owner decided on 2026-11-18 to keep the default and make the policy visible. The first pass (the ADR-034 amendment) made start-up loud and the docs plain; nothing in the UI or the API said what the form is, or for which networks. The reporter (rowdynl) and nbacheller, who traced both causes and proposed a start-up warning and a Settings note, asked for exactly that.
Decision
- A public yes or no.
GET /api/v1/auth/statusgainspasswordLoginRestricted:[auth.oidc] disable_local_loginis on. It is global, the same for every client;localLoginkeeps its meaning (the form is offered to this client). It carries no network. An older server doesn't send it, and the UI reads a missing field asfalse. - The networks for admins, on an existing admin-only answer.
GET /api/v1/users(admin role; an agent token is refused by AGT-004's table; a token below the admin scope is capped to its role) returns{ items, passwordLogin }instead of{ items }, withpasswordLogin = { restricted, networks[], coversWholeNetworks, includesLoopback, loopbackIsTrustedProxy }. No new route: the users answer is where an admin looks at who can sign in how, it is already behindrequire_admin, and an additive field breaks no client./system/infowas the other candidate and is not admin-only (viewers and display sessions read it). Because it sits on a route agents cannot call, it is not an MCP tool; the public boolean is readable by agents (it is inGET /auth/status). - One rule, and what it counts as wide. A list is wide when it has a network that is neither this machine (
127.0.0.0/8or a part of it,::1) nor a single host (/32,/128):coversWholeNetworks. The final review (2026-11-18) found that the first rule, "anything beyond loopback", warned aboutallowed_admin_networks = ["192.168.1.10/32"], which is what the guide recommends, and so taught people to ignore the warning that matters (the default list). A wide list, and[], are a warning at start-up and a note on the card; a list of this machine and single hosts is information ("restricted to loopback" for nothing but this machine, "restricted to N hosts" otherwise) and has no note; a/31is two hosts but a range, so it is wide.coversWholeNetworks,includesLoopbackand the start-up line's wording all come fromtelltale_api::auth::{covers_whole_networks, includes_loopback}, so the log and the page cannot disagree; a test compares them over thirteen lists (the default, loopback, a host, hosts v4 and v6, loopback with a host, a/31, a host with a/24, everything, a/7around loopback,::1/64, a v4-mapped loopback, and[]) and three proxy lists.networksis the configured list asaddress/prefix, in order, while the flag is on; with the flag off the block saysrestricted: falseand nothing else is meaningful (the unused list is not reported). - The sign-in page. With the flag on and the form offered: the separator reads "or, as an admin on a trusted network, with a password" (when there are provider buttons), and a muted line under the form says "Password sign-in is limited to admins on trusted networks. Use it when your sign-in provider is down." A client outside the list sees what it saw before ("Password sign-in is turned off on this server."). No "break-glass" in the UI.
- Settings, Users (admin only). A "Password sign-in" card, only while the flag is on: the networks, an "Includes whole networks" note ("not just the machines you name") when the list is wide, a plain "nobody can sign in with a password" when the list is empty, a
trusted_proxiesreminder for a list that names this machine (includesLoopback) while127.0.0.1is inside notrusted_proxiesnetwork (loopbackIsTrustedProxyfalse: the samein_networktestremote()applies to a proxy's peer address, so an ingress network does not count; a hint, since this node cannot tell whether a proxy exists, and a proxy that connects over::1is not looked for), and where to change it (allowed_admin_networksunder[auth.oidc], restart) with a link to the guide. - The default stays through 0.x. ADR-034's default is unchanged. Before v1.0 the owner may decide to tighten it; if so, one release warns first ("
allowed_admin_networksis not set; the default becomes loopback-only in a later release") and the change is a superseding ADR with a release-note line.
Alternatives rejected
a loopback-only default now (it silently ends password sign-in for every existing user of the flag on upgrade, discovered only when the provider is down; it does not help behind a proxy on the same host, where every browser is loopback; and in Docker and Kubernetes the server rarely sees 127.0.0.1 from outside the container); the networks in the public status (it tells any visitor where an admin password is accepted); a new GET /auth/policy route (an extra operation to keep agent-ready, for data that fits an existing admin answer); the detail on /system/info (readable by viewers and wall displays).
Consequences
- OpenAPI and the UI types change additively (
AuthStatus.passwordLoginRestricted,UserList,PasswordLogin);GET /usersclients that read.itemsare unaffected. - Mixed versions: a new UI on an older server shows nothing new (missing fields read as "not restricted" and "no block"); an older UI on a new server ignores the fields.
- A Helm resolver pod, where nobody signs in, carries the same fields; nothing there reads them.
- Credit: nbacheller and rowdynl (issue #63).
Verification
api_004_status_says_when_password_sign_in_is_restricted, api_004_the_policy_detail_is_admin_only, api_004_the_policy_reports_single_hosts_and_the_loopback_proxy, api_004_a_list_of_single_hosts_is_information, api_004_the_loopback_hint_follows_the_trusted_proxy_list, api_004_the_start_up_line_and_the_policy_agree, the committed OpenAPI test, and the Playwright tests api_004 the sign-in page says when password sign-in is restricted and api_004 settings shows where password sign-in is allowed. Amended 2026-11-19 (hand-off 20; amendment Proposed): the log hints at the mistake the Settings card can only guess at. When the TCP peer of a request is loopback, the request carries X-Forwarded-For or Forwarded, and the peer is not inside [api] trusted_proxies, remote() returns the peer exactly as before (which address is believed, trusted_proxies handling, the break-glass default, sessions and tokens are untouched) and logs one INFO line, at most once in ten minutes per process (one AtomicU64 with the last time, like the federated reads' refusal line; no new dependency): requests from that address carry a forwarded-address header but [api] trusted_proxies doesn't list that proxy, so client addresses are taken as the proxy's; list it to restrict by client. The final review (F1) found that a proxy that sends only the standard Forwarded header would be given that advice wrongly: remote() reads a listed proxy's client only from X-Forwarded-For and never parses Forwarded, so listing such a proxy would stop the line and leave every client looking like the proxy. A request with Forwarded and no X-Forwarded-For therefore gets a different line from the same limiter: this node reads client addresses only from X-Forwarded-For, so they are taken as the proxy's whatever trusted_proxies says; make the proxy send X-Forwarded-For, then list it. (Teaching remote() to read Forwarded would change which address is believed, which this amendment does not.) The line names the peer (the connection's own address) and never the header or any address in it: the header is whatever the sender wrote, and copying it would let a client write the log. Only loopback peers get it: a LAN host that sends the header itself is not a proxy, and a line for it would be noise about a spoof attempt. Verification: the api_004_*hint* tests (one line for a burst and one more after ten minutes, with a clock the test moves; none for a listed proxy, a non-loopback peer, or a request with no forwarded-address header; never the header's value; remote()'s answer the same in every case).
Requirements AGT-004
Builds on ADR-034
Referenced by ADR-034
ADR-176 The Get started page, README and running guide lead with the native install for a Raspberry Pi or Linux; the Docker Compose bundle stays supported and is the Docker pathuser feedback, and the owner's direction of 2026-11-18: the Get started page's Raspberry Pi tab led with the Docker Compose bundle, so someone who only wants TelltaleDNS on a Pi or a Linux machine had to install Docker first.
Context
user feedback, and the owner's direction of 2026-11-18: the Get started page's Raspberry Pi tab led with the Docker Compose bundle, so someone who only wants TelltaleDNS on a Pi or a Linux machine had to install Docker first. The other path was already there and tested: deploy/systemd/install.sh downloads one static binary, checks its signature and checksum, installs a sandboxed systemd unit and a starter config, and has a guided setup (OPS-001, DOC-001, T7.6) and an uninstall (OPS-004, T9.21); deploy/systemd/e2e.sh runs it end to end in CI. OPS-004 (spec/01) named the two paths the other way round: "the same image via Docker/Podman Compose (primary path); a static binary + systemd unit + install script (secondary path)". The docs and the page were reordered; the requirement text was not, and nothing recorded the switch.
Decision
- What leads. The Get started page (its first and default tab;
#piand#nativeopen it), the README quick start, anddocs/running.md"Raspberry Pi and Linux" lead with the native install. The Docker Compose bundle follows as the Docker path, for anyone who already runs Docker (on the page, under Docker;#composeand#dockeropen it). - What stays. The Compose bundle (
deploy/compose/), its image,deploy/compose/e2e.sh, and support for it. CI keeps testing both paths (thenativejob runs the Compose bundle andinstall.shwith the systemd unit). Nothing about the binary, the config or the defaults changes: the installer still installs the latest release unless--edgeis given, and Compose still pulls:latestunlessTELLTALE_TAGsays otherwise. - The requirement. OPS-004 now reads: "Raspberry Pi / Linux: a static binary + systemd unit + install script (primary path); the same image via Docker/Podman Compose, and on Kubernetes (OPS-002), are supported alternatives." That is the old text with the two paths' labels exchanged and Kubernetes named as an alternative; nothing it required is dropped (the Compose bundle stays in CI), and
docs/v1-requirements.mdis regenerated from it. - Relation to ADR-004. ADR-004 (Accepted) puts the OCI image and the Helm chart in Tier 1, the static binary + systemd unit in Tier 2 (also
spec/08§1), and says the Pi runs the image. This ADR changes which path is recommended on a Pi or Linux machine, not what is built, tested or released first: both paths are tested in CI. The owner approved it as an amendment, not a re-tiering, and the pointer is the whole amendment: ADR-004 andspec/08§1 each carry one "Amended by ADR-176" line, and their text and the tiers are unchanged.
Alternatives rejected
keeping Compose first and adding native as a second tab (what the feedback was about); calling Compose "advanced" or dropping it (many people run Docker or Podman already, and the bundle is the tested Docker path); changing the requirement without a record of why.
Consequences
- More first installs run
install.sh, which on Ubuntu changes the machine's resolver. The installer's wait for port 53 to be free before it starts the service, and the systemd e2e step's record of who holds port 53 when it fails, were added after a CI run in which the service could not bind port 53 and the log did not say who held it; more first installs make them matter more. - Documentation and page order, the wording of OPS-004, and one "Amended by" line each in ADR-004 and
spec/08§1: no code, schema, API or image changes, and nobody on Compose has to move. - The owner approved this on 2026-11-18, with the decision "Go with native first" for the Get started page and the guides; the OPS-004 wording above follows from it.
Verification
python3 site/build.py --check (the page, the guides and every link in them), python3 spec/trace.py --check (the OPS-004 row of docs/v1-requirements.md), and the CI native job, which runs both paths: the Compose bundle (deploy/compose/e2e.sh) and the installer with the unit (deploy/systemd/e2e.sh), with deploy/systemd/guided-e2e.sh and deploy/systemd/portwait-test.sh for the installer's answers, its wait for port 53 and its single start.
Requirements DOC-001 OPS-001 OPS-002 OPS-004
Builds on ADR-004
Referenced by ADR-004
ADR-177 Trust follows manifests in order: a node takes CAs only from a manifest no older than the one it last took them fromADR-066 moves the trusted CAs in steps carried by the primary's signed manifests, and every step is a new (epoch, seq) (the bundle is part of the manifest's metadata, so a step always publishes a new version).
Context
ADR-066 moves the trusted CAs in steps carried by the primary's signed manifests, and every step is a new (epoch, seq) (the bundle is part of the manifest's metadata, so a step always publishes a new version). A node took the bundle of any manifest that verified against the CAs it trusts now and kept one of them, and it did so before it compared the manifest's version with what it had applied: a node that can't apply a version must still follow the CA steps, or the rotation never completes. But manifest frames are accepted from every authenticated peer, the newest frame from any stream replaces the last, and a node that was the primary keeps sending its last manifest on every stream after it steps down. So an older manifest that still verified could move trust backwards. After the retire, the switch's manifest ([new, old], signed by the new CA) made a node trust the retired CA again until the primary's next change; in the trust phase, the manifest from before the rotation ([old]) made it drop the CA being added, and the key it held for that CA (ca-next.key) was deleted with it. A failover during a rotation and the old primary's return did it with no attacker at all. Found by reading the code in the 2026-11-18 review of the CA rotation race (no incident).
Decision
- A node takes the CA bundle of a manifest only when (1) the manifest's epoch isn't older than the epoch the node knows, and (2) its version, epoch first and then seq, isn't older than the version of the manifest it last took its CAs from. The same version is taken again: a manifest sent again finishes a step a crash cut short, and a primary that published a version, crashed before it recorded it, and published that version again is followed.
- The version is kept beside
ca.crt, inca.version({"cluster_id", "epoch", "seq"}). The trust change writes it itself, afterca.crt, under the lock the CA key files already share (the key share and the trust change). It is written for every manifest whose CAs are taken, also when the bundle doesn't change, so a node with no mark (upgraded from a build without one) or with one a crash left behind (afterca.crt, before the mark) has the current version once its next manifest arrives. No file means no mark, and the first manifest is taken as before: existing nodes upgrade with no migration, and an older build ignores the file. A file that can't be read or parsed counts as no mark too: the rule fails open on purpose, so a damaged file never stops trust from moving (availability over strictness), and the next manifest taken writes a good one. - The mark belongs to its cluster. A mark with another cluster's ID is no mark, and
cluster initandcluster joinremove one left in the directory, so a node that left a cluster and joined another (with an older build in between, which doesn't know the file, or not) is never held back by the first cluster's versions. A backup (ADR-063) holds nocluster/directory, so a restore brings no mark. - A manifest refused this way isn't applied either (it is older than one the node has taken already). That holds for a replica's follower and for a witness's trust follower (
follow_trust). It is one line atdebugeach time, since a replay can repeat it. Trust is still taken before configuration is fetched or applied. - No wire, manifest, key-share or election change.
Not done (left to the owner):
- A node that stops being the primary still sends its last manifest. Every receiver that hears its Hello learns the newer epoch first (a former primary is a voter, and the Hello comes before the manifest on the stream), so it now refuses that manifest for trust as it already did for configuration. Clearing the head on step-down is likely safe but wasn't proven against the whole set of cluster end-to-end scripts.
- Taking a manifest only from the node its signed
primarynames: no node relays another's manifest (a node sends only the head it published itself), so it would break no catch-up, but it wouldn't stop a former primary from sending its own last manifest either, only a member replaying one it received. - The registry and failover mode a witness keeps from the manifests are not ordered by this: an older manifest still replaces them.
- Telling apart two manifests of one version (follow-up, designed, not built):
ca.versionwould also hold a digest of the bundle taken, and at an equal version a node would take only that same bundle. Crash repair still works (the manifest sent again carries the same bundle); a primary that publishes a version again with other content after a crash is followed one version later, and a rotation makes a new version at every step.
Consequences
- A manifest of an older version can no longer re-trust a retired CA, undo a rotation step, or delete the key of the CA being added.
- Two different manifests of the same version can't be told apart: the equal version is taken, so either one moves trust. That happens only if the primary publishes a version and then crashes, or fails to save
published.json(a failed save is only a warning), before it records it, and publishes that seq again with other content, a rotation step having run in between. Someone who holds both signed manifests can then move every node between the two bundles until the next version. It needs a crash or a failed save during a rotation, and both signed manifests. The digest above would close it. - A primary whose versions go backwards (same epoch) can't move trust until its seq passes the mark of the others, as it already can't move their configuration, and a rotation waits; DNS is unaffected. Triggers: its data directory put back from an older copy, or its
cluster/published.jsonlost or unreadable (for example a full disk and a restart), after which its seq starts again low (from what it last applied as a replica, if anything). Recoveries: (a) promote another node, since a new epoch beats any seq; (b) where no other node can be promoted, stop each of the other nodes, delete itscluster/ca.versionand start it again. That is safe: with no mark, the next manifest is taken. Configuration still needs the promotion, or the primary's seq to pass what each node applied. - One small file per node, written once for each manifest taken. Manifests come with configuration changes.
- Mixed versions: an older build ignores the file and doesn't move it, so after a downgrade and an upgrade the mark is behind the node's trust (never ahead, unless the cluster's versions went backwards meanwhile): it holds nothing newer back, and moves on with the next manifest.
Verification
in crates/telltale-cluster/src/net_trust_tests.rs, clu_001_trust_is_not_taken_from_an_older_manifest, clu_001_follow_ignores_the_cas_of_an_older_manifest (and doesn't apply it), clu_001_follow_trust_ignores_the_cas_of_an_older_manifest, clu_001_the_same_version_again_is_taken_and_mends_a_crash, clu_001_a_trust_mark_from_another_cluster_is_ignored, clu_005_a_new_epoch_moves_trust_though_its_seq_is_lower and clu_001_a_node_without_a_trust_mark_starts_one_with_its_next_manifest; clu_001_a_new_identity_starts_without_a_trust_mark in node.rs. deploy/cluster/rotate-e2e.sh shows the rotation still completes (the happy path only).
ADR-178 A node that grants a pre-vote to a node that sorts before it gives that node the round, so two candidates rarely split the vote, and with three voters don't, short of a lost or badly delayed message, a restart, or a disagreement over the epochdeploy/cluster/gitops-failover-e2e.sh kills the primary of three eligible nodes (three voters), so two replicas can lead.
Context
deploy/cluster/gitops-failover-e2e.sh kills the primary of three eligible nodes (three voters), so two replicas can lead. Of the 79 CI jobs that reached that step, 65 had a new primary at the next epoch after 15 to 16 s, 12 needed a second round (30 to 35 s), and 2 needed a third (49 to 50 s), which failed the script's 45 s limit. The VM study had 2 of 48 runs at two rounds. spec/12 §10 promises a new primary within 30 s. There was jitter (the caller draws jitter in 0 to 7.5 s on every step and passes it to tick), but:
- It never applied to the first attempt. While the primary lives, a replica's retry time is long past, so the replica sends its pre-vote on the first tick of its election loop (every 250 ms) after it is free to stand. Both replicas are freed at the same moment. The lease ends when the same renewal is 15 s old on both, and under the GitOps authority the hold-back ends when the dead primary's last heartbeats, on two streams opened 10 to 20 ms apart, are 15 s old.
- The scripts start the replicas back to back, so their loops tick almost in step. In the 48 kept runs of the VM study, the two replicas' tick phases were 0 to 34 ms apart, median 8 ms (read from the times both logged
automatic failover on, which the loop logs on a tick). Independent phases would spread over 0 to 125 ms. The only two runs there that needed a second round had the two smallest gaps, 0.4 and 0.8 ms. In one of CI's three-round failures, both replicas logged that line in the same microsecond. - Pre-votes less than about one message delay apart cross. Each node grants the other's (a pre-vote binds nothing), both ask for real votes, each votes for itself, and neither has a majority. Each one's own vote is a 15 s lease on its ballot, so the other's next request is refused until that lease ends (the fencing rule): a split costs a full lease.
- The retries run on the same tick grids. The jitter is rounded up to the next tick, so two retries in one tick can split again.
Measured
crates/telltale-cluster/tests/rounds.rs runs the real Elector on every node, driven as failover::run drives it. Each node's loop steps on its own 250 ms grid and on every reply, with the hold-back from heartbeats, the jitter drawn on every step, an fsync (0.5 to 5 ms) before a changed ballot leaves, and an explicit one-way delay (50 µs plus an exponential). The primary is killed 0.1 to 0.6 s after the replicas get the cluster key, as in the scripts. The replicas' phases are within 30 ms of each other (as measured); the mean delay is the model's one free parameter.
- Before this decision, at a mean of 6 ms, 18.3 % of 200,000 GitOps failovers (three voters) needed a second round (CI: 17.7 %), at 0.5 to 1 ms 3 to 6 % (the VM: 4 %).
- Every first pre-vote went out on the step that found its node free to stand.
- A split happened only when the two candidates' first pre-votes were less than 30 ms apart (three voters): 34 % of the runs under 1 ms apart split, 15 % of those 10 to 30 ms apart, and none of the 1,316 runs further apart.
- The model's third round (0.15 % at the calibrated point, up to 0.8 % with fully aligned ticks) is below CI's 2 of 79 (2.5 %, a 95 % interval of 0.3 % to 8.8 %), so the CI count is either an unlucky draw from the aligned case or the sign of something the model leaves out (epochs in heartbeats, the server's own processing time, runner-wide stalls).
Decision
- A node that grants a pre-vote to a candidate whose node ID sorts before its own, for the epoch it would stand for itself or a newer one, gives that candidate the round:
- a pre-candidate stands down (it becomes a follower) and may stand again
ROUND_MS(2 s) later. It does not wait for the retry time it set when its attempt started (LEASE_MS / 3plus the jitter, 5 to 12.5 s after that start); - a follower doesn't stand for
ROUND_MSfrom then on, or until a later retry time it already had (next_try_msis pushed, never pulled forward).
- a pre-candidate stands down (it becomes a follower) and may stand again
- So giving a node the round costs the giver that round and no more.
- A node that grants a pre-vote to a node that sorts after it, that refuses one, or that grants a real vote isn't affected. Neither is a candidate (it has voted for itself) or a primary.
- Nothing else changes: the reply is the ballot's as before, and a pre-vote still changes no ballot. One vote per epoch, the refusal of candidates behind, the lease and its margin, majority, pre-vote, epochs, the wire, and the registry are unchanged. The first attempt is still made at once, and the jitter and the back-offs after a round that times out are as before.
- REQ: CLU-005, in
Elector::on_ask/give_way.
Why it is safe (any number of voters): safety never depended on when a node stands.
- Two primaries in one epoch are prevented by
Ballot::decide, the leases andMARGIN_MS, which this doesn't touch. - The change moves only when a node next stands, and drops a pre-vote that hasn't become a vote.
- The giver's retry can now come earlier than its own retry time (in the unit test, 3.01 s instead of 13.499 s). It is still at least
ROUND_MSafter its attempt began, which the code before this decision already allowed after a round that timed out with no jitter.
What it guarantees: no split when neither candidate can win without the other, short of a lost or badly delayed message, a restart, or a disagreement over the epoch (listed below). That covers three voters (the two candidates and the dead primary, as in the e2e), and four voters with one dead (each candidate needs every other live node). A split needs both candidates to vote for themselves, so here each must have the other's pre-vote grant before the other's real request arrives. Take the one that sorts after (B):
- If B grants A's pre-vote as a pre-candidate, it stands down.
- If B grants it as a follower, it doesn't start for 2 s.
- In both cases, by the time B stands again, A's pre-vote round is over: A has voted for itself (and refuses B), or has given up.
- If B is already a candidate, it refuses A, and A can't vote for itself without B's grant.
So with three voters, or four with one dead, a second round needs one of:
- a message delayed past a round (2 s), or lost;
- a restart;
- or the two candidates asking for different epochs (a node doesn't give way to a request for an older epoch than the one it would stand for).
What it only reduces: more voters. When a candidate can reach a majority without the other, a split stays possible. With three eligible nodes and two witnesses (five voters, majority three), and the primary gone:
- The higher candidate collects the witnesses' pre-votes and votes for itself before the lower one's request reaches it.
- It then refuses that request, so it never gives way.
- The lower one collects the same witnesses' pre-votes (they bind nothing) and votes for itself too.
- The witnesses' real votes go one each way, two votes each, and a lease passes before the next round.
What decides it is how the majority is made up, not how many candidates there are: four voters with one dead and three candidates don't split (with the same exceptions as three voters), while five voters with two candidates can. The same holds for five eligible nodes with some in maintenance or holding back under GitOps.
Measured after it, on the same seeds (200,000 each; mean / p99 / worst seconds to a primary after the kill):
| Scenario (voters) | Before: 2 rounds / 3+ | Before: mean / p99 / worst | After: 2 rounds / 3+ | After: mean / p99 / worst |
|---|---|---|---|---|
| GitOps, the scripts' timing (3) | 18.3 % / 0.148 % | 16.2 / 34.5 / 103.0 | 0 / 0 | 13.0 / 15.2 / 15.3 |
| Three eligible, the scripts' timing (3) | 18.5 % / 0.153 % | 15.3 / 33.8 / 69.2 | 0 / 0 | 12.1 / 15.2 / 15.3 |
| GitOps, independent phases (3) | 3.05 % / 0.026 % | 13.5 / 31.5 / 66.3 | 0 / 0 | 13.0 / 15.2 / 15.3 |
| Three eligible + two witnesses, the scripts' timing (5) | 12.4 % / 0.071 % | 15.0 / 33.7 / 67.1 | 2.3 % / 0.001 % | 13.2 / 30.5 / 45.5 |
| Three eligible + two witnesses, independent phases (5) | 1.91 % / 0.014 % | 13.1 / 30.2 / 53.2 | 0.38 % / 0 | 12.9 / 15.2 / 37.9 |
| Five eligible, the scripts' timing (5) | 24.2 % / 2.06 % | 17.2 / 45.2 / 117.2 | 4.0 % / 0.069 % | 13.5 / 30.1 / 56.4 |
| Five eligible, independent phases (5) | 3.8 % / 0.10 % | 13.4 / 29.9 / 116.4 | 0.74 % / 0.003 % | 12.9 / 15.2 / 45.7 |
Notes on the table:
- With three voters, 0 of 200,000 runs needed a second round (a 95 % upper bound of 1.5 × 10⁻⁵).
- A single candidate (two eligible nodes and a witness, three voters,
failover-e2e.sh) always took one round, before and after. - The partition simulator (
tests/sim.rs, 3 to 5 voters) still passes. It prints how many schedules took 10 s or more to recover after healing, but doesn't assert it.- At CI's 10,000 schedules that count went from 3 (a pre-candidate keeping its own retry time) to 8 (the round-only wait). That isn't significant: one generator drives each schedule's delays, drops, jitter and chaos, so any change re-randomises every schedule (two-sided p ≈ 0.23).
- At 100,000 schedules on the same seeds (
f2el_r4): main had 249 (worst 32.6 s), the earlier form 47 (worst 16.45 s), and the round-only wait 52 (worst 16.45 s). Giving way cut that tail about five-fold, and the two forms of it don't differ.
- There is one real mechanism left, at any voter count: a pre-vote grant delayed by more than
ROUND_MSplus the giver's tick lag can still let two candidates cross and split. The simulator exercises it (it delays 5 % of its messages by up to 3 s);rounds.rscan't (its delays average 6 ms). Each occurrence costs one lease. In production it needs an RPC stall of about 2 s (TCP retransmits, an overloaded Pi). It is not a safety issue.
What it costs: a lower node that can't win. A node that keeps granting pre-votes to lower nodes that can't win is held back after each one: for a round (2 s, plus the next tick of its loop) as a follower or as a pre-candidate that stands down. rounds.rs builds the case, with only one node, H, able to win once the primary is gone (200,000 seeds each; mean / p99 / worst seconds after the kill, before → after):
| Scenario | the scripts' timing | independent phases |
|---|---|---|
Cut4: four voters, L and X sort before H, the L-X link cut | 12.5 / 15.3 / 24.5 → 14.5 / 19.3 / 27.1 | 12.5 / 15.3 / 24.6 → 14.0 / 17.5 / 26.1 |
Star5: five voters, three lower leaves that reach only H | 12.9 / 15.2 / 24.4 → 14.9 / 20.1 / 34.6 | 12.9 / 15.2 / 24.4 → 14.6 / 19.3 / 34.6 |
- H is elected in every run, so the election is delayed, never stopped. The lower nodes' asks follow their own jitter, redrawn on every step, so each further delay is a fresh draw.
- With the scripts' near-lockstep ticks, all of them are freed together, so H's first attempts are often spoiled; each spoil costs H a round.
- The test's bound is
LEASE_MSplus twenty spoiled attempts of a round and a tick each (60 s). Star5's worst case, 34.6 s, is abovespec/12§10's 30 s (see "Spec and tests").- In an earlier form of this decision, a pre-candidate that gave way kept its own retry time (5 to 12.5 s after its attempt started). That took 17.4 / 32.6 / 62.0 and 14.6 / 26.6 / 57.0 (
Cut4), and 17.4 / 33.8 / 64.3 and 15.0 / 26.8 / 50.3 (Star5) on the same seeds. Every split rate in the table above is the same either way.
Spec and tests
with three voters the worst case in the model is one round, 15.3 s after the kill (mean 13.03 s), so spec/12 §10's 30 s holds and stays as written. In the partial-partition cases above (Star5: lower nodes that can't win), the model's worst case is 34.6 s against 24.4 s on main, which exceeds that 30 s; the promise was written for a plain kill, and the spec isn't changed. gitops-failover-e2e.sh (three voters) keeps its 45 s limit, and its comment now says why: one round that splits for a reason the model doesn't have still passes.
Consequences
- In a tie, the node with the lower node ID becomes primary (
docs/running.md, the Cluster guide). The ID is the first 16 hex digits of the SHA-256 of the node's key, so the tie always goes to the same node, and that can't be configured. - If that lowest-ID node is systematically slow (for example a Pi whose SD-card fsync takes more than 2 s), it takes every tie and can time out its own real round, which then costs a lease. The hazard existed before; now it falls on the same node every time.
- A node that keeps granting pre-votes to lower nodes that can't win (they reach it but not a majority) is held back after each one, as measured above. Its attempts are delayed, never stopped (any number of voters). An eligible node could ask over and over on purpose to hold higher nodes back, but it holds the cluster key and could already stand and win (ADR-154's trust note), so this widens nothing.
- With more than three voters a split is still possible, now and then (see the table): left to the owner. A wait that grows after a split round would make the third round rarer still.
Alternatives rejected
- A random wait before the first attempt (Raft's randomized timeout). With loops that tick in step, two waits land in the same 250 ms tick with a chance of about 250 ms over the range, so a range short enough not to slow every failover (adding about a third of it on average) doesn't separate them.
- A finer tick, or a wake-up at the retry time: more wake-ups, and still a slower first attempt.
- Fixed delays by rank: a node waits whenever a lower one is dead, and the
Electordoesn't know which voters are eligible. - Widening the e2e limit, which would only hide the split.
Verification
clu_005_crossed_pre_votes_elect_the_lower_node_in_one_round,clu_005_a_follower_gives_a_lower_node_whose_pre_vote_it_grants_a_roundandclu_005_giving_way_costs_the_giver_one_round(unit tests).- The first one's lease check fails when the follower's lease check is taken out of
tick. - The third one fails when a pre-candidate keeps its own retry time.
- The first one's lease check fails when the follower's lease check is taken out of
clu_005_a_failover_with_two_candidates_takes_one_round(three voters),clu_005_four_candidates_split_the_vote_far_less_often(five voters) andclu_005_two_candidates_with_two_witnesses_split_less_often(five voters): they fail before this decision and pass after.clu_005_a_failover_with_one_candidate_takes_one_round.clu_005_a_lower_node_that_cannot_win_only_delays_the_election(Cut4,Star5).clu_005_failover_timing_never_elects_two_primaries: adversarial delays up to 3 s, up to 5 % lost, all seven topologies.tests/sim.rs.gitops-failover-e2e.shon real processes, against the base binary: on the build VM, 2 CPUs per cluster, two clusters at once with the binaries alternating, 21 runs each. The new binary needed one round in 21 of 21 (14 to 16 s). The base binary needed one round in 20 and two in 1 (36 s). All 42 passed.failover-e2e.shanddeploy/cluster/e2e.shpass on the new binary.- Twenty runs can't show a rate of 10⁻⁴; the simulation is the proof.
Requirements CLU-005
Builds on ADR-154
ADR-179 A credential file on an alert destination made through the API is set by an administrator, in a folder meant for secretsan alert destination can name token_file (ntfy, Gotify) or password_file (email).
Context
an alert destination can name token_file (ntfy, Gotify) or password_file (email). The node reads the file when it sends and passes what it holds on: as a Bearer token or in Gotify's URL to the destination's address, or in the login to the mail server. Destinations made through the API and the UI (T9.6, an override kind of ADR-069) needed the operator role (agents: config:write:alerts), and nothing said which file one could name. So the choice of a file, and of where its content goes, was open to a role that isn't trusted with the node's secrets: backups, users and the cluster's keys are an administrator's. Found in a code review on 2026-11-19.
Decision
- Who. Only an administrator adds or changes an alert destination made through the API that names a credential file, before or after the change: an admin's own sign-in (a session or HTTP Basic) or an admin-scoped API token. An agent token never counts as one, whoever owns it and whatever else it may do (an admin's token that also holds
cluster:adminincluded): a credential file is the kind of secret a backup holds, and agents can't download backups either. A token for MCP from the sign-in provider (ADR-071) is an agent token too. - Anyone else gets 403
forbiddennaming the field, with the hint "Setting or changing a credential file needs an administrator", and a dry run is refused the same way. They keep every destination without a credential file, may delete any destination (that only takes something away), and may send a test to any (it goes where an administrator chose). - The check runs where the write is planned, on the node that applies it, against the destination in effect (the files' or the API's), before anything else in the body is checked. A write forwarded from a replica carries whether the entry node found the caller to be an administrator (
by_admin). The primary trusts the entry node for that as it already does for who the caller is (ADR-054: members authenticate each other with mTLS, and an ephemeral member can't forward writes), so the flag gives a member nothing it couldn't do before. A write from a node that doesn't send the flag is not an administrator's. - Every route that writes an alert destination goes through this:
PUT/DELETE /api/v1/alerts/destinations/{name}, their dry runs, and a replica's forwarded write. There is no other: no bulk or import route, and no MCP or plan tool writes one (an MCP tool calls the REST routes with the credentials its request came with). - REQ: OBS-010, API-002, in
credential_guard(api_backend.rs),ManagedWrite::by_adminand the forwardedWrite::Managed. - Where. The file is an absolute path, written without
.,..or empty parts, under one of three folders:/run/secrets/(Docker and Compose secrets, the documented and UI-suggested place),/etc/telltale-secrets/(the Helm chart'ssecretMounts), or<data_dir>/secrets/(for a native install, or anything else). These are where a file is put to be a secret for a service; the data directory itself (the state database, the cluster's keys, the setup token) and the rest of the filesystem are not. The rule bounds where a file may be, not which secret it is:/etc/telltale-secrets/also holds the chart's other mounts (an OIDC client secret, for one), and on a Compose host/run/secrets/can hold other services' secrets./run/secrets/kubernetes.io/is excluded: Kubernetes puts the pod's service-account token there. The path is compared by components (/run/secrets-xis not under/run/secrets), as written and then with its links followed as far as it exists against the folders with theirs followed: a Kubernetes Secret mount's own links (key -> ..data/key) stay inside and pass, a link that leads out of the folder is refused (also when its target isn't there yet), and a file that doesn't exist yet passes on its path alone, so an administrator can create it afterwards. Insecret_path.rs; one rule for both places below. (Amended 2026-11-20, proposed with ADR-181: the cloud workload-identity token folders/run/secrets/eks.amazonaws.com/and/run/secrets/azure/(and/var/run/secrets/...) are excluded too, for alert destinations and routers alike; and no alert destination names a file the routers feature keeps in<data_dir>/secrets/: a name there startingrouter-,.writtenor.request-key(in any ASCII case), as written or through a link, an administrator's included, so not even an administrator can send a key pasted in the UI to an alert's address. A key a platform mounts in/run/secrets/or/etc/telltale-secrets/is still a file an administrator may name for an alert destination: that part of ADR-179 is unchanged.) - At write time, every API write of an alert destination that names a credential file, an administrator's included, is refused otherwise with 422
invalid_confignaming the field and the folders. The message is the same whatever is at the path (nothing read from a file, and no difference between a file that is there and one that isn't), and an operator gets the 403 first. - At use time, every destination in effect that names a credential file is held to the rule unless it is equal to one that this node's own sources define: its config files and, on a node that takes the cluster's configuration from Git, the commit in use (
<data_dir>/cluster/git-shared.toml). The merged configuration doesn't keep where an entry came from, so the node asks the other way round: what its administrators wrote stays as written, and everything else is checked. That covers a destination made through the API on this node (stored by an older version, or restored from a backup), an API override of a file's destination (not equal to the file's), a destination this node took from another (a replica's Send test, and a primary promoted after a failover, whose configuration is its files plus the cluster's last manifest), and a primary pinned to a version, whose destinations come from an earlier version of its own configuration. A destination held this way is not used: its file isn't read, alerts aren't sent to it, its test send answers why, and the node logs one warning naming it each time the configuration changes (not at every check), with the reason shown as its last delivery on the Alerts page. The check fails closed: if it can't run, no destination with a credential file is sent until it does (one warning); a part of the path that can't be looked at is refused; and if the config files couldn't be read at start-up (the running configuration then stands in for them, API entries and all), nothing counts as the node's own until a reload reads them (one warning). The files are stored before the configuration made from them on every reload, so a check that reads the new configuration also reads its files. Nothing is read fromstate.dbfor it. - The cost: on a node that follows another, a destination from the primary's config files whose file is outside the folders, and which this node's own files don't define the same way, isn't sent from here: a replica's Send test refuses it, and after a failover the new primary doesn't send to it, until its file moves into a folder or that node's own files define it the same way. While the cluster is pinned, an administrator who edits a config-file destination whose file is outside the folders stops it being sent until the pin ends (the pinned version still has the old definition). With the Helm chart every pod mounts the same ConfigMap (
statefulset.yamlandresolvers.yamlboth mount it at/etc/telltale), so such a destination is equal there and unaffected.
Not covered
destinations in this node's config files, the Helm values or the Git commit in use (whoever writes those controls the node), which keep any path; an administrator (trusted with the node's secrets already); a user of the host who can write or link files into one of the folders (they control what the folder holds); a destination stored before the upgrade, by a role below admin through an older version, that names another secret inside one of the folders (it passes the rule: see Upgrading); on a node whose own resolver is TelltaleDNS, anyone who may add local names or forwards can change where an http:// destination's host resolves, so a token sent over http:// can reach that address (https://, smtps:// and STARTTLS are protected by certificate checks; prefer https:// for a destination with a credential file; whether to refuse http:// there is left to the owner).
Consequences
- An admin's agent token (or a token for MCP from the sign-in provider) can no longer add or change a destination with a credential file; the admin's own sign-in or an admin-scoped API token can.
- An administrator can no longer name a credential file outside the three folders through the API or the UI, including when overriding a destination of the config files whose file is elsewhere (change it in the files, or move the file into a folder).
- Upgrading: a destination made through the API whose file is outside the folders stops sending after the upgrade, on every node that runs this version; the node logs which one and the Alerts page shows why, until an administrator saves it again with a file inside a folder. Destinations in the config files are unaffected. After upgrading, review the destinations made through the API that have a credential file (the Alerts page, or
GET /api/v1/config/entries?kind=alert_destination), and look in the audit log foralert_destination.putby actors that weren't administrators. - Mixed versions: an older primary applies a forwarded write without these checks (the node that applies the write decides, so the rules hold once the primary runs this version); a primary that runs it refuses an administrator's credential-file change that an older replica forwards, until that replica is upgraded or the change is made on the primary.
Verification
obs_010_only_an_admin_sets_a_credential_file and obs_010_only_an_admin_changes_a_destination_with_a_credential_file (the real routes, sign-in and backend: operators, an operator's and an admin's agent tokens, dry runs, an address, account or file change, deletes); obs_010_a_write_says_whether_an_administrator_made_it (which callers are an administrator); obs_010_a_forwarded_write_says_whether_an_admin_made_it (the flag on the wire, and a write from an older node) and obs_010_a_forwarded_write_from_a_non_admin_is_refused (the primary's forward::apply, dry run or not, nothing stored); obs_010_an_operator_cannot_override_a_file_destination_with_a_credential_file; obs_010_credential_files_must_be_in_a_place_for_secrets (a table of refused and accepted paths through the route) and obs_010_a_link_that_leaves_a_secrets_folder_is_refused (a Secret mount's links, links out to a file, through a folder, dangling); obs_010_a_stored_destination_outside_the_secrets_folders_is_not_used (a stored entry isn't read or sent to, says why; the files' destination with the same file still sends), obs_010_a_replica_does_not_send_an_unchecked_destination (a replica's Send test: an older primary's API entry and a primary's file entry this node lacks are held; one this node's files define the same way sends), obs_010_a_promoted_primary_does_not_send_an_unchecked_destination (through the alert task), obs_010_an_api_override_of_a_file_destination_is_held, obs_010_a_git_commits_destination_counts_as_the_nodes_own, obs_010_without_its_files_a_node_holds_every_credential_file (the start-up fallback, through server::files_at_start), and obs_010_refused_are_destinations_not_the_nodes_own_outside_the_secrets_folders (the dispatcher's list, logged once per configuration, failing closed when the check can't run); obs_010_refusals_and_the_audit_log_hold_no_file_content; and the helper's obs_010_a_credential_file_is_under_a_secrets_folder_by_its_components, obs_010_links_are_followed_before_the_folder_is_compared, obs_010_a_path_that_cannot_be_looked_at_is_refused (a real folder of mode 000; it says it skipped when run as root) and obs_010_a_part_that_answers_permission_denied_is_refused (the same rule through a seam, whoever runs it).
Requirements API-002 OBS-010
Builds on ADR-054 ADR-069 ADR-071 ADR-181
ADR-180 Plugin upstreams are defined in the config file, and a local file named through the API is an administrator's choicean upstream whose URL is exec://<program> makes the node start that program (with args) as the service user and supervise it; unix://<socket> makes it connect to a local socket and exchange DNS messages there (UPS-011, ADR-075).
Context
an upstream whose URL is exec://<program> makes the node start that program (with args) as the service user and supervise it; unix://<socket> makes it connect to a local socket and exchange DNS messages there (UPS-011, ADR-075). Plugins were documented as a config-file feature, but the API's upstream entries (ADR-069), a forwarded domain's servers (ADR-040) and the pre-save check (T9.12) took them from any caller with the operator role (agents: config:write:upstreams, config:write:forwards), so the choice of a program to run was open to a role that isn't trusted with the node itself. In the same way a list's path (ADR-069) made the node read a file the operator chose on every refresh, and a simulation's candidate (ADR-115, open to viewers) could name list, zone, hosts and TLS files for the node to read; a parse error quotes part of the offending line, an I/O error tells whether the file is there, and those messages reached callers below admin. Found in a code review on 2026-11-19, while checking the fields of ADR-179.
Decision
- The rule. A setting a caller supplies through the API that makes the server start a program or connect to a local socket is a configuration-file matter: whoever writes the config files, the Helm values or the Git source controls the node already.
- Writes. Every API write refuses an upstream whose
urlscheme isexecorunix(in any letter case), or that hasargs, and a forwarded domain with such a server: 422invalid_confignaming the field, with the hint "Plugin upstreams (exec://,unix://) are defined in the config file." This holds for every caller, an administrator's session and admin token included: a program start isn't something a browser session, an API token or an agent should be able to cause, and the feature is a config-file one. A dry run is refused the same way. The check runs where the write is planned (plan_override,forward_of), on the node that applies it, so a write a replica forwards is checked by the primary whatever the replica runs. Overriding a config-file plugin upstream through the API is refused as well: the files are where it's changed. - Checks.
POST /api/v1/checks/upstream(Test it) refuses such a draft the same way, before anything is built: no program is started, not even for the few seconds of a check, and no socket is reached. - Stored entries. An upstream made through the API that names a program or a socket and is already in
state.db(stored by an older version, restored from a backup, or written by hand) is left out when the API's entries are merged over the files (managed::merge), so nothing is started for it. A forwarded domain made through the API keeps its other servers and loses those; the servers it keeps keep their upstream names (forward:<domain>#<n>is numbered by a server's place among the domain's servers), and the names the left-out servers had count as left-out upstreams; with none left it is left out, and its names go where they would without it (thedefaultgroup, or a route that matches them). Nothing is deleted. What named a left-out upstream is adjusted so the merged configuration stays valid and every other entry made through the API stays in effect (the merge validates whenever it did with the plugin entries in it; the only references to an upstream or an upstream group are a group's members, a client group'supstreamsand a route's group, and the routes made through the API are the forwards' own):- an upstream group made through the API loses it as a member, unless the files define an upstream of that name, which is then the one in effect (a left-out override never hides the files' entry);
- such a group left with no member is left out too (an override of the files' group gives the files' back); a
parallelone left with fewer members than it races races them all, or with one member usesfailover(the closest to what it did); - a client group made through the API that sent its queries to a group left out uses the files' choice when it overrides a files' group, otherwise the default; its other settings stay.
- The node logs one warning for each of these, naming it, when it starts, not at every rebuild. Removing a left-out entry (
DELETE /api/v1/upstreams/{name},/api/v1/forwards/{domain}) works as for any entry and takes it out of the upstream groups that still name it. - A new write that names what is left out (an upstream group's member, a client group's
upstreams) is refused with 422invalid_confignaming it and the plugin hint, rather than stored and adjusted (api_backend::left_out_guard, frommanaged::left_out_names).
- Every route that can reach such a URL:
PUT/DELETE /api/v1/upstreams/{name}and/api/v1/forwards/{domain}with their dry runs,POST /api/v1/checks/upstream, a replica's forwarded write, and MCP and agent plans (their tools call those routes with the agent's own credentials). No other kind becomes an upstream URL: upstream groups, client groups and Kubernetes map rules name groups, a stub zone's servers are IP addresses, quick rules and records hold none, there is no bulk or import route, andPOST /api/v1/cluster/promoterepublishes the last version applied.POST /api/v1/simulateand a dry run's simulation build the candidate's upstreams on a thread without an async runtime, where a plugin upstream starts no program and opens no connection, as configuration checks have always built them. - REQ: UPS-011, API-002, in
managed::plugin_field,managed::without_plugins,api_backend::plugin_refusedandchecks::upstream. - A list's local file. A list made through the API that reads a local file (
path) is pointed at a file only by an administrator: an admin's own sign-in (a session or HTTP Basic) or an admin-scoped API token, never an agent token (as in ADR-179). A write by anyone else whosepathdiffers from the file the list in effect reads (or that gives one to a list that read none) is refused with 403forbiddennaming the field, hint "Setting or changing a list's local file needs an administrator", dry runs alike, before anything else in the body is checked. Everyone with the operator role keeps URL lists, inline rules, a file list's other settings while it reads the same file, and deleting any list. The check runs where the write is planned (local_file_guardinplan_override), so forwarded writes are checked by the primary with the caller'sby_admin. - No folder rule at use time. The documented place for such a file is anywhere an administrator keeps it (
/etc/telltale/allow.txtin the docs, a Pi-hole import'sfile://lists), so no allowed folder fits, and the merged configuration keeps no record of who made an entry: a list stored before the upgrade keeps reading its file. What reading it went wrong with is what a caller below admin no longer sees (next). - Errors below admin.
GET /api/v1/listsshows a failing list read from a local file with a generic reason to a caller below admin, and the whole message to an administrator (the node's log has it, as before); URL and inline lists are unchanged. The health reason (GET /api/v1/system/health) and thelist_failingalert, which everyone who sees health or gets alerts reads, name such a list without its error (health::list_failing_summary). The pre-save upstream check, when a TLS file the draft names (tls_ca,tls_client_cert,tls_client_key) can't be used, and an email destination's test send, when itstls_cacan't be used, give a caller below admin a reason that doesn't say what the file holds or why it couldn't be read (the same for a missing file and a malformed one), and an administrator the message; the node logs it. These fields keep the operator role and get no folder rule: their content isn't sent anywhere. - Simulations below admin. A simulation run by someone who isn't an administrator can name only the local files (a list's
path, a zone'sfile,[local] hosts_files, an upstream's TLS files) and plugin upstreams that the configuration in effect names in the same field (simulate::new_local_name). Anything else is refused before it's read:POST /api/v1/simulateanswers 422 naming the field, and a dry run's simulation answersavailable: falsewithreason: local_filewhile the dry run itself answers as before. A candidate that names only the configuration's own files, as a Git commit usually does, runs as before; so does an administrator's. Peers keep the rule they had (sim.runrefuses a list file the peer doesn't read) and get only candidates the entry node let through. - Fetching and compiling for a simulation follow this node's rules, for every caller, per list and in total:
- Per list: the candidate's
[filter]link-local switch, byte cap, timeout,compile_memoryandmax_regexesare replaced by this node's (a candidate's take effect only after a restart, since[filter]needs one), and a list's ownmax_bytesis held to what this node allows for that list now (simulate::with_this_nodes_downloads, on the entry node and on each peer). A list file is read only up to its cap, as the node's own refresh reads it. An administrator's simulation of a commit that changes them shows the lists as this node would fetch them until it restarts. - In total: one simulation reads at most 4 changed lists by URL (or from this node's stored copy) or from a file, and their caps add up to no more than 4 times this node's
max_list_bytes(simulate::over_fetch_limit). 4 is the defaultfetch_concurrency: a simulation holds no more list text at once than this node's own refresh does with the default settings (each changed list's text is kept until the side snapshot is compiled), and a change made in the UI touches one list, or a few, at a time. Beyond that,POST /api/v1/simulateanswers 422 naming the limit and a dry run's simulation answersavailable: falsewithreason: download_limit, before anything is fetched; a peer applies the same check with its own configuration. - One at a time: the node's one simulation at a time now covers fetching the changed lists (the slot is taken before the first download and kept until the replay ends), so concurrent simulations no longer download in parallel; the others get 409
simulation_busy(reason: busyforsimulate=auto), as before.
- Per list: the candidate's
- The backend learns whether the caller is an administrator from the API layer (
by_adminon writes, as in ADR-179, and now oncheck_upstream,alert_testandsimulate). - REQ: FLT-004, OBS-024, OBS-010, API-002.
Not covered
the config files, the Helm values and Git (unchanged: a plugin upstream defined there starts its program as before, and a list there reads any file); a user of the host who edits state.db (such an entry is left out at the merge, as above); a list stored through the API before the upgrade (it keeps its file; only what its errors show changes); what else GET /api/v1/lists says of a file list (size, line and rule counts) and an email destination's tls_ca error as its last delivery on the Alerts page (follow-ups); whether a TLS file an operator names in a check or on an email destination is a valid certificate file (one bit: it then builds and the probe's or the server's answer comes back, never what the file holds); entries a replica receives in the cluster's shared configuration. The manifest doesn't say which entries the primary made through the API, so a replica, or a replica promoted after a failover (which builds on the last manifest), can't leave out one that an older primary accepted through the API and published. Upgrade the primary first. On a primary promoted from a replica, such an entry is part of the configuration it was promoted with (applied.json), not of its own files or state.db, where writes are planned: DELETE answers 404 there. An upstream is replaced instead with a plain one of the same name (PUT /api/v1/upstreams/{name}), which overrides it in what the node runs and publishes; for a forwarded domain from that base, the same works on its upstreams (forward:<domain>#<n>, as GET /api/v1/upstreams lists them), since a forward made there doesn't override the base's route.
Consequences
- An administrator can no longer add, change or test a plugin upstream (or a forwarded domain to one) in the UI or the API, or override a config-file plugin upstream there; they define it in the config file.
- Upgrading: an upstream made through the API with
exec://orunix://isn't used after the upgrade: its program isn't started, the node logs a warning naming it, the Upstreams page no longer shows it in use (an override's name shows the config files' entry), and the entry stays instate.dbuntil it is removed. A forwarded domain keeps its other servers (with none, its names go to thedefaultgroup). The upstream groups and client groups that named such an upstream are adjusted as above and each is named in a warning; everything else made through the API stays in effect. The fix is to define the plugin in the config file. - Mixed versions: a replica forwards writes to the primary, which decides; an older primary still accepts such a write and publishes it, and replicas can't tell (above). Upgrade the primary first. The same holds for a list's
path, and an older entry node can still send a viewer's candidate to a peer that runs this version. - An administrator's agent token, or an administrator working through MCP, can no longer point a list at a local file; an admin's own sign-in or admin API token can. An operator can no longer add a list that reads a local file or point one at another file, and is told a generic reason when a file list or a TLS file fails. A simulation below admin that names a new local file is refused (or, in a dry run, not run).
- A simulation (anyone's, an administrator's included) that changes more than 4 lists read by URL or from a file, or lists whose caps add up to more than 4 times the byte cap, is refused (or, in a dry run, not run); a simulation that fetches lists makes the next one wait for it (409) where both used to download at once.
Verification
ups_011_plugin_upstreams_cant_be_set_through_the_api (every kind of caller, an admin's session and token included, dry runs; other upstreams still save), ups_011_a_forward_to_a_plugin_is_refused, ups_011_a_check_never_starts_a_plugin (no start is attempted; the same capture sees the supervisor try a config file's program), ups_011_stored_plugin_entries_are_left_out_of_the_merge (an added entry, an override of the files' entry, a forward, the group that named one, one warning each, nothing logged again on a rebuild, a normal override and forward still apply, a config file's plugin is untouched), ups_011_a_stored_plugin_upstream_can_still_be_removed and ups_011_plugin_upstreams_are_known_by_their_scheme; flt_004_only_an_admin_names_a_list_file (operators and agent tokens, dry runs, an admin's session and token, URL and inline lists, the same file kept, another file, deletes), flt_004_a_local_list_error_is_generic_below_admin, api_002_a_tls_file_error_in_a_check_is_generic_below_admin, obs_010_a_tls_file_error_in_a_test_send_is_generic_below_admin (a file that is there and one that isn't answer alike), obs_024_a_simulation_below_admin_names_no_new_local_file (zone, hosts, list and TLS files and plugins; the configuration's own files; an administrator's candidate) and obs_024_a_dry_run_simulation_below_admin_reads_no_new_local_file; for the adjustments after the upgrade, ups_011_a_group_emptied_by_a_left_out_plugin_keeps_the_other_api_entries, ups_011_a_parallel_group_keeps_working_without_a_left_out_member, ups_011_a_client_group_naming_a_left_out_group_keeps_working, ups_011_a_forward_keeps_its_servers_that_arent_plugins and ups_011_a_forwards_servers_keep_their_names_when_a_plugin_is_left_out (an API device, list and quick rule stay in effect in each), and ups_011_a_write_naming_a_left_out_entry_is_refused; obs_024_a_simulation_keeps_this_nodes_download_rules (a link-local address, this node's byte cap, a list's own cap; a viewer and an admin), obs_024_a_simulation_fetches_within_this_nodes_budget (too many lists by URL or from a file, too many bytes, refused before a request reaches a loopback server; within the limit as before; the compile limits), obs_024_a_dry_run_simulation_past_the_fetch_limit_isnt_run and obs_024_one_simulation_at_a_time_includes_its_downloads, and api_002_a_valid_tls_file_in_a_check_shows_only_that_it_builds (the one bit left, and no byte of the file); flt_004_a_failing_local_list_is_named_without_its_error (the health reason; the alert summary is the same function) and flt_004_a_list_file_named_like_a_url_is_still_a_local_file (a file list is told by its path, not by how its source reads). No test starts a program: every plugin path names a file that doesn't exist.
Requirements API-002 FLT-004 OBS-010 OBS-024 UPS-011
Builds on ADR-040 ADR-069 ADR-075 ADR-115 ADR-179
Referenced by ADR-069 ADR-075 ADR-115 ADR-181 ADR-182 ADR-191
No decision matches. Try fewer words, or another status or area.