Repository navigation
feat(plugin-audit): export the signed-body readers so a checkpoint sink can re-deliver what it missed - #35895
Conversation
Export checkpointBodyFromRow and amendmentBodyFromRow, with the two body types they answer, from the ADR-0154 export block of the package entry, so a checkpoint sink outside the package can rebuild a stored checkpoint or amendment row into the exact body it was handed and re-deliver it. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
Metadata-protocol: none takes patch on the level axis; exporting two readers changes nothing a metadata author can write. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
📓 Docs Drift Check
What this run could not see
Coarse fallback — 12 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): |
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract-review-claim: session_01L9qibwJEh7hMPPvagWM1g7 · head af6dff1 · 2026-11-20T17:58Z The L2 is owed on the |
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH L1: ACCEPT at
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract reviewServed-tier: Read for this record: card #34170 with all 8 comments, PR #35895 (body, 4 files, net diff against Check-runs on this head: 58 runs, 38 ① Derived judgments
② Semver level
③ Boundary flagsDev report 7045478481 (blocked):
Dev report 7046786325 (done):
Escalated to the seat:
SQL push-down: no finding. The diff adds no production query, no id materialisation and no in-app join. The only reads are the test's two ④ Design judgmentAgainst the card's acceptance scenario: holds. The sealer hands the sink the object it signed ( Against ADR-0154: holds. D2: a body carries commitments, roots, digests and handle ids, never a value, salt or seed, so exporting the body types publishes nothing that Attempts to break it:
Findings: S1 (should-fix) — The public TSDoc and the changeset say the reader "answers the body the sink was handed". That holds only for a row nobody changed. The reader checks shape, never authenticity, and a missed checkpoint waiting for re-delivery is exactly the row a host operator can still rewrite (ADR-0154: "Whoever holds the database and either key can re-sign"). The readers' own neighbour says it for its case ( S2 (should-fix) — The acceptance speaks of the entry and its signed bytes; the export gives the body only. A sink outside the package must assemble the entry itself ( N1 (nit) — N2 (nit) — N3 (nit) — The reader accepts only the installed N4 (nit) — The pin compares with No must-fix. Implemented-by: VERDICT: PASS |
…ow a sink assembles the entry The two public readers validate and normalize a stored row; they never check its signature, so a sink verifies it under a key it trusts before treating the row as delivered. State how an outside sink assembles the re-delivered entry (kind from the table, keyId from body.signing_key_id, signature from the row) and that it brings its own RFC 8785 serializer. Comment and changeset prose only. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH L1 delta: ACCEPT at
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract reviewServed-tier: Delta review of record 7046919186 (head Check-runs on this head: 57 runs, 39 ① Derived judgments
② Semver levelUnchanged: ③ Boundary flagsDev report 7047779338:
Still open from record 7046919186, for the seat: E1 (the committed tree maps to the declaration face, so confirm the reader accepts this above-tier record), E2 (the two quoted rulings are not on the card) and E3 (the PR is still a draft). SQL push-down: no finding. No query was added. ④ Design judgmentEach new sentence, against the code:
Findings: M1 (must-fix) — The sentence says a row re-signed by the signing-key holder is caught by "the off-host trust anchor". In this tree a trust anchor is the party that vouches for a public key ( The wording came from this reviewer's own S1 in record 7046919186, which was loose in the same way; the dev took it faithfully. The fault is the record's first, and it is corrected here. A fix that matches the code, in all three places: "A rewritten row reads back into a body that fails verification. A row rewritten and re-signed under a key planted on the host fails under a key the sink trusts itself. A row rewritten and re-signed by whoever holds the genuine signing key verifies; only the copies already off the host catch it, because a later checkpoint's signed N5 (nit) — "A rewritten row reads back into a body that fails verification" leaves out two cases: a rewrite of an unsigned column ( Closures against record 7046919186:
Implemented-by: VERDICT: FAIL |
… checkpoint or amendment A row re-signed with the genuine signing key verifies under that key, so the trust anchor does not catch it; only the copies already off the host do (a later checkpoint's signed previous_digest). A key planted on the host fails under a key the sink trusts itself. Note the unsigned columns and the SignedBodyError refusal in passing. Comment and changeset prose only. Claude-Session: https://claude.ai/code/session_01L9qibwJEh7hMPPvagWM1g7 Co-authored-by: Claude <noreply@anthropic.com>
|
repo:objectstack#7 · os-tesla · session_01L9qibyQBB3KuDoNobNq9LH L1 delta-2: ACCEPT at
|
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Contract reviewServed-tier: Second delta review: the delta record 7047833971 (head Check-runs on this head: 53 runs, 37 ① Derived judgments
② Semver levelUnchanged: ③ Boundary flagsDev report 7048592847:
Still open from record 7046919186, for the seat: E1 (the committed tree maps to the declaration face, so confirm the reader accepts this above-tier record), E2 (the two quoted rulings are not on the card) and E3 (the PR is still a draft). SQL push-down: no finding. No query was added. ④ Design judgmentEach new sentence, against the code:
Findings: No must-fix, no should-fix. N6 (nit) — The checkpoint TSDoc says the off-host copies "catch it"; the changeset says they "can catch it". The second is the exact one: a rewritten checkpoint that is the newest of its chain has no later link off the host yet. The same holds for a missed amendment, where the TSDoc already says "can". Closures:
Implemented-by: VERDICT: PASS |
|
repo:objectstack#7 · os-tesla · session_01L9qibwJEh7hMPPvagWM1g7 Landing — PR #35895 (#34170) at
|
Requested by Tesla · project thread
Fixes #34170
Clause-②: yes
Metadata-protocol: none
维护者速读
What changes
@objectstack/plugin-auditexportscheckpointBodyFromRowandamendmentBodyFromRowfrom its package entry (the ADR-0154 export block), with the two body types they return,CheckpointSignedBodyandAmendmentSignedBody. Only those two return types are exported, not the types they pull in (area ruling, option A). ThereadSignedCheckpointshelper the card also offered is not added (seat ruling).A checkpoint sink (
audit.checkpointSink, ADR-0154 D11) is handed each signed checkpoint and amendment once. Its contract says it re-delivers what a failed call missed by re-reading the stored records. Until now the readers that turn a storedsys_audit_checkpointorsys_audit_amendmentrow back into the exact signed body were reachable only by path inside the package. A sink outside it would have had to copy the body shape and its parsing.packages/plugins/plugin-audit/src/index.ts: four names added to the ADR-0154 export block, and one comment sentence on why.packages/plugins/plugin-audit/src/audit-seal/signed-body.ts: comments only, no code. Each of the two readers gets a TSDoc@publicand three paragraphs:kindfrom the table,keyIdfrombody.signing_key_id,signaturefrom the row, and its own RFC 8785 (JCS) serializer for the signed bytes.packages/plugins/plugin-audit/src/audit-seal/audit-seal-signed-body-readers-34170.integration.test.ts: new pin, on a real kernel..changeset/34170-export-signed-body-readers.md:patch, with both declaration lines, and the same two paragraphs on verification and assembly.Read first, by risk:
audit-seal-signed-body-readers-34170.integration.test.ts: the whole acceptance claim. It imports the readers through../index.js, the package entry, and compares the result with what the sink was actually handed.src/index.ts, the export hunk: the new public surface.signed-body.ts: the public guidance on what the reader does not check.Two-minute check:
pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2 src/audit-seal/audit-seal-signed-body-readers-34170.integration.test.tsshould reportTests 2 passed (2).Tests
The new pin boots an
ObjectKernelwith ObjectQL, the audit plugin, a registered checkpoint sink and SQLite (wasm). It seals one settled window, which delivers a checkpoint, then runs the mail-log body migration, which delivers a redaction amendment. For each kind, the test reads the stored row and checks four things:entry.body;signedBodyBytes(body)is byte-equal to the RFC 8785 bytes of the delivered body;signatureand the body'ssigning_key_idmatch the delivered entry;Round 1 (d6a679c): comments and changeset only, proved; typecheck and pin re-run
Round 0: plugin-audit typecheck and tests (code at 6e06a45)
Ablation: delete the checkpointBodyFromRow export, and the pin goes red
Committed first (6e06a45), mutated through
scripts/ablation-replace.mjs, and restored to the HEAD blob. The subject resolves throughsrc/(a relative import of the package entry), so no build sits between the mutation and the run.Restored run:
Tests 2 passed (2), VERDICT command-exit 0. The amendment leg stays green under the checkpoint ablation, so the red is specific to the deleted export. Round 1 changes no code, so no new ablation is owed.Acceptance notes
patch. Under maintainer ruling A,Metadata-protocol: nonetakespatch(AGENTS.md, Post-Task Checklist step 3;scripts/check-changeset-no-major.mjs). The claim'sminorwas corrected in af6dff1. The contract review agreed (patchis right) and so did the seat's level amendment on the card.@publicsits on the two readers only, not on the two exported types or any other entry export. Nothing reads the tag.SignedBodyError,AUDIT_CHECKPOINT_OBJECTandAUDIT_AMENDMENT_OBJECTstay internal. The error'snamestring and the two literal table names are the contract a sink reads.AUDIT_SEAL_CANON_VERSION(1). A later canonical form must keep version 1 rows readable; that is worth a line where the constant is next bumped.toEqualand JCS bytes, so member order is not pinned. The contract is the RFC 8785 form.@objectstack/plugin-audit: theapi-surfacesnapshot coverspackages/speconly.signedBodyBytes(the package's RFC 8785 serialization) if the cloud#4128 sink needs it, so the consumer does not copy the serialization. It is not exported in this PR.Verification
Based on origin/main 8c18a36.
overlap-checkat d6a679c against origin/main f44758b: VERDICT clean, exit 0, 0 open PR heads share a file. CI runs the full gate set: see this PR's check runs.Generated by Claude Code