From 96b5a0412c3a363269d8eed19b0787a77a44ec92 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 22:20:06 +0000 Subject: [PATCH 1/3] =?UTF-8?q?docs(adr):=20ADR-0154=20amendments=20?= =?UTF-8?q?=E2=80=94=20bounded=20checkpoints=20(D4)=20and=20the=20DB=20ses?= =?UTF-8?q?sion=20seal=20lock=20(D3)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Records two seat rulings on the build card as a dated amendment to ADR-0154. D4: a chain's window seals into consecutive checkpoints of at most N = 10,000 leaves (a fixed constant), late checkpoints capped the same way, a part index and final flag in the signed body, S1 relaxed for parts of one window, and a row id listed by two checkpoints is a verify fault; the cost line is restated per checkpoint. D3: a second, database session lock beside audit.sealer, following acquireSchemaMigrationLock; each sealer pass try-locks it and skips, os migrate audit-* --apply holds it for the run, and where no such lock exists --apply on a sealed object needs the explicit sealer-stopped flag. Ruling records 6884540128 and 6885005594. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM --- ...er-signed-checkpoints-amendments-verify.md | 45 +++++++++++++++++-- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md b/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md index 6c3d3d31f04..7c1755ece59 100644 --- a/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md +++ b/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md @@ -1,6 +1,6 @@ # ADR-0154: The audit ledger is tamper-evident — an asynchronous sealer signs per-organization checkpoints, redaction and expiry write signed amendments, and `os audit verify` checks it -**Status**: Proposed (2026-11-10) — draft. **This record declares; it implements nothing.** The build is [#31908](https://github.com/objectstack-ai/objectstack/issues/31908), serial after this record. `docs/adr/**` is a Tier H governed surface (Prime Directive #14): the maintainer's merge adopts this record, and until then every decision below is a proposal. +**Status**: Proposed (2026-11-10) — draft. **This record declares; it implements nothing.** The build is [#31908](https://github.com/objectstack-ai/objectstack/issues/31908), serial after this record. `docs/adr/**` is a Tier H governed surface (Prime Directive #14): the maintainer's merge adopts this record, and until then every decision below is a proposal. · **Amended** (2026-11-14, [#31908](https://github.com/objectstack-ai/objectstack/issues/31908) — seat rulings 6884540128 and 6885005594: D4's one root per chain per window becomes consecutive checkpoints of at most 10,000 leaves, and D3's sealer and the `os migrate audit-*` apply runs exclude each other through a database session lock beside `audit.sealer`; see "Amendment (2026-11-14, #31908)" at the end) - **Date**: 2026-11-10 - **Card**: [#31907](https://github.com/objectstack-ai/objectstack/issues/31907) (p2, `domain:server`), stage 1 of [objectstack-ai/cloud#4016](https://github.com/objectstack-ai/cloud/issues/4016). The card restates the ruling as seven points; where the two differ in words, the ruling binds. - **Decided by**: the maintainer, 2026-11-09 11:30Z, on cloud#4016, option **(c)** of the decision card, whose label the card quotes verbatim: 「(c) 封存链+检查点出主机」 — build tamper evidence in two stages, exactly as cloud `docs/design/audit-tamper-evidence.md` §5 says (merged as cloud PR #4025). Stage 1, this record, is in the framework; stage 2, taking checkpoints off the host, is Enterprise's. @@ -71,9 +71,9 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d - **Nothing changes on the insert path.** Every writer goes on inserting exactly as `packages/plugins/plugin-audit/src/audit-writers.ts#installAuditWriters` and its siblings do today; the ledger table is never written by the sealer. - **Where it runs.** In `@objectstack/plugin-audit`, the plugin that owns the ledger, started at `kernel:ready` on an interval. It is not part of the LifecycleService: sealing and retention have different cadences, and the sweeper reaches the sealer only through the expiry seam of [D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment). -- **One sealer at a time.** Each pass holds the cluster lock `audit.sealer` (with a TTL, renewed while it works). A checkpoint extends its chain only if the chain's head is still the one the sealer read: the build makes `(chain, sequence)` unique, so a sealer whose lease lapsed mid-pass cannot write a second checkpoint at a sequence another already took, and the lock's fencing token is recorded on the checkpoint it wrote. +- **One sealer at a time.** Each pass holds the cluster lock `audit.sealer` (with a TTL, renewed while it works). A checkpoint extends its chain only if the chain's head is still the one the sealer read: the build makes `(chain, sequence)` unique, so a sealer whose lease lapsed mid-pass cannot write a second checkpoint at a sequence another already took, and the lock's fencing token is recorded on the checkpoint it wrote. *(Amended 2026-11-14: each pass also try-locks a database session lock and skips the pass while it is held, and `os migrate audit-* --apply` holds that lock for its whole run; see [the amendment](#amendment-2026-11-14-31908-bounded-checkpoints-d4-and-the-database-session-seal-lock-d3).)* - **Windows and settle lag.** A window is sealed once `now ≥ window end + settle lag`. This record fixes the defaults: a **1-hour** window and a **10-minute** settle lag. The lag absorbs clock skew between replicas and writers still in flight; whether an operator may change either number is the build card's to propose, never a tenant's. -- **Late rows are sealed as late, never ignored.** A checkpoint records the ids of the rows it sealed. On every pass the sealer re-counts the sealed windows of the last **7 days** (the late horizon) and seals any row of a sealed window that no checkpoint lists into a checkpoint of kind `late`, chained like any other, covering the same window. Within one pass, `late` checkpoints are written before the pass's `window` checkpoints ([D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment) relies on that order). A row back-dated beyond the horizon is not sealed by the sealer; `os audit verify` reports it ([D9](#d9--os-audit-verify)). +- **Late rows are sealed as late, never ignored.** A checkpoint records the ids of the rows it sealed. On every pass the sealer re-counts the sealed windows of the last **7 days** (the late horizon) and seals any row of a sealed window that no checkpoint lists into a checkpoint of kind `late`, chained like any other, covering the same window. Within one pass, `late` checkpoints are written before the pass's `window` checkpoints ([D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment) relies on that order). A row back-dated beyond the horizon is not sealed by the sealer; `os audit verify` reports it ([D9](#d9--os-audit-verify)). *(Amended 2026-11-14: `late` checkpoints are capped at 10,000 leaves the same way as `window` checkpoints; see [the amendment](#amendment-2026-11-14-31908-bounded-checkpoints-d4-and-the-database-session-seal-lock-d3).)* - **Backlog.** When sealing first runs on an object, the sealer seals the existing rows window by window from the oldest. Such a checkpoint proves the rows have not changed **since it was sealed**, which is what its `sealed at` says, and no earlier. - **An empty window writes no checkpoint.** The chain links of [D4](#d4--checkpoints-one-merkle-root-per-chain-per-window-chained-and-signed) already make a deleted checkpoint visible, so an empty window needs no row to prove it was empty. - **The sealed-through watermark.** Every checkpoint's signed body also carries the end of the last window the sealing pass that wrote it had completed for **every** chain of the sealed object. A window is *sealed* when it ends at or before the highest watermark among the object's checkpoints. That is what tells an empty sealed window (no rows may appear in it) from a window not yet sealed (rows may still arrive): a row found later in an empty sealed window is a row no checkpoint holds ([D9](#d9--os-audit-verify)). The watermark rides on checkpoints already signed, so it adds no object; lowering it means deleting the newest checkpoints, which is the head truncation stage 1 cannot see on its own. @@ -81,6 +81,8 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d ### D4 — Checkpoints: one Merkle root per chain per window, chained and signed +*(Amended 2026-11-14: "one root per chain per window" is replaced — a chain's window seals into consecutive checkpoints of at most 10,000 leaves each, and the signed body gains a part index and a final flag; see [the amendment](#amendment-2026-11-14-31908-bounded-checkpoints-d4-and-the-database-session-seal-lock-d3). The text below is the record as first decided.)* + - **Checkpoints are rows of their own object, `sys_audit_checkpoint`**, platform-written (`managedBy: 'append-only'`), private by default (`access: { default: 'private' }`, as `sys_jwks`), read through `get` / `list` by platform administrators and by `os audit verify`. The object is not itself a sealed object: its integrity is its chain and its signatures. - **The three new objects stay out of the audit writer.** `sys_audit_checkpoint`, `sys_audit_amendment` and `sys_audit_signing_key` join the audit writer's `SKIP_OBJECTS` (`packages/plugins/plugin-audit/src/audit-writers.ts#AUDIT_EXCLUDED_OBJECTS`), to stop a recursion: otherwise every checkpoint, amendment or key written would write a ledger row of its own, which the next pass seals into a new checkpoint, which writes a row again; and the expiry of [D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment) would write ledger rows about its own deletes. - **A checkpoint carries**: the sealed object and the chain (organization id, or NULL for the deployment chain), its sequence in the chain, its kind (`window` or `late`), the window's start and end, the sealed-through watermark ([D3](#d3--the-sealer-asynchronous-after-a-settle-lag-one-at-a-time-under-the-cluster-lock)), the leaf count and the sealed row ids, the root, the digest of the chain's previous checkpoint (NULL for the first), the column set and the `canon` version, the seed's handle id, the sealer's fencing token, when it was sealed, the id of the signing key, and the signature. Column names are the build card's. @@ -126,6 +128,7 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d - **Live check (the default).** Boots the stack the way the `os migrate audit-*` commands do (system context, hot store and archive datasource), establishes the trusted signing keys as [D6](#d6--one-deployment-ed25519-signing-key-bound-to-its-wrapped-private-half) says (each derived from its wrapped private half, never read off a row), reads every chain of every sealed object, recomputes each leaf with its seed, checks every root, link and signature against the trusted keys only, applies the amendments ([D7](#d7--redaction-writes-a-signed-amendment-before-the-rewrite), [D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment)), and reports every row as one of **`unmodified`**, **`modified`**, **`missing`**, **`late`**, **`redacted`** or **`expired`**, with counts per chain and the id of every row that is not `unmodified`. It prints the fingerprints of the keys it trusted, so an operator can publish them out of band. - **Rows no checkpoint holds.** A row in a sealed window that no checkpoint lists — a back-dated insert past the late horizon — is reported `late` and flagged unsealed; it fails the run, because on the host alone it cannot be told from a forged insert. +- *(Amended 2026-11-14.)* **A row id that two checkpoints list is a fault**; see [the amendment](#amendment-2026-11-14-31908-bounded-checkpoints-d4-and-the-database-session-seal-lock-d3). - **`--out FILE`** writes the **proof bundle** of the live check it just ran: the public keys, the checkpoints and amendments, and for each row its leaf input with the value columns as commitments only. A bundle holds no value, no salt and no seed, so it can be handed to an auditor without handing over a record body or a guess-verifier for one. - **`--bundle FILE`** checks an existing bundle **offline**, without booting anything. It never trusts the keys the bundle carries: the operator names the trusted keys out of band with **`--trusted-key FINGERPRINT`** (repeatable), taken from a live check's output or, in stage 2, from the off-host copy. `--bundle` without at least one `--trusted-key` is refused as a usage error. With them, it proves that the bundle's leaves hash to its roots, its links hold, every signature verifies under a trusted key, and every `expiry` is honoured by [D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment)'s rule against the policy value its signed amendment carries. It cannot re-read the rows; that is what the live run that wrote the bundle did. `--bundle` is mutually exclusive with `--out` and with booting, and `--trusted-key` is meaningful only with `--bundle`; any other combination is refused as a usage error. - **A bundle carries personal data.** Its clear columns (`user_id`, `actor`, `ip_address`, `user_agent`, `tenant_id`) identify people. It is an export of the ledger and is handled as one: kept and passed on under the same access and retention rules as the ledger it came from, and narrowed with `--org` / `--from` / `--to` to what the auditor needs. @@ -185,7 +188,7 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d ## Consequences - **Positive.** The ledger's "cannot be modified or deleted" becomes "cannot be modified or deleted without it showing", which is the claim a security review can check; the three sanctioned rewrites and the 7-year expiry stop being indistinguishable from tampering. -- **Cost.** One checkpoint row and one `sys_secret` row per active chain per window (at most 24 per organization per day), a signing key, and a background pass per hour. Expiry keeps a row at most one window plus the late horizon past its policy ([D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment)). The insert path pays nothing. +- **Cost.** One checkpoint row and one `sys_secret` row per active chain per window (at most 24 per organization per day), a signing key, and a background pass per hour. *(Amended 2026-11-14: one checkpoint row and one `sys_secret` row per part of a window, each part bounded at 10,000 leaves; the 24-per-day figure holds only while no window of the chain exceeds that bound — see [the amendment's cost line](#amendment-2026-11-14-31908-bounded-checkpoints-d4-and-the-database-session-seal-lock-d3).)* Expiry keeps a row at most one window plus the late horizon past its policy ([D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment)). The insert path pays nothing. - **Operational.** A deployment with no crypto provider cannot seal, and says so at `error` ([D3](#d3--the-sealer-asynchronous-after-a-settle-lag-one-at-a-time-under-the-cluster-lock)); a redaction migration refuses to rewrite a sealed row it cannot amend ([D7](#d7--redaction-writes-a-signed-amendment-before-the-rewrite)). - **What builds on this.** [#31908](https://github.com/objectstack-ai/objectstack/issues/31908) builds D1–D11 in this repository; cloud#4016's stage 2 (cloud#4128) implements the two seams off the host. @@ -194,3 +197,37 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d - Card [#31907](https://github.com/objectstack-ai/objectstack/issues/31907); build [#31908](https://github.com/objectstack-ai/objectstack/issues/31908); cloud#4016 (ruling (c), 2026-11-09), cloud PR #4025 (`docs/design/audit-tamper-evidence.md`), cloud#4128 (stage 2). - [#21207](https://github.com/objectstack-ai/objectstack/issues/21207) — rulings 5942670275 and 5950183039 ("copies never carry the hash"). - RFC 8785 (JSON Canonicalization Scheme); RFC 6962 §2.1 (Merkle tree hashing and its leaf/node prefixes); RFC 8032 (Ed25519). + +--- + +## Amendment (2026-11-14, #31908): bounded checkpoints (D4) and the database session seal lock (D3) + +**Status of this amendment**: two seat rulings by the owning seat (`domain:server#5`) on the build card [#31908](https://github.com/objectstack-ai/objectstack/issues/31908), both taken 2026-11-14 and recorded as ruling records [`6884540128`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6884540128) (item 1, S7, 21:33Z) and [`6885005594`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6885005594) (the item-5 ruling, E + B, 22:12Z). Each ruling names this amendment as the governed change it ships with. `docs/adr/**` is a Tier H governed surface (Prime Directive #14): this amendment is accepted by the merge that lands it. **Change**: D4's "one root per chain per window" and its cost line; D3's "one sealer at a time", which named only the cluster lock. Every other decision stands as written; the sentences replaced above keep their text and carry a dated pointer here. Recorded under Prime Directive #13: a recorded decision changes by an amended record, not by a build that quietly does otherwise. + +### D4, amended — a chain's window seals into consecutive checkpoints of at most N = 10,000 leaves + +Ruling record 6884540128, item 1 (S7). + +- **The bound.** A chain's window seals into **consecutive checkpoints of at most N = 10,000 leaves** each. N is a **fixed constant, not a knob**. +- **Ids are sorted.** This amendment does not change D1's leaf order within one checkpoint's tree. +- **`late` checkpoints are capped the same way**: no `late` checkpoint holds more than N leaves ([D3](#d3--the-sealer-asynchronous-after-a-settle-lag-one-at-a-time-under-the-cluster-lock)'s late rows). +- **Part index and final flag.** The signed body of a checkpoint ([D4](#d4--checkpoints-one-merkle-root-per-chain-per-window-chained-and-signed)'s list of what a checkpoint carries) also carries a **part index** and a **final flag**, both under the signature. A crash mid-window therefore resumes as `window`: the rows of that window not yet sealed are sealed into further `window` parts, and are never mislabelled `late`. +- **The sealer's "not sealed twice" invariant (S1 in the build) relaxes** to allow the parts of the same window. +- **The verifier faults any row id that two checkpoints list** ([D9](#d9--os-audit-verify)). +- **What it replaces.** D4's heading and premise, "one Merkle root per chain per window", become one Merkle root per checkpoint, of which a chain's window has one or more. Chaining, signing, the column set, the seed per checkpoint ([D2](#d2--salts-come-from-one-sealed-seed-per-checkpoint)) and every other field D4 lists are unchanged. +- **Cost, restated** (replaces the cost line under [Consequences](#consequences)). One checkpoint row and one `sys_secret` row **per checkpoint**, which is now per part: one per active chain per window — at most 24 per organization per day — for as long as no window of the chain holds more than N rows, and one more for each further block of up to N rows in a window that does; `late` sealings split the same way. The work of **one** checkpoint — the leaves it hashes, the row ids it lists, the body it signs and stores — is **bounded by N**, whatever a window holds. What grows with a window's volume is the number of checkpoints, not the size of any one. A signing key and a background pass per hour as before; the insert path still pays nothing. + +### D3, amended — a database session lock beside the cluster lock + +Ruling record 6885005594 (E + B). + +- **E: a second named lock, a database session lock** — the ruling's example name is `objectstack:audit-seal` — following the existing `packages/objectql/src/schema-migration-lock.ts#acquireSchemaMigrationLock` pattern: a Postgres advisory lock or a MySQL `GET_LOCK`, on a **dedicated connection outside the pool**. +- **Where it is taken.** On the datasource that holds the audit rows: if the audit hot store differs from the primary, the lock goes on the hot store. +- **The sealer.** Each sealer pass try-locks it **in addition to** the cluster lock `audit.sealer`, and **skips the pass** if it is held. +- **The migrations.** `os migrate audit-* --apply` holds it **for the whole run**: it waits up to a timeout **longer than a normal sealer pass**, then refuses. +- **Why a database lock.** The sealer and a migration share the database on every topology, so no cluster driver is needed for the two to exclude each other. +- **B, the residual.** Where the lock is unavailable — the pattern answers `null` on SQLite, Turso and every other dialect — `--apply` on any object declaring `lifecycle.seal` ([D10](#d10--opt-in-lifecyclesealvaluefields-on-an-audit-class-object)) is **refused unless the operator passes the explicit sealer-stopped flag**. +- **Red line.** ⛔ Never take a lock that excludes nothing and then proceed silently. +- **Unchanged.** The cluster lock `audit.sealer`, the unique `(chain, sequence)` index, and D7's order — the amendment is written before the row is rewritten ([D7](#d7--redaction-writes-a-signed-amendment-before-the-rewrite)) — all stay. The migrations' dry-run default is unchanged. +- **The build pins in tests** that the lock is taken on the datasource holding the audit rows (the hot store, where it differs from the primary), and that the command's wait timeout outlasts a normal sealer pass. +- **Not taken.** Composing `os serve`'s cluster driver into the one-shot boot of the migrate commands (the area's option A); a lock that excludes nothing (option D, ruled out by the red line); option C, because it would reopen D7. From 7ec8511b73512773c6498db2e32f9bfa3338bfd1 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 14 Nov 2026 22:51:53 +0000 Subject: [PATCH 2/3] =?UTF-8?q?docs(adr):=20ADR-0154=20D3=20watermark=20?= =?UTF-8?q?=E2=80=94=20a=20window=20before=20the=20latest=20trusted=20wind?= =?UTF-8?q?ow=20checkpoint=20reads=20as=20sealed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Seat ruling 6885452378 on the S4 verify gap: a window is also sealed when it starts at or before the highest window_start among the object's trusted window checkpoints, so a chain a fault left behind reads unsealed in D9. Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM --- ...mper-evidence-sealer-signed-checkpoints-amendments-verify.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md b/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md index 7c1755ece59..aff90658f7f 100644 --- a/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md +++ b/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md @@ -76,7 +76,7 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d - **Late rows are sealed as late, never ignored.** A checkpoint records the ids of the rows it sealed. On every pass the sealer re-counts the sealed windows of the last **7 days** (the late horizon) and seals any row of a sealed window that no checkpoint lists into a checkpoint of kind `late`, chained like any other, covering the same window. Within one pass, `late` checkpoints are written before the pass's `window` checkpoints ([D8](#d8--expiry-removes-a-sealed-prefix-of-the-chain-and-writes-a-signed-amendment) relies on that order). A row back-dated beyond the horizon is not sealed by the sealer; `os audit verify` reports it ([D9](#d9--os-audit-verify)). *(Amended 2026-11-14: `late` checkpoints are capped at 10,000 leaves the same way as `window` checkpoints; see [the amendment](#amendment-2026-11-14-31908-bounded-checkpoints-d4-and-the-database-session-seal-lock-d3).)* - **Backlog.** When sealing first runs on an object, the sealer seals the existing rows window by window from the oldest. Such a checkpoint proves the rows have not changed **since it was sealed**, which is what its `sealed at` says, and no earlier. - **An empty window writes no checkpoint.** The chain links of [D4](#d4--checkpoints-one-merkle-root-per-chain-per-window-chained-and-signed) already make a deleted checkpoint visible, so an empty window needs no row to prove it was empty. -- **The sealed-through watermark.** Every checkpoint's signed body also carries the end of the last window the sealing pass that wrote it had completed for **every** chain of the sealed object. A window is *sealed* when it ends at or before the highest watermark among the object's checkpoints. That is what tells an empty sealed window (no rows may appear in it) from a window not yet sealed (rows may still arrive): a row found later in an empty sealed window is a row no checkpoint holds ([D9](#d9--os-audit-verify)). The watermark rides on checkpoints already signed, so it adds no object; lowering it means deleting the newest checkpoints, which is the head truncation stage 1 cannot see on its own. +- **The sealed-through watermark.** Every checkpoint's signed body also carries the end of the last window the sealing pass that wrote it had completed for **every** chain of the sealed object. A window is *sealed* when it ends at or before the highest watermark among the object's checkpoints. That is what tells an empty sealed window (no rows may appear in it) from a window not yet sealed (rows may still arrive): a row found later in an empty sealed window is a row no checkpoint holds ([D9](#d9--os-audit-verify)). The watermark rides on checkpoints already signed, so it adds no object; lowering it means deleting the newest checkpoints, which is the head truncation stage 1 cannot see on its own. *(Amended 2026-11-14, seat ruling [`6885452378`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6885452378): a window is also sealed when it starts at or before the highest `window_start` among the object's trusted `window` checkpoints. So the rows of a chain that a fault left behind read `unsealed` in [D9](#d9--os-audit-verify) instead of going unjudged. The rule holds because the sealer pass is window-major, which means a chain trails the object only through a fault, and because `late` checkpoints never sweep a lagging chain's rows.)* - **When it cannot seal it says so, once, at `error`.** A deployment with a sealed object but no crypto provider or no signer has declared tamper evidence it does not deliver while everything looks healthy — the durability class of AGENTS.md's degradation rule. The first line names the consequence (rows of the sealed object are not being sealed) and the fix (wire a crypto provider, or remove `lifecycle.seal`). ### D4 — Checkpoints: one Merkle root per chain per window, chained and signed From 20fdf0c3707ba8b27703804848ccfe0ee7c7850d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 15 Nov 2026 03:56:54 +0000 Subject: [PATCH 3/3] docs(adr): ADR-0154 amendment records the late part index restart and cites ruling 6885452378 Co-Authored-By: Claude Claude-Session: https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq --- ...per-evidence-sealer-signed-checkpoints-amendments-verify.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md b/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md index aff90658f7f..4b1ffc1c3ab 100644 --- a/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md +++ b/docs/adr/0154-audit-ledger-tamper-evidence-sealer-signed-checkpoints-amendments-verify.md @@ -202,7 +202,7 @@ Terms. A **sealed object** is an object that declares `lifecycle.seal` ([D10](#d ## Amendment (2026-11-14, #31908): bounded checkpoints (D4) and the database session seal lock (D3) -**Status of this amendment**: two seat rulings by the owning seat (`domain:server#5`) on the build card [#31908](https://github.com/objectstack-ai/objectstack/issues/31908), both taken 2026-11-14 and recorded as ruling records [`6884540128`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6884540128) (item 1, S7, 21:33Z) and [`6885005594`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6885005594) (the item-5 ruling, E + B, 22:12Z). Each ruling names this amendment as the governed change it ships with. `docs/adr/**` is a Tier H governed surface (Prime Directive #14): this amendment is accepted by the merge that lands it. **Change**: D4's "one root per chain per window" and its cost line; D3's "one sealer at a time", which named only the cluster lock. Every other decision stands as written; the sentences replaced above keep their text and carry a dated pointer here. Recorded under Prime Directive #13: a recorded decision changes by an amended record, not by a build that quietly does otherwise. +**Status of this amendment**: two seat rulings by the owning seat (`domain:server#5`) on the build card [#31908](https://github.com/objectstack-ai/objectstack/issues/31908), both taken 2026-11-14 and recorded as ruling records [`6884540128`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6884540128) (item 1, S7, 21:33Z) and [`6885005594`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6885005594) (the item-5 ruling, E + B, 22:12Z). Each ruling names this amendment as the governed change it ships with. `docs/adr/**` is a Tier H governed surface (Prime Directive #14): this amendment is accepted by the merge that lands it. **Change**: D4's "one root per chain per window" and its cost line; D3's "one sealer at a time", which named only the cluster lock. Every other decision stands as written; the sentences replaced above keep their text and carry a dated pointer here. Recorded under Prime Directive #13: a recorded decision changes by an amended record, not by a build that quietly does otherwise. A third ruling of the same day, [`6885452378`](https://github.com/objectstack-ai/objectstack/issues/31908#issuecomment-6885452378) (22:50Z), amends D3's sealed-through watermark in place; see the dated note there. ### D4, amended — a chain's window seals into consecutive checkpoints of at most N = 10,000 leaves @@ -212,6 +212,7 @@ Ruling record 6884540128, item 1 (S7). - **Ids are sorted.** This amendment does not change D1's leaf order within one checkpoint's tree. - **`late` checkpoints are capped the same way**: no `late` checkpoint holds more than N leaves ([D3](#d3--the-sealer-asynchronous-after-a-settle-lag-one-at-a-time-under-the-cluster-lock)'s late rows). - **Part index and final flag.** The signed body of a checkpoint ([D4](#d4--checkpoints-one-merkle-root-per-chain-per-window-chained-and-signed)'s list of what a checkpoint carries) also carries a **part index** and a **final flag**, both under the signature. A crash mid-window therefore resumes as `window`: the rows of that window not yet sealed are sealed into further `window` parts, and are never mislabelled `late`. +- **A `late` checkpoint's part index restarts at 0 for each late sealing** (seat ruling [`6888674846`](https://github.com/objectstack-ai/objectstack/pull/33637#issuecomment-6888674846), item 2). Nothing collides: the only unique key is `(sealed_object, chain_key, sequence)`, resume reads `window` checkpoints only, and the verifier orders checkpoints by sequence. - **The sealer's "not sealed twice" invariant (S1 in the build) relaxes** to allow the parts of the same window. - **The verifier faults any row id that two checkpoints list** ([D9](#d9--os-audit-verify)). - **What it replaces.** D4's heading and premise, "one Merkle root per chain per window", become one Merkle root per checkpoint, of which a chain's window has one or more. Chaining, signing, the column set, the seed per checkpoint ([D2](#d2--salts-come-from-one-sealed-seed-per-checkpoint)) and every other field D4 lists are unchanged.