Design 47 H2, design 25, glossary: follow ADR 0690 (a ledger's state takes its cap; a snapshot goes with its key)
ADR 0690, accepted 2026-11-25 on the operator's Approve, decides what H-A-636 built (a ledger's state and index buckets at the ledger's max-mib, changing ADR 0595 §3) and that an ended instance's snapshot carries its state key's lifetime (changing ADR 0597 §8). So H-A-638's withdrawal of H-A-636 and its revert of mesh-catalog 0f648e26 are dropped, H-A-636 stands by ADR 0690 §1, and H-A-634 (1), (3), (4), (8) and its checks follow both clauses: every snapshot write carries the state write's lifetime, a rebuild leaves none past it, the bus module plans the snapshot store with a lifetime per message, and the state's room is the ledger's 1 GiB. Design 25 § 12.1's ledger row, § 12.7 and the glossary's snapshot, which said "never expiring", say the same.
This commit is contained in:
+6
-2
@@ -1130,8 +1130,12 @@ becomes a message). **Decided by** ADR 0227, 0231, 0240, 0252, 0283, 0564, 0668.
|
||||
- **ledger** — a storage type keeping, per instance of a type, a history of every **operation** (one change, kept
|
||||
in order) and a state derived from that history by each operation's **ledger effect** (one of a fixed set: set
|
||||
fields, set an entry of a map, append to a list, remove), through the tool runner's `apply` (ADR 0597).
|
||||
- **snapshot** of a ledger's state — the latest state of one instance, on a subject of its own, never expiring,
|
||||
from which a rebuild starts; distinct from the stream snapshot.
|
||||
- **snapshot** of a ledger's state — the latest state of one instance, on a subject of its own in the ledger's
|
||||
**snapshot store** (a stream of the ledger beside its history, one message per instance), from which a rebuild
|
||||
starts. It never expires, save in a ledger whose own configuration gives its instances an end: an ended instance's
|
||||
snapshot carries the lifetime of its state key and goes with it, and a rebuild leaves none of an instance past that
|
||||
lifetime (ADR 0597 §8, ADR 0690 §2). Distinct from the stream snapshot; a ledger's snapshot store is never bare where
|
||||
it could be read as where the bus keeps its stream snapshots.
|
||||
|
||||
## Connectivity — how nodes and modules reach one another
|
||||
|
||||
|
||||
@@ -11,8 +11,9 @@ code:
|
||||
- mesh-sdk (the typed bus-state entry, its binding and the new calls' package, ADR 0595)
|
||||
- mesh-delivery (the manifest validator's rules and the grants part's binding, ADR 0595)
|
||||
- mesh-contracts seats/mesh-broker (the seat's definition: `list` answers each entry's binding)
|
||||
updated: 2026-11-11
|
||||
updated: 2026-11-25
|
||||
decisions:
|
||||
- "ADR 0690"
|
||||
- "ADR 0595"
|
||||
- "ADR 0626"
|
||||
- "ADR 0631"
|
||||
@@ -68,6 +69,14 @@ when asked again by hand it takes a first view of every binding from the seat `m
|
||||
`created` loses no binding for good (milestone bindings-first-view). The same change puts this design in the shape
|
||||
of playbook 02: § 12.2 to § 12.6 moved, unchanged and numbered, into the part of milestone bus-state.
|
||||
|
||||
**Amended, 2026-11-25** (ADR 0690 §1, §2, accepted that day on the operator's Approve): a ledger's state and index
|
||||
buckets take the ledger's own cap, its option `max-mib`, as its history and snapshot store do, in place of a state's
|
||||
64 MiB; and where a ledger's own configuration gives its instances an end, an ended instance's snapshot carries the
|
||||
lifetime of its state key and goes with it. § 12.1's ledger row and § 12.7 say so. The part of milestone bus-state,
|
||||
whose lines are built, keeps its §19 as written ("never expiring"), which now holds for a ledger whose instances never
|
||||
end and for an instance that has not ended. Both are built in design 47's milestone H, by its H2 lead answers H-A-636
|
||||
(the cap) and H-A-634 (the end of an instance and its snapshot's lifetime).
|
||||
|
||||
## 1. What the bus is for
|
||||
|
||||
**The bus is where the mesh happens.** Not a transport the mesh sends things over — the place a
|
||||
@@ -684,8 +693,9 @@ named: six exist, from the uses counted on main (158 state entries, 6 event stre
|
||||
**option** is one setting of a template a module may change, within its bound. A module gives a configuration of
|
||||
its own only where no template fits: the bare stream, or a ledger whose history expires.
|
||||
|
||||
**What keeps the data safe is fixed, never an option** (ADR 0595 §3). Each template fixes what happens when it is
|
||||
full, and the manifest validator refuses a manifest that gives it:
|
||||
**What keeps the data safe is fixed, never an option** (ADR 0595 §3; for a ledger's state, index buckets and snapshot,
|
||||
as ADR 0690 changes it). Each template fixes what happens when it is full, and the manifest validator refuses a
|
||||
manifest that gives it:
|
||||
|
||||
| Template | On | Fixed | Options, their bounds (default) |
|
||||
|---|---|---|---|
|
||||
@@ -694,7 +704,7 @@ full, and the manifest validator refuses a manifest that gives it:
|
||||
| work queue | stream | removed once taken; refuses when full; one taker; no grant | deliveries 1 to 10; duplicate detection up to its age; cap; age |
|
||||
| log | stream | refuses when full; never rewritten; an entry at most 256 KiB; one subject per key | cap 1 to 8192 MiB (1024); age 1 to 3650 days (none) |
|
||||
| objects | object store | refuses when full; kept for good | cap 1 to 8192 MiB, required; a grant |
|
||||
| ledger | ledger | as log, plus its type and a snapshot per instance; its state and index buckets as state | cap; keeping days only in a ledger's own configuration |
|
||||
| ledger | ledger | as log, plus its type and a snapshot per instance; its state and index buckets as state, but at the ledger's cap (`max-mib`), as its history and snapshot store are, with no other option setting their cap, and the fill condition judging them against it (ADR 0690 §1); a snapshot never expires, save where the ledger's own configuration gives its instances an end (design 47 H2, H-A-634): an ended instance's snapshot then carries the lifetime of its state key and goes with it (ADR 0690 §2) | cap; keeping days only in a ledger's own configuration |
|
||||
| (none: a bare stream) | stream | the module's own subjects; within the mesh's bounds | its own configuration, which must give "when full" (refuse or drop the oldest), a cap of 1 to 8192 MiB and an age of 1 to 3650 days or none, and may give a grant; the manifest validator refuses one missing any of the three |
|
||||
|
||||
The template log is the **module log** of ADR 0297. The mesh, never the module, names the bus objects and their
|
||||
@@ -752,6 +762,7 @@ tools, then follow its events.
|
||||
| Only the owner reaches its data | live: another module's account reading an entry in the new form, a ledger's history, snapshot or state among them, is refused; a raw publish on a ledger's history is refused |
|
||||
| The ledger keeps its promises | one integration test against the real bus (ADR 0597's How it is checked): two writers race and one is refused; two interleaved applies leave the state at the higher sequence; a write cut between history and state is repaired; a full state bucket answers taken with its sequence and catches up; an idle instance whose operations expired rebuilds from its snapshot; `rebuild`, `reindex` and `lag` repair by hand; a forged author is refused; every `apply` leaves the snapshot equal to the state; an index behind raises its condition and `reindex` clears it |
|
||||
| Only the owner applies | the ledger's integration test: another module's ledger `apply` on the knowledge base's ledger is refused |
|
||||
| A ledger's state and index buckets take its cap, and its snapshot goes with its key (ADR 0690) | the rows design 47 H2 names where it builds them (H-A-636, H-A-634): the bus module's plan tests (a ledger with `max-mib` 1024 plans its state and both index buckets at 1 GiB, with its history's keeping days of 90 too, and one with none at 64 MiB) and its fill pass (a ledger's state at 100 MiB of 1 GiB says no `full`, at 75% of it `full` naming its state); the tool runner's ledger unit tests, by write path (`apply`, `rebuild`, the repair `snapshot`): an ended instance's snapshot is written with its state's lifetime, an open one's and every one of a ledger whose instances never end with none, and none for an instance past its lifetime, whose held snapshot a rebuild leaves gone; a case of the ledger's integration test: after an ended instance's lifetime its state key and its snapshot are gone while its operations stay in the history, and an open instance's snapshot stays |
|
||||
| A bare stream is complete | the manifest validator's unit test: a bare stream missing "when full", a cap or an age is refused, naming the field |
|
||||
| The calls rebuild only their users | a read of the delivery plan: only the importers of the calls package rebuild when it changes |
|
||||
| The move keeps data | live: a module moved from `state` keeps its bucket and data and raises no drift; a new entry in an old section is still created by the grants part; the count falls by one; at 0 a manifest using the section is refused and the foundation's are still accepted; a moved module is held off a machine whose tool runner does not read the typed binding |
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
layer: to-be
|
||||
status: in-progress
|
||||
code: [mesh-controller, mesh-catalog modules/mesh-delivery-gate, mesh-catalog modules/gitea, mesh-delivery, mesh-host, mesh-sdk, mesh-vault, mesh-contracts, mesh-tools, mesh-networking, hq 00-META/checks]
|
||||
updated: 2026-11-23
|
||||
updated: 2026-11-25
|
||||
decisions:
|
||||
- "ADR 0690"
|
||||
- "ADR 0685"
|
||||
- "ADR 0684"
|
||||
- "ADR 0640"
|
||||
|
||||
@@ -3,8 +3,9 @@ layer: to-be
|
||||
status: in-progress
|
||||
design: 47
|
||||
milestone: H
|
||||
updated: 2026-11-24
|
||||
updated: 2026-11-25
|
||||
decisions:
|
||||
- "ADR 0690"
|
||||
- "ADR 0656"
|
||||
- "ADR 0597"
|
||||
- "ADR 0595"
|
||||
@@ -18,50 +19,61 @@ principle that settles it.
|
||||
|
||||
## The operator's answers, continued (2026-11-24 from 01:06 CET)
|
||||
|
||||
- **H-A-634 (an ended delivery record goes 30 days after its end, by the bus's lifetime per key; its history is kept
|
||||
90 days and none beyond; the bus module's fill names its object, 01:24, rewritten 21:55)** 24 Nov, the operator's
|
||||
answers in chat: about 01:06 CET ("sure, i guess") to the lead's design question "may the gate delete ended delivery
|
||||
records older than a set number of days (default 30)? Open records are never touched"; and between 21:20 and 21:30
|
||||
CET, after the lead set out how mature bus setups bound kept data (a lifetime per stream, a current state holding
|
||||
only what is live with a lifetime per key, a history aged or archived), "I don't think so? Why would ever need the
|
||||
history?" to "keep the gate's delivery history beyond 90 days?": no archive, the history expires. The second answer
|
||||
replaces this answer's first form (the gate deleting each ended record through `mesh/ledger.remove` at each open,
|
||||
with `gate_records_delete` and a list of month lists `held/months`): the bus removes what has ended, as the ledger's
|
||||
own configuration asks, and the gate deletes nothing. It amends G §154 (90 days counted from the opening, an open
|
||||
record removed too, `freed` at a removal), G §155 (the estimate of the ledger's growth, and a removal taking the
|
||||
operations and the snapshot), G §159 and §160 (the tools and the check of the retention), G §587's removal, and
|
||||
§820's row of `records` (its key's life "none", deleted "never"); §809's and §812's "never pruned" stand, since
|
||||
nothing prunes the ledger toward a cap. A delivery record's fields, retention and tools are the design's under ADR
|
||||
0656 §7 and §10 (G §145); a ledger that expires gives its keeping days in its own configuration (ADR 0595 §2, §8;
|
||||
ADR 0597 §1), and a state's key may be given a lifetime of its own (design 25 § 12.1's option "a lifetime per key",
|
||||
ADR 0595 §3); so the answer is design lines (playbook 02, *Answering a design question*, item 1), save where (4) and
|
||||
(8) name what a record holds. The case, read 2026-11-24 about 00:20 UTC: the bus module's condition "Kept data is
|
||||
filling up" for the gate's `records`, open since 2026-11-23 10:20, says "75% of its cap" and names no object; the bus
|
||||
module's `nats_streams` reads the ledger's state bucket at 67,108,471 of its 67,108,864 bytes (16,869 keys, last
|
||||
written 2026-11-23 11:48:52 UTC), its history at 226,666,132 of 1,073,741,824 bytes (82,178 operations, 21,969
|
||||
instances), its snapshot at 121,436,920 bytes and both index buckets with no key; the seat `mesh-broker`'s `show`
|
||||
answers only their sum (415,211,523 of 2,348,810,240 bytes); `gate_records` counts 978 records, 869 ended (840 of
|
||||
them at H1's clean state on 2026-11-20) and 109 open, the oldest opened 2026-11-14 01:05 UTC, and answers its fill
|
||||
"unread": "the runtime answers no mesh/ledger.fill from a bundle".
|
||||
- **H-A-634 (an ended delivery record goes 30 days after its end, by the bus's lifetime per key, and its snapshot with
|
||||
it; its history is kept 90 days and none beyond; the bus module's fill names its object, 01:24, rewritten 21:55, and
|
||||
on 25 Nov to ADR 0690)** 24 Nov, the operator's answers in chat: about 01:06 CET ("sure, i guess") to the lead's
|
||||
design question "may the gate delete ended delivery records older than a set number of days (default 30)? Open records
|
||||
are never touched"; and between 21:20 and 21:30 CET, after the lead set out how mature bus setups bound kept data (a
|
||||
lifetime per stream, a current state holding only what is live with a lifetime per key, a history aged or archived),
|
||||
"I don't think so? Why would ever need the history?" to "keep the gate's delivery history beyond 90 days?": no
|
||||
archive, the history expires. The second answer replaces this answer's first form (the gate deleting each ended record
|
||||
through `mesh/ledger.remove` at each open, with `gate_records_delete` and a list of month lists `held/months`): the
|
||||
bus removes what has ended, as the ledger's own configuration asks, and the gate deletes nothing. It amends G §154 (90
|
||||
days counted from the opening, an open record removed too, `freed` at a removal), G §155 (the estimate of the ledger's
|
||||
growth, and a removal taking the operations and the snapshot), G §159 and §160 (the tools and the check of the
|
||||
retention), G §587's removal, and §820's row of `records` (its key's life "none", deleted "never"); §809's and §812's
|
||||
"never pruned" stand, since nothing prunes the ledger toward a cap. A delivery record's fields, retention and tools
|
||||
are the design's under ADR 0656 §7 and §10 (G §145); a ledger that expires gives its keeping days in its own
|
||||
configuration (ADR 0595 §2, §8; ADR 0597 §1), and a state's key may be given a lifetime of its own (design 25 § 12.1's
|
||||
option "a lifetime per key", ADR 0595 §3); so the answer is design lines (playbook 02, *Answering a design question*,
|
||||
item 1), save the cap of a ledger's state and index buckets and the lifetime of its snapshot, which were a record's:
|
||||
ADR 0690, accepted 2026-11-25 on the operator's Approve, decides both, changing ADR 0595 §3 and ADR 0597 §8, and (1),
|
||||
(3), (4) and (8) follow its clauses 1 and 2, as its Consequences ask. The case, read 2026-11-24 about 00:20 UTC: the
|
||||
bus module's condition "Kept data is filling up" for the gate's `records`, open since 2026-11-23 10:20, says "75% of
|
||||
its cap" and names no object; the bus module's `nats_streams` reads the ledger's state bucket at 67,108,471 of its
|
||||
67,108,864 bytes (16,869 keys, last written 2026-11-23 11:48:52 UTC), its history at 226,666,132 of 1,073,741,824
|
||||
bytes (82,178 operations, 21,969 instances), its snapshot at 121,436,920 bytes and both index buckets with no key; the
|
||||
seat `mesh-broker`'s `show` answers only their sum (415,211,523 of 2,348,810,240 bytes); `gate_records` counts 978
|
||||
records, 869 ended (840 of them at H1's clean state on 2026-11-20) and 109 open, the oldest opened 2026-11-14 01:05
|
||||
UTC, and answers its fill "unread": "the runtime answers no mesh/ledger.fill from a bundle".
|
||||
(1) **When an instance has ended, and when its key goes.** A ledger whose own configuration gives `ended-days` (a
|
||||
whole number of days, 1 to 3650) keeps an instance's state key only until `ended-days` after the instance's end. An
|
||||
instance has ended while its state holds a value in the field its type names in `ends-with` (absent, null, an empty
|
||||
object and an empty text are no value); its end is the time the tool runner stamped (`at`) on the operation that last
|
||||
gave that field a value. The tool runner keeps that time as `ended-at` in what it keeps under the instance's key,
|
||||
beside the sequence of its last operation (and so in its snapshot), absent while the instance has not ended. Every
|
||||
write of an instance's state by the tool runner (an `apply`, its write after a lost race of ADR 0597 §5, a
|
||||
`rebuild`) gives the key the bus's per-message lifetime of what is left of `ended-days` after `ended-at`, and none
|
||||
while the instance has not ended, so a reopened instance is kept whatever its age; when nothing is left, it writes no
|
||||
state and deletes the key it holds. The bus removes the key when its lifetime ends, with no loop or timer of the
|
||||
owner or the tool runner (ADR 0682 §11; principle 1), and a watch of the state hands it as a removed key (the
|
||||
bucket's delete marker, which the keeper gives one second). An index key (ADR 0597 §4) carries the lifetime of the
|
||||
instance it names, written so by the owner's watcher and by the repair `reindex` alike, and `reindex` writes none for
|
||||
an instance whose lifetime has ended. The client's update of a key takes no lifetime (nats.go v1.54), so the tool
|
||||
runner writes a state as one publish on the key's subject with the revision it read expected and the lifetime in the
|
||||
bus's header `Nats-TTL`: the compare-and-set ADR 0597 §5 asks, unchanged. The bus serves it: the bus module runs NATS
|
||||
server 2.11.17 (mesh-catalog `modules/nats`, its image and its go.mod), per-message lifetimes exist from 2.11,
|
||||
research 082's Findings tried them on 2.11.17, and the keeper already makes a bucket that allows them (`key-ttl`).
|
||||
Built in the tool runner (mesh-tools `node-tools/internal/ledger` and `internal/bus`). Principles 1, 3 and 7.
|
||||
write of an instance's state by the tool runner (an `apply`, its write after a lost race of ADR 0597 §5, a `rebuild`)
|
||||
gives the key the bus's per-message lifetime of what is left of `ended-days` after `ended-at`, and none while the
|
||||
instance has not ended, so a reopened instance is kept whatever its age; when nothing is left, it writes no state and
|
||||
deletes the key it holds. **Its snapshot carries the same lifetime** (ADR 0690 §2): every write of an instance's
|
||||
snapshot, by `apply` and by the repairs `rebuild` and `snapshot` alike, gives the message the lifetime the write of
|
||||
its state carries, in the same header, and none while the instance has not ended; the ledger's snapshot store keeps
|
||||
one message per instance, so a reopened instance's snapshot, written with none, replaces the ageing one. When nothing
|
||||
is left, neither `rebuild` nor the repair `snapshot` writes a snapshot, and each purges the one still held under the
|
||||
instance's subject, through the tool runner's purge of one snapshot that the removal of G §587 uses today (mesh-tools
|
||||
`node-tools/internal/ledger`, `Snapshots.Purge`, on the module's ledger connection, which holds that purge's grant),
|
||||
so once the key has gone no snapshot of it remains. A ledger whose instances never end, as the knowledge base's,
|
||||
writes every snapshot with none, never expiring, as ADR 0597 §8 has it. The bus removes the key when its lifetime
|
||||
ends, with no loop or timer of the owner or the tool runner (ADR 0682 §11; principle 1), and a watch of the state
|
||||
hands it as a removed key (the bucket's delete marker, which the keeper gives one second). An index key (ADR 0597 §4)
|
||||
carries the lifetime of the instance it names, written so by the owner's watcher and by the repair `reindex` alike,
|
||||
and `reindex` writes none for an instance whose lifetime has ended. The client's update of a key takes no lifetime
|
||||
(nats.go v1.54), so the tool runner writes a state as one publish on the key's subject with the revision it read
|
||||
expected and the lifetime in the bus's header `Nats-TTL`: the compare-and-set ADR 0597 §5 asks, unchanged. The bus
|
||||
serves it: the bus module runs NATS server 2.11.17 (mesh-catalog `modules/nats`, its image and its go.mod),
|
||||
per-message lifetimes exist from 2.11, research 082's Findings tried them on 2.11.17, and the keeper already makes a
|
||||
bucket that allows them (`key-ttl`), and makes the ledger's snapshot store allow them by (3). Built in the tool runner
|
||||
(mesh-tools `node-tools/internal/ledger` and `internal/bus`). ADR 0690 §2; principles 1, 3 and 7.
|
||||
(2) **The gate's ledger.** The gate's `records` gains its own configuration: `max-age-days` 90, its history's keeping
|
||||
days (ADR 0597 §1; none beyond, the operator's answer), and `ended-days` 30 (the operator's answer), beside its
|
||||
option `max-mib` 1024. Its types `record`, `mover` and `act` name `ends-with: ended`; `mover` and `act` gain the
|
||||
@@ -77,38 +89,48 @@ principle that settles it.
|
||||
its code; the 30 days are the ledger's `ended-days`, changed by a change of the gate's manifest (principle 11: a value
|
||||
in the manifest, never in the code); the words of a full ledger (`room`, G §181) name `ended-days` or a larger cap
|
||||
where they named `record-retention`. Built in the gate (mesh-catalog `modules/mesh-delivery-gate`). ADR 0656 §7.
|
||||
(3) **The bus module, the manifest validator and what is held.** The bus module plans the state bucket and each
|
||||
index bucket of a ledger whose own configuration gives `ended-days` with a lifetime per key (`key-ttl`), at the
|
||||
state's cap of 64 MiB (ADR 0595 §3; H-A-638), and writes `ended-days` into the ledger's binding beside its types, so
|
||||
the tool runner reads it from the module's membership. The manifest validator takes `ended-days` in a ledger's own
|
||||
(3) **The bus module, the manifest validator and what is held.** The bus module plans the state bucket and each index
|
||||
bucket of every ledger at the ledger's cap, its option `max-mib` (ADR 0690 §1, built by H-A-636); for a ledger whose
|
||||
own configuration gives `ended-days`, it plans them with a lifetime per key (`key-ttl`) and the ledger's snapshot
|
||||
store with a lifetime per message (ADR 0690 §2), and writes `ended-days` into the ledger's binding beside its types,
|
||||
so the tool runner reads it from the module's membership. The snapshot store's lifetime per message is the plan's
|
||||
`key-ttl` on a stream: the keeper makes it as the bus's `AllowMsgTTL` and reads it back from a held stream as it reads
|
||||
a bucket's, so its comparison of held and asked settings sees it. Fate: today the keeper makes and reads `key-ttl` on
|
||||
a bucket alone, and the snapshot store takes no lifetime. The manifest validator takes `ended-days` in a ledger's own
|
||||
configuration from 1 to 3650 and refuses an `ends-with` naming no field of its type's schema, a ledger giving
|
||||
`ended-days` with no type naming `ends-with`, and a type naming `ends-with` in a ledger with no `ended-days`, each
|
||||
naming the field (ADR 0595 §8). mesh-sdk's catalog package gains `ends-with` on a ledger type and the configuration
|
||||
name `ended-days`, and its membership's ledger binding `ended-days`. The gate's held `records` then differs from what
|
||||
is asked: its history kept for good against 90 days, its state and index buckets with no lifetime per key. Neither
|
||||
only grows, so the bus module raises `drifted`, and only its `recreate`, on the operator's warrant after the stream
|
||||
snapshot, applies them (ADR 0595 §5). That `recreate` rebuilds from its data where the bus allows it, as §5 has it:
|
||||
after the snapshot the keeper changes each object of the entry in place where the bus takes the asked settings on a
|
||||
held object (a shorter age, a smaller cap, a lifetime per key turned on), keeping what those settings keep (a smaller
|
||||
cap the newest that fit), and deletes and makes again empty only an object the bus refuses to change in place (a
|
||||
lifetime per key turned off, another retention); the ask its tool raises names, per object, which of the two it
|
||||
is asked: its history kept for good against 90 days, its state and index buckets with no lifetime per key, and its
|
||||
snapshot store with no lifetime per message; its state and index buckets are held at its `max-mib` of 1 GiB since
|
||||
mesh-catalog #751, as asked (read 2026-11-25 12:25 CET, ADR 0690's Context). None of the three only grows, so the bus
|
||||
module raises `drifted`, and only its `recreate`, on the operator's warrant after the stream snapshot, applies them
|
||||
(ADR 0595 §5). That `recreate` rebuilds from its data where the bus allows it, as §5 has it: after the snapshot the
|
||||
keeper changes each object of the entry in place where the bus takes the asked settings on a held object (a shorter
|
||||
age, a smaller cap, a lifetime per key or per message turned on), keeping what those settings keep (a smaller cap the
|
||||
newest that fit), and deletes and makes again empty only an object the bus refuses to change in place (a lifetime per
|
||||
key or per message turned off, another retention); the ask its tool raises names, per object, which of the two it
|
||||
does. Fate: today the keeper deletes and makes again empty every object of the entry, which for the gate's `records`
|
||||
would remove every record, open ones included. Built in the bus module (mesh-catalog `modules/nats`), the manifest
|
||||
validator (mesh-delivery `modules/mesh-delivery-indexer/judge`) and mesh-sdk. ADR 0595 §2, §3, §5, §8; principle 3.
|
||||
validator (mesh-delivery `modules/mesh-delivery-indexer/judge`) and mesh-sdk. ADR 0690 §1, §2; ADR 0595 §2, §5, §8;
|
||||
principle 3.
|
||||
(4) **What the replay, the repairs and the snapshot do with an ended instance.** No read replays: `get` and `watch`
|
||||
answer the state as the bucket holds it, null for a key gone (ADR 0597 §10). `apply` replays an instance whose state
|
||||
is behind its history (ADR 0597 §5): for one whose key has gone while its history stands, from its snapshot and the
|
||||
operations after it. The gate applies none ((2)); an owner that does gets the instance back with its new operation,
|
||||
kept only by the lifetime that state gives ((1)), so an instance still ended past `ended-days` is not written again.
|
||||
`rebuild` derives each instance from its history or its snapshot and writes it with its lifetime by (1): it brings
|
||||
back none past its lifetime, and gives each instance held before this answer its lifetime. `lag`, and the index's
|
||||
condition of ADR 0597 §4, count an instance whose lifetime has ended as not behind. `get` and `watch` answer beside an
|
||||
instance's state its `expires` (`ended-at` plus `ended-days`), absent while it has not ended. The snapshot stays as
|
||||
ADR 0597 §8 has it, the latest state of every instance, never expiring: an ended record's last state stays in the
|
||||
snapshot store after its key and, from 90 days, its operations have gone, read by nothing but `apply`'s replay and
|
||||
`rebuild`, which (1) keeps from bringing it back; a snapshot that goes with its key is a decision changing ADR 0597
|
||||
§8, not a design line. Built in the tool runner and mesh-sdk's `buscalls` (`InstanceState` and a watch's change gain
|
||||
`expires`). ADR 0597 §5, §8, §10; principles 3 and 4.
|
||||
is behind its history (ADR 0597 §5): for one whose key and snapshot have gone with their lifetime, from the operations
|
||||
its history still holds, which may lack its oldest once the history's keeping days have removed them (ADR 0690's
|
||||
Consequences). The gate applies none ((2)); an owner that does gets the instance back with its new operation, kept
|
||||
only by the lifetime that state gives ((1)), so an instance still ended past `ended-days` is not written again.
|
||||
`rebuild` derives each instance from its history or its snapshot and writes it and its snapshot with their lifetime by
|
||||
(1): it brings back none past its lifetime and leaves no snapshot of one, and gives each instance held before this
|
||||
answer, and its snapshot, its lifetime. The repair `snapshot` rewrites a snapshot behind its state with that state's
|
||||
lifetime, and writes none for an instance whose lifetime has ended ((1)). `lag`, and the index's condition of ADR 0597
|
||||
§4, count an instance whose lifetime has ended, its state and its snapshot gone, as not behind. `get` and `watch`
|
||||
answer beside an instance's state its `expires` (`ended-at` plus `ended-days`), absent while it has not ended. Fate:
|
||||
every snapshot is written today with no lifetime (ADR 0597 §8 as accepted), so an ended record's last state would stay
|
||||
after its key and its operations had gone, read by nothing but a repair that must not bring it back; the snapshots
|
||||
held before this answer take their lifetime, or go, at (10)'s `rebuild`. Built in the tool runner and mesh-sdk's
|
||||
`buscalls` (`InstanceState` and a watch's change gain `expires`). ADR 0690 §2; ADR 0597 §5, §8 as ADR 0690 §2 changes
|
||||
it, §10; principles 3 and 4.
|
||||
(5) **How the gate lists its records.** The gate keeps the key and the opening of every record its ledger holds from
|
||||
a watch of its own ledger's `record/>` (ADR 0597 §10's `watch`: the current states at its start, then each change; a
|
||||
key gone by its lifetime handed as removed and forgotten, and a listed record whose key reads null dropped as well),
|
||||
@@ -124,12 +146,14 @@ principle that settles it.
|
||||
(6) **What goes.** The gate deletes nothing: its sweep at each open (`Sweep`) and that open's refusal ("the records
|
||||
past their retention cannot be removed, so no record is opened") go. G §587's `mesh/ledger.remove` loses its one
|
||||
caller and goes, with its request and answer (`LedgerRemoveRequest`, `LedgerRemoved`) in mesh-sdk's `buscalls`, the
|
||||
tool runner's removal and its place among the calls of `ledger-upkeep-calls`; `mesh/ledger.fill` stays, and the tool
|
||||
runner answers it to a bundle for its own ledgers, which it does not today. The first form's `gate_records_retention`,
|
||||
`gate_records_delete`, `held/months` and the gate's deletion at each open are not built. G §154's `freed` at a
|
||||
removal ends: the revisions a record names are kept by the indexer's pins (H §749, H-A-566, H-A-572), not by the
|
||||
record, and the seat `mesh-delivery`'s definition declares neither `pinned` nor `freed`. No event is added for an
|
||||
expiry: no part acts on one. Principle 7.
|
||||
tool runner's removal and its place among the calls of `ledger-upkeep-calls`, and its purge of an instance's
|
||||
operations from the history (`History.Purge`), which nothing else calls; its purge of one snapshot (`Snapshots.Purge`)
|
||||
stays, called by `rebuild` and the repair `snapshot` ((1)); `mesh/ledger.fill` stays, and the tool runner answers it
|
||||
to a bundle for its own ledgers, which it does not today. The first form's `gate_records_retention`,
|
||||
`gate_records_delete`, `held/months` and the gate's deletion at each open are not built. G §154's `freed` at a removal
|
||||
ends: the revisions a record names are kept by the indexer's pins (H §749, H-A-566, H-A-572), not by the record, and
|
||||
the seat `mesh-delivery`'s definition declares neither `pinned` nor `freed`. No event is added for an expiry: no part
|
||||
acts on one. Principle 7.
|
||||
(7) **Its tools** (principle 4; G §159's four lines). `gate_records_expiring` reads what goes when, removing nothing:
|
||||
given `within` (days, 1 to 3650, default the ledger's `ended-days`), every ended record whose key expires within it,
|
||||
the soonest first (its key, opened, ended, `expires`, its movers and acts as counted and as the indexes name them),
|
||||
@@ -141,15 +165,17 @@ principle that settles it.
|
||||
the hand-act log of the seat `mesh-hand-acts`, as `gate_record_end` is (G §159). The tool runner's repairs of the
|
||||
gate's ledger (`ledger_rebuild`, `ledger_reindex`, `ledger_lag`) repair what (1) keeps. Built in the gate.
|
||||
(8) **Its size.** G §155's estimate is replaced by the case's figures, each about: a state key 3.9 KiB (67,108,471
|
||||
bytes in 16,869 keys), 22 instances a record (21,969 for 978), so 87 KiB of state a record; 226 KiB of history and
|
||||
121 KiB of snapshot a record; 98 records a day over the case's ten days. The state, at most 64 MiB (ADR 0595 §3;
|
||||
H-A-638), holds 30 days of ended records below about 25 records a day, and stays under the bus module's raise mark
|
||||
of 75% below about 18; at the case's rate 30 days need about 250 MiB, at G §155's estimated 20 a day about 51 MiB.
|
||||
The history, at 1 GiB, holds 90 days below about 51 records a day (at the case's rate about 1.9 GiB). The snapshot
|
||||
store, never expiring ((4)), reaches its 1 GiB after about 88 days at the case's rate and about 430 at 20 a day,
|
||||
and then, as the bus module plans it, drops its oldest. Above those rates the state refuses when full and loses no
|
||||
operation (ADR 0597 §6), the history refuses when full (G §181's `full`), and the bus module's condition says which
|
||||
object is full ((9)); a cap above 64 MiB for a ledger's state is a decision changing ADR 0595 §3 (H-A-638).
|
||||
bytes in 16,869 keys), 22 instances a record (21,969 for 978), so 87 KiB of state a record; 226 KiB of history and 121
|
||||
KiB of snapshot a record; 98 records a day over the case's ten days. The state, at the ledger's cap of 1 GiB (ADR 0690
|
||||
§1; H-A-636), holds 30 days of ended records below about 400 records a day, and stays under the bus module's raise
|
||||
mark of 75% below about 300; at the case's rate 30 days need about 250 MiB, at G §155's estimated 20 a day about 51
|
||||
MiB. The history, at 1 GiB, holds 90 days below about 51 records a day (at the case's rate about 1.9 GiB). The
|
||||
ledger's snapshot store, each snapshot going with its key ((1); ADR 0690 §2), holds 30 days of ended records and the
|
||||
open ones: at the case's rate about 350 MiB, at 20 a day about 71 MiB, and it reaches its 1 GiB only above about 290
|
||||
records a day, when, as the bus module plans it, it drops its oldest. Above those rates the state refuses when full
|
||||
and loses no operation (ADR 0597 §6), the history refuses when full (G §181's `full`), and the bus module's condition
|
||||
says which object is full ((9)); the state's room grows with the ledger's `max-mib` alone, a change of the gate's
|
||||
manifest (ADR 0690 §1; principle 11).
|
||||
(9) **The bus module names the object it judged.** (ADR 0595 §6) The bus module's fill pass already reads each
|
||||
object of an entry that refuses when full and keeps the highest share; `full` and `full-cleared` carry that object:
|
||||
`object` (its bus name), `part` (its place in the entry's binding: `history`, `state` or `index <name>` for a
|
||||
@@ -162,33 +188,45 @@ principle that settles it.
|
||||
`records` ((3); one ask, said to the operator before it is raised, naming each object it changes in place). Then by
|
||||
hand, each a hand act: `ledger_reindex` of `movers` and `acts`, so the indexes name each record's movers and acts
|
||||
(they held no key in the case); `gate_records_follow_ends`; `ledger_rebuild` of the whole ledger, so every instance
|
||||
held before this answer gets its lifetime ((4)); and `ledger_reindex` of both again, so their keys take those
|
||||
lifetimes. The 840 records ended at H1's clean state then go on 2026-12-20.
|
||||
held before this answer, and its snapshot, gets its lifetime, and no snapshot of one past it stays ((1), (4)); and
|
||||
`ledger_reindex` of both again, so their keys take those lifetimes. The 840 records ended at H1's clean state then go
|
||||
on 2026-12-20.
|
||||
How it is checked: rows of the tool runner's ledger unit tests, never a new top-level test function: an instance whose
|
||||
`ends-with` field gets a value is written with a lifetime of `ended-days` from that operation's `at`, and one emptied
|
||||
again with none; an end written again moves `ended-at`; a `rebuild` of an instance ended past `ended-days` writes no
|
||||
state and deletes the key held; `reindex` writes an instance's index keys with its lifetime and none past it; `lag`
|
||||
counts it not behind; `get` answers `expires`. A case of the ledger's one integration test on the real bus, the day
|
||||
shortened in the test: a key written with a lifetime of two seconds is gone after them and a watch hands it removed,
|
||||
and a racing writer of a key with a lifetime is refused. Rows of the keeper's plan tests: a ledger with `ended-days`
|
||||
plans its state and index buckets with a lifetime per key at 64 MiB and writes `ended-days` in its binding, one
|
||||
without plans none; rows of its `recreate` tests: a shorter age and a lifetime per key turned on are changed in place
|
||||
with their data kept, a lifetime per key turned off is made again empty, and the ask names which. Rows of the
|
||||
manifest validator's unit tests: `ended-days` 0 and 3651 refused and 30 taken; an `ends-with` naming no field
|
||||
state and deletes the key held; and the snapshot, by write path (ADR 0690's How it is checked): through `apply`, an
|
||||
operation that ends an instance writes its snapshot with the same lifetime as its state, one that reopens it writes
|
||||
its snapshot with none, and in a ledger whose instances never end every snapshot is written with none; through
|
||||
`rebuild`, an instance ended within its lifetime gets its state and its snapshot with the same lifetime, an open one
|
||||
both with none, and one ended past its lifetime neither, its held snapshot purged; through the repair `snapshot`, an
|
||||
ended instance's snapshot is written with its state's lifetime, an open instance's with none, and none is written for
|
||||
an instance whose lifetime has ended, the one held purged; `reindex` writes an instance's index keys with its lifetime
|
||||
and none past it; `lag` counts it not behind; `get` answers `expires`. A case of the ledger's one integration test on
|
||||
the real bus, the day shortened in the test: a key written with a lifetime of two seconds is gone after them and a
|
||||
watch hands it removed, and a racing writer of a key with a lifetime is refused; after an ended instance's lifetime
|
||||
its state key and its snapshot are gone while its operations are still in the history, and an open instance's snapshot
|
||||
stays. Rows of the keeper's plan tests: a ledger with `ended-days` plans its state and index buckets with a lifetime
|
||||
per key at its `max-mib` and its snapshot store with a lifetime per message, and writes `ended-days` in its binding,
|
||||
one without plans neither; a held stream's lifetime per message is read back, so a snapshot store without it drifts;
|
||||
rows of its `recreate` tests: a shorter age and a lifetime per key or per message turned on are changed in place with
|
||||
their data kept, a lifetime per key or per message turned off is made again empty, and the ask names which. Rows of
|
||||
the manifest validator's unit tests: `ended-days` 0 and 3651 refused and 30 taken; an `ends-with` naming no field
|
||||
refused; `ended-days` with no `ends-with`, and the reverse, refused. Rows of the gate's record unit tests in
|
||||
`record_test.go`, in place of the rows of `record-retention`: an end writes the head, then each mover and act with
|
||||
its `ended`; a reopening empties the movers' and acts' first, then the head's; a failed write is said and the start's
|
||||
pass finishes it; an event for a record no longer read changes nothing and is said; a removed key drops the record
|
||||
from every list; `held/2026-11` is forgotten at a start; and the gate's manifest gives `ended-days` of 7 or more,
|
||||
since `gate_times` answers the last seven days (G §810). The gate's whole test's case of G §160, "a record past its
|
||||
retention is removed", becomes "an ended record's movers and acts take its end, and an open record's take none". A
|
||||
row of the bus module's fill pass unit tests: an entry whose state is at 75% and whose history is at 20% says `full`
|
||||
naming the state, and `show` answers each object. Live, after H2's delivery and (10): `mesh-broker.show` of the
|
||||
gate's `records` names its state and index buckets with a lifetime per key at 64 MiB and its history at 90 days;
|
||||
`gate_records_expiring` names each ended record's `expires` 30 days after its end and no open record; from 30 days
|
||||
after (10)'s rebuild, while the rate of (8) holds, the gate's state stays under its cap and the bus module's condition
|
||||
for `records` stays cleared; `nats_history` of the gate's `records` names the object in its `full`. ADR 0656 §7, §10;
|
||||
ADR 0597 §1, §4, §5, §8, §10; ADR 0595 §2, §3, §5, §6, §8; ADR 0682 §11; principles 1, 3, 4, 7 and 11.
|
||||
`record_test.go`, in place of the rows of `record-retention`: an end writes the head, then each mover and act with its
|
||||
`ended`; a reopening empties the movers' and acts' first, then the head's; a failed write is said and the start's pass
|
||||
finishes it; an event for a record no longer read changes nothing and is said; a removed key drops the record from
|
||||
every list; `held/2026-11` is forgotten at a start; and the gate's manifest gives `ended-days` of 7 or more, since
|
||||
`gate_times` answers the last seven days (G §810). The gate's whole test's case of G §160, "a record past its
|
||||
retention is removed", becomes "an ended record's movers and acts take its end, and an open record's take none". A row
|
||||
of the bus module's fill pass unit tests: an entry whose state is at 75% and whose history is at 20% says `full`
|
||||
naming the state, and `show` answers each object. Live, after H2's delivery and (10): `mesh-broker.show` of the gate's
|
||||
`records` names its state and index buckets with a lifetime per key at 1,073,741,824 bytes, its snapshot store with a
|
||||
lifetime per message and its history at 90 days; `gate_records_expiring` names each ended record's `expires` 30 days
|
||||
after its end and no open record; from 30 days after (10)'s rebuild, while the rate of (8) holds, the gate's state
|
||||
stays under the raise mark of its cap and the bus module's condition for `records` stays cleared, and the bus module's
|
||||
`nats_streams` counts no more snapshots in the gate's snapshot store than keys in its state bucket; `nats_history` of
|
||||
the gate's `records` names the object in its `full`. ADR 0656 §7, §10; ADR 0690 §1, §2; ADR 0597 §1, §4, §5, §8, §10;
|
||||
ADR 0595 §2, §3, §5, §6, §8; ADR 0682 §11; principles 1, 3, 4, 7 and 11.
|
||||
|
||||
## Answers of 2026-11-24 from 01:08 CET
|
||||
|
||||
@@ -203,19 +241,24 @@ principle that settles it.
|
||||
that waits says where; principle 11: the bound is a setting; principle 7: a journal line in the passer, no new key or
|
||||
event, since no other part acts on it). How it is checked: a unit row where a phase blocks past a short bound and the
|
||||
journal line names that phase, and none is said for a pass that ends within it. Principles 3, 7 and 11.
|
||||
- **H-A-636 (a ledger's state and index buckets take the ledger's cap, 01:31)** 24 Nov; answers the condition "Kept data is
|
||||
filling up" of the delivery gate's records (open since 2026-11-23 10:20 CET): the gate's ledger asks `max-mib` 1024,
|
||||
which sizes its history and its snapshot, while the bus module plans the ledger's state bucket and each index bucket
|
||||
with no option (mesh-catalog modules/nats internal/keeper/plan.go, the ledger case, `stateSettings(options{})`), so
|
||||
each is the state default of 64 MiB whatever the module asks; the gate's state bucket is full since 2026-11-23 11:48
|
||||
UTC, its operations kept in the history and the state behind (ADR 0597 §6). The ledger's state bucket and its index
|
||||
buckets take the ledger's own `max-mib`, as its history and snapshot do, through the existing `stateSettings` cap;
|
||||
no other option of the ledger reaches them (principle 11: no cap fixed in code; principle 7: the entry's one existing
|
||||
option, no new one). A raised cap reaches a held bucket through the keeper's existing path for larger settings, in
|
||||
place, and the state catches up by replay (ADR 0597 §5). In the bus module (mesh-catalog). How it is checked: a row of
|
||||
the keeper's plan tests (a ledger with `max-mib` 1024 plans its state and index buckets at 1 GiB, one with none at the
|
||||
default); live, `mesh-broker.show` of the gate's records names its state bucket at 1 GiB and the condition clears.
|
||||
Principles 7 and 11.
|
||||
- **H-A-636 (a ledger's state and index buckets take the ledger's cap, 01:31)** 24 Nov; answers the condition "Kept data
|
||||
is filling up" of the delivery gate's records (open since 2026-11-23 10:20 CET): the gate's ledger asks `max-mib`
|
||||
1024, which sizes its history and its snapshot, while the bus module plans the ledger's state bucket and each index
|
||||
bucket with no option (mesh-catalog modules/nats internal/keeper/plan.go, the ledger case,
|
||||
`stateSettings(options{})`), so each is the state default of 64 MiB whatever the module asks; the gate's state bucket
|
||||
is full since 2026-11-23 11:48 UTC, its operations kept in the history and the state behind (ADR 0597 §6). The
|
||||
ledger's state bucket and its index buckets take the ledger's own `max-mib`, as its history and snapshot do, through
|
||||
the existing `stateSettings` cap; no other option of the ledger reaches them (principle 11: no cap fixed in code;
|
||||
principle 7: the entry's one existing option, no new one). A raised cap reaches a held bucket through the keeper's
|
||||
existing path for larger settings, in place, and the state catches up by replay (ADR 0597 §5). In the bus module
|
||||
(mesh-catalog). How it is checked: a row of the keeper's plan tests (a ledger with `max-mib` 1024 plans its state and
|
||||
index buckets at 1 GiB, one with none at the default); live, `mesh-broker.show` of the gate's records names its state
|
||||
bucket at 1 GiB and the condition clears. **It stands by ADR 0690 §1** (accepted 2026-11-25 on the operator's
|
||||
Approve), which decides the cap it gave and changes ADR 0595 §3; H-A-638's withdrawal of it is dropped. Its checks
|
||||
gain two of that record's rows: a ledger with `max-mib` 1024 and its history's keeping days of 90 plans its state and
|
||||
index buckets at 1 GiB too, so no other option sets their cap; and a row of the bus module's fill pass unit tests,
|
||||
where a ledger whose state bucket holds 100 MiB under its cap of 1 GiB says no `full`, and at 75% of 1 GiB says `full`
|
||||
naming its state (H-A-634 (9)). ADR 0690 §1; principles 7 and 11.
|
||||
- **H-A-637 (the pipeline runner's test-run test waits on what it causes, never on a clock across a restart, 01:59)** 24 Nov,
|
||||
issue 1984; answers the failure of main.512 (mesh-delivery-pipeline's integration step on a loaded build node, "1 failed:
|
||||
TestTestRunsAreAskedOncePerLevelAndMoveEveryReader", which the same commit passed in main.511): the test writes the
|
||||
@@ -230,18 +273,11 @@ principle that settles it.
|
||||
core under three busy loops, and fails at once when the runner's real behaviour it checks is taken out. Principles 3
|
||||
and 7.
|
||||
|
||||
## H-A-636 against design 25 (2026-11-24 from 21:30 CET)
|
||||
## H-A-636 against design 25, settled by ADR 0690 (2026-11-24 from 21:30 CET; 2026-11-25)
|
||||
|
||||
- **H-A-638 (H-A-636 withdrawn: a ledger's state and index buckets keep the state's cap of 64 MiB, 21:55)** 24 Nov,
|
||||
withdraws H-A-636. ADR 0595 §3 decides "A ledger's state and index buckets take a cap like any state bucket (at most
|
||||
64 MiB)", and design 25 § 12.1's table fixes "the bucket at most 64 MiB" for a state, which a ledger's state and
|
||||
index buckets take "as state"; a lead answer cannot raise that cap (playbook 02, *Answering a design question*, item
|
||||
2: against a record, the answer is a decision). The bus module plans a ledger's state bucket and each index bucket at
|
||||
the state's cap again, with no option of the ledger reaching them but H-A-634 (3)'s lifetime per key; the change that
|
||||
built H-A-636 (mesh-catalog `modules/nats`, the ledger case of the keeper's plan, 0f648e26 on main) is reverted in H2
|
||||
with H-A-634. The gate's state is bounded by H-A-634's lifetimes instead, within 64 MiB only while 30 days of its
|
||||
records fit (H-A-634 (8)). A held state or index bucket made at the larger cap asks a smaller cap, a drift only the
|
||||
`recreate` of H-A-634 (3) applies, on the operator's warrant, never `apply` (ADR 0595 §5). How it is checked: the
|
||||
row H-A-636 added to the keeper's plan tests is turned (a ledger with `max-mib` 1024 plans its state and index
|
||||
buckets at 64 MiB); live, after H2's delivery and H-A-634 (10), `mesh-broker.show` of the gate's `records` names its
|
||||
state at 64 MiB. ADR 0595 §3, §5; principle 7.
|
||||
- **H-A-638 (dropped 2026-11-25: H-A-636 stands)** It withdrew H-A-636 on 24 Nov at 21:55, since ADR 0595 §3 then gave a
|
||||
ledger's state and index buckets a state's cap of at most 64 MiB, and planned the revert of the change that built
|
||||
H-A-636 (mesh-catalog `modules/nats`, the ledger case of the keeper's plan, 0f648e26 on main) in H2. ADR 0690 §1,
|
||||
accepted 2026-11-25, decides the cap H-A-636 gave, so the withdrawal and the revert are dropped, as that record's
|
||||
Consequences say: nothing of H-A-638 is built, the row H-A-636 added to the keeper's plan tests stays, and the gate's
|
||||
state and index buckets stay at their `max-mib` of 1 GiB. ADR 0690 §1.
|
||||
|
||||
Reference in New Issue
Block a user