Design 47 H2: H-A-634, the gate deletes an ended delivery record past record-retention after its end; an open record never
The operator answered the lead's question on 2026-11-24 about 01:06 CET: the gate may delete ended delivery records older than a set number of days, default 30, and never an open one. The gate's state bucket is full and the bus module's fill condition names no object, so the line also says what a deletion removes, when it runs, which records it reads, its tools, and that the bus module names the object it judged. H2-lead-answers-3 reached its 60 KB bound, so the answer opens H2-lead-answers-4.
This commit is contained in:
@@ -27,8 +27,9 @@ decisions:
|
||||
# Design 47, milestone H2: lead answers, continued again
|
||||
|
||||
This file continues [H2-lead-answers-2.md](H2-lead-answers-2.md) from H-A-594 on, since that file passed its 60 KB
|
||||
bound: it opens with round 2 of the review by architectural domain of H-A-568 to H-A-587, and every later answer is
|
||||
written here. Each line names the record or the principle that settles it.
|
||||
bound: it opens with round 2 of the review by architectural domain of H-A-568 to H-A-587, and every later answer to
|
||||
H-A-633 is written here; H-A-634 and every later answer are in [H2-lead-answers-4.md](H2-lead-answers-4.md). Each line
|
||||
names the record or the principle that settles it.
|
||||
|
||||
## Round 2 of the review by architectural domain of H-A-568 to H-A-587 (2026-11-23 from 15:56 CET)
|
||||
|
||||
|
||||
@@ -0,0 +1,129 @@
|
||||
---
|
||||
layer: to-be
|
||||
status: in-progress
|
||||
design: 47
|
||||
milestone: H
|
||||
updated: 2026-11-24
|
||||
decisions:
|
||||
- "ADR 0656"
|
||||
- "ADR 0597"
|
||||
- "ADR 0595"
|
||||
- "ADR 0682"
|
||||
---
|
||||
# Design 47, milestone H2: lead answers, continued a third time
|
||||
|
||||
This file continues [H2-lead-answers-3.md](H2-lead-answers-3.md) from H-A-634 on, since that file reached its 60 KB
|
||||
bound with H-A-633: every later answer is written here. Each line names the record, the operator's answer or the
|
||||
principle that settles it.
|
||||
|
||||
## The operator's answers, continued (2026-11-24 from 01:06 CET)
|
||||
|
||||
- **H-A-634 (the gate deletes an ended delivery record `record-retention` days after its end, at a record's open; an
|
||||
open record never; the bus module's fill names its object, 01:24)** 24 Nov, the operator's answer of about 01:06 CET
|
||||
in chat ("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". It amends G §154 (90 days, counted from the opening, an
|
||||
open record deleted too), G §155 (the estimate of the ledger's growth), G §159 and §160 (the tools and the check of
|
||||
the retention), §812's and §820's "never" for the ledger `records`, and §809's "the ledger is never pruned", which
|
||||
stands for §812's prune toward a cap and not for this deletion. A delivery record's fields, retention and tools are
|
||||
the design's under ADR 0656 §7 (G §145), so the answer is a design line (playbook 02, *Answering a design question*,
|
||||
item 1). 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) **What is deleted, and from when.** The gate deletes a delivery record once it has ended and its end is older
|
||||
than its setting `record-retention`: the head holds `ended` (G §147; the operation `end` of §810), and `ended`'s `at`
|
||||
plus `record-retention` lies before the judgement's time. A record whose head holds no `ended` is open, and an open
|
||||
record is never deleted, whatever its age (the operator's answer). A record H-A-609 (2) reopens reads open from its
|
||||
reopening: the reopening applies the record's `end` with `ended` empty, so the head holds none until the gate's next
|
||||
end writes it, and its age counts from that end; an end written again by a late `running` (H-A-597) moves the time
|
||||
it counts from in the same way. Principle 3: a record a running pipeline still writes is never taken from it.
|
||||
(2) **The setting.** `record-retention` keeps its name and form, a whole number of days in the gate's manifest
|
||||
`config`, from 7 to 3650, default 30 (the operator's answer), read at each judgement, so a change through the seat
|
||||
`mesh-config` holds from the next. The lower bound is 7 because `gate_times` (§810) answers the last seven days'
|
||||
median and worst from the ended records' times, and a shorter retention would have it answer from fewer days than it
|
||||
says (principles 3 and 11). Fate: G §154's 90 days and the gate's reader's range of 1 to 3650 end; the manifest's
|
||||
description of the setting says "days a delivery record is kept after its end; an open record is kept whatever its
|
||||
age".
|
||||
(3) **What a deletion removes, and through what.** For each record it deletes, the gate removes through the tool
|
||||
runner's `mesh/ledger.remove` (G §587: an instance's operations and its snapshot from the history by its subjects,
|
||||
its key in the state bucket and its keys in every declared index), in this order: every mover instance
|
||||
(`mover/<branch.source.module>`) the ledger's index `movers` names for the record and every act instance the index
|
||||
`acts` names (ADR 0597 §4; the joins `gate_record` reads), then the head instance (`record/<milestone>`), then the
|
||||
record's entry in the list of its opening month (`held/<yyyy-mm>`) by that list's operation `drop`. The head goes
|
||||
after its movers and acts, so a deletion cut part-way leaves the head, which the next judgement finds and finishes; a
|
||||
removal of an instance already gone answers 0 and 0 (G §587) and is no failure. A record whose head counts more
|
||||
movers (`movers`, §809) than the index `movers` names is not deleted: one journal line names the record, its count
|
||||
and the index's answer, and a later judgement takes it once the ledger's repair `reindex` (ADR 0597 §10) has filled
|
||||
the index, so no mover instance is left that no head names (principle 3). The deletion removes instances within the
|
||||
gate's own ledger, as G §587 has it, never an entry of kept data whole, which only the bus module's `drop` and
|
||||
`recreate` remove (ADR 0595 §4). Fate: the tool runner answers neither `mesh/ledger.remove` nor `mesh/ledger.fill`
|
||||
to a bundle today (its list of the bus state calls a bundle may make names neither, and `gate_records` says so), so
|
||||
G §587's "served by the tool runner for the calling module's own ledgers alone" is built for a bundle too, in the
|
||||
tool runner (mesh-tools); both stay refused for another module's ledger (ADR 0597 §9; principle 12).
|
||||
(4) **When the gate deletes.** At each record's open, before the open's first write, as the gate does today (records
|
||||
open as deliveries do), and by hand through (6); never on a timer, never at its start and never on another part's
|
||||
event, since only the gate's own records grow by it (ADR 0682 §11: a part wakes on its inputs alone; principle 7).
|
||||
Each judgement deletes every ended record past the retention, the oldest end first. A removal the tool runner refuses
|
||||
or does not answer stops that judgement and is said in the journal (the record, the instance, the error); the record
|
||||
stays for the next judgement and the open goes on, since a record's room is judged by G §181's refusal of a full
|
||||
ledger and not by the retention. Fate: today a failed removal refuses the open ("the records past their retention
|
||||
cannot be removed, so no record is opened"); that refusal ends (principle 3: said, and no delivery's record held for
|
||||
upkeep).
|
||||
(5) **Which records the gate reads.** The judgement and every reader of the records (`gate_records`, the counts of
|
||||
`delivery_status`, the records the gate takes up at its start) read the list of month lists, `held/months`, an
|
||||
instance of the ledger's existing type `held` with one entry per month list (`instance` the list's instance,
|
||||
`opened` the month's first instant), then each month list it names, oldest first; never only the months within the
|
||||
retention and a month more, as today, since an open record of any age and a record ended within the retention but
|
||||
opened before it are kept and must be read (principle 4). The gate writes a month's entry by `hold` when it opens the
|
||||
first record of a month `held/months` does not name (it keeps the months named in its memory, read at its start);
|
||||
at its start, when `held/months` names no month, it writes one entry for each month list it finds reading back from
|
||||
the current month to the first month with none (today `held/2026-11` alone). When the retention leaves a past
|
||||
month's list with no entry, the gate removes that list's instance through `mesh/ledger.remove` and drops its entry
|
||||
from `held/months` by `drop`. One entry a month keeps `held/months` far under a value's 256 KiB, and the ledger gains
|
||||
no type and no operation (principle 7).
|
||||
(6) **Its tools** (principle 4; G §159's four lines). `gate_records_retention` reads what the retention would delete
|
||||
now, deleting nothing: given no argument or `days` (1 to 3650, judged in place of the setting), it answers the
|
||||
setting's value, every ended record past it, the oldest end first (its key, opened, ended, its movers as counted and
|
||||
as the index names them, its acts), the records it would leave and why (3), and how many open records are kept
|
||||
whatever their age, within §811's 768 KB with `capped`, `total` and the cursor. `gate_records_delete` (`why`,
|
||||
required; `days`, 1 to 3650, default the setting; or `record`, one record's key) deletes as the judgement does, ended
|
||||
records alone: a named record that is open is refused, naming it, and nothing is deleted; it answers each record
|
||||
deleted with the operations and bytes its removals answered, and is recorded in the hand-act log of the seat
|
||||
`mesh-hand-acts`, as `gate_record_end` is (G §159). `gate_records` answers beside the records the setting's value
|
||||
and the oldest kept end.
|
||||
(7) **What is said.** One journal line per record deleted (its key, its end, and the operations and bytes its
|
||||
removals answered), one per record left for its index (3) and one per failed removal (4). No event is added: no part
|
||||
acts on a deletion. The watchman's `record-open` ends at `record-ended` (G §148), and a deleted record has ended; the
|
||||
revisions a record names are kept by the indexer's pins (H §749, H-A-566, H-A-572), not by the record, so a deletion
|
||||
frees no revision, and G §154's `freed` at a removal ends: the seat `mesh-delivery`'s definition declares neither
|
||||
`pinned` nor `freed` (principle 7).
|
||||
(8) **Its size.** G §155's estimate (20 deliveries a day, about 200 KiB a record, a ledger of 768 MiB) is replaced
|
||||
by the figures of the case above: the store that binds is the ledger's state bucket, at 64 MiB the most ADR 0595 §3
|
||||
allows a ledger's state, full on 2026-11-23 while its history held a fifth of its cap; the retention holds the state
|
||||
under its cap only while the records of `record-retention` days fit in it.
|
||||
(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
|
||||
ledger; the entry itself where it has one object), `bytes` and `cap`; their `why` and the condition's text name it
|
||||
(for the case above: the state `KV_mesh-delivery-gate_records_state` of `records` of mesh-delivery-gate holds 75%
|
||||
of its cap). The seat `mesh-broker`'s `show` answers in `fill`, beside the sum, `objects`: each object's bus name,
|
||||
part, bytes, cap and share; `nats_history` shows the new fields as it shows the rest. Built in the bus module
|
||||
(mesh-catalog `modules/nats`) and the seat `mesh-broker`'s definition (mesh-contracts). Principles 3 and 4.
|
||||
How it is checked: rows of the gate's record unit tests in `record_test.go`, beside the rows of `record-retention`
|
||||
there today, never a new top-level test function: an ended record 31 days past its end is deleted with its movers,
|
||||
its acts, its head and its month entry in that order; one 29 days past its end is kept; an open record opened 400
|
||||
days ago is kept; a reopened record is kept until its next end; a record whose head counts more movers than its index
|
||||
names is kept and said; a failed removal is said and the open is written; `record-retention` 6 and 3651 are refused,
|
||||
7 and 30 taken, none read as 30; `held/months` is seeded at a start and loses an emptied past month. The gate's whole
|
||||
test's case of G §160, "a record past its retention is removed", becomes "an ended record past its retention is
|
||||
removed with its movers and acts, and an open record older than it stays". A row of the tool runner's unit tests: a
|
||||
bundle's `mesh/ledger.remove` and `mesh/ledger.fill` on its own ledger are answered, on another module's refused. 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: `gate_records` answers the ledger's fill
|
||||
and the setting 30; `gate_records_retention` names no record past it while every end is under 30 days old; and
|
||||
`nats_history` of the gate's `records` names the object in its `full`. ADR 0656 §2, §7; ADR 0597 §4, §9, §10; ADR
|
||||
0595 §3, §4, §6; ADR 0682 §11; principles 3, 4, 7, 11 and 12.
|
||||
Reference in New Issue
Block a user