Skip to content

feat(plugin-audit): seal the audit log by default and expire sealed rows by whole checkpoints (ADR-0154 D8, D10) - #37605

Draft
objectstack-fleet[bot] wants to merge 8 commits into
mainfrom
claude/project-thread-vslp7g
Draft

objectstack-fleet[bot] wants to merge 8 commits into
mainfrom
claude/project-thread-vslp7g

Conversation

@objectstack-fleet

@objectstack-fleet objectstack-fleet Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Sales · project thread

Fixes #31908

Clause-②: yes (widening) (LifecycleService gains a public prefix-expiry seam for sealed objects)
Metadata-protocol: none (the seal key landed in P1b; this changes a platform object's declaration only)

维护者速读

  • 每个部署的审计日志从此默认带防篡改封印:管理员跑审计校验时,被改、被删、被脱敏、按策略到期的记录都能分辨出来,热库和归档库都算。
  • 这是审计日志防篡改专题的最后一片,补上「到期删除」:过了保留期的记录按整段检查点删,删之前先签一份到期说明,校验时读作“到期”而不是“丢失”。
  • 出错时只会多留记录、不会多删:没有加密服务、链条有缺口或签名不可信时,过期记录一律保留并告警一次;整体可以随版本回退。
  • 无。

Tier: not Tier H. About 1,500 changed lines (under 3,000), and no governed path: packages/spec/src/data/object.zod.ts changes one .describe() sentence only, and the skills/** wording fix is split into this claim's second PR (amendment 7193137455), which is Tier H on its own.

What changes

ADR-0154 D8 + D10, slice P4c, the last slice of #31908.

  • sys_audit_log is sealed by default. Its lifecycle now declares seal: { valueFields: ['old_value', 'new_value', 'metadata'] } (packages/plugins/plugin-audit/src/objects/sys-audit-log.object.ts). The chain column is the default tenant_id (a lookup, one text value on every store).
  • LifecycleService: sealed objects expire only through a registered seam (packages/objectql/src/lifecycle/lifecycle-service.ts). New public registerSealedExpiry(expiry) (one slot; a later registration replaces it; the disposer clears only its own) and the types LifecycleSealedExpiry, LifecycleSealedExpiryRequest, LifecycleSealedExpiryRun. For an object with lifecycle.seal:
    • the retention.maxAge / ttl.expireAfter legs and the archive's keep prune never delete by a row cutoff; each asks the seam to plan({ object, policy, policyValue, cutoff });
    • each run's rowIds are deleted by id (hot and archive for an archiving object; through the engine, reap guards asked, for the rest), and run.complete() is called only when every one is gone;
    • with no seam registered, rows are kept, the archive copy still runs, the sweep reports seal-expiry-pending, and one warn says so;
    • a tenant-scoped override does not apply (one signed policy value per chain), said once.
  • plugin-audit: the expiry writer (new audit-seal/expiry.ts, AuditSealer.expire, registration in audit-plugin.ts):
    • per chain, from the first remaining checkpoint (which must follow the last admitted expiry, or be sequence 0), take consecutive checkpoints whose window ended at or before the cutoff aligned down to a UTC day, each admitted by a trusted signature, at most 10,000 rows a sweep;
    • sign and store the chain's expiry amendment (the S1 key-id loop, then the sink, best-effort), then answer the run; complete() deletes the checkpoints, then their seeds;
    • a stored, admitted amendment that still covers the first remaining checkpoint is resumed (no second amendment); an unadmitted one deletes nothing;
    • a gap or an untrusted checkpoint stops the chain there and is said once;
    • planning holds the audit.sealer lock and the DB seal-pass lock, so two replicas never sign two amendments over one range; a fully drained plan is memoised for the day;
    • registered only when the plugin has a crypto provider (otherwise nothing could be signed);
    • the sealer's head falls back to the last expiry when a chain has no checkpoint left (last_sequence, last_removed_digest), and the object floor to the newest covered_to.
  • Verifier: the S4 arm (seat ruling 6885452378, ADR-0154 D3 as amended in docs(adr): ADR-0154 amendments — bounded checkpoints (D4) and the DB session seal lock (D3) #33489): a window that starts at or before the newest window a trusted window checkpoint names is sealed, so a lagging chain's rows read late and unsealed.
  • verify harness (packages/verify/src/harness.ts, ruling 6884540128 item 4): an AuditPlugin that bootStack mounts (extra, stack plugins, or requires: ['audit'] provider) adopts harnessCryptoProvider(), the instance settings and the engine get; an instance with its own provider keeps it.
  • Docs: the lifecycle.seal describe sentence (and the regenerated content/docs/references/data/object.mdx), content/docs/data-modeling/objects.mdx (the sentence at :277, plus one line that sys_audit_log declares the block).

Tests

  • packages/objectql/src/lifecycle/lifecycle-service.sealed-expiry.test.ts (new, 9): pending skip and the once-only warning; archive.keep plan on both stores and complete-after-delete; retention.maxAge per-id engine deletes; ttl.expireAfter; a partial guard veto leaves its run uncompleted; a failing plan deletes nothing; slot replacement and disposer; a malformed registration; an unsealed object keeps the row-cutoff path.
  • packages/plugins/plugin-audit/src/audit-seal/audit-seal-expiry-live.integration.test.ts (new, 8): the real-kernel end-to-end over SQLite with an archive datasource. sys_audit_log sealed by its own declaration; the plugin's sealer seals; an interrupted expiry (amendment stored, rows still there) reads expired; the kernel's own LifecycleService sweep archives, resumes, deletes exactly the expired rows from both stores and then their checkpoints and seeds; a second same-day sweep signs nothing; verify then reads no gap and the untouched windows unmodified in hot and in archive; a fully expired chain's next checkpoint links to last_removed_digest; modified, missing and redacted are still told apart. A second boot: a sound chain expires whole, a chain stops at a checkpoint no trusted key signed, a chain with a gap is kept, each said once.
  • audit-seal-sealer.test.ts (+1): the S4 sole-chain window reads late unsealed and ok false.
  • audit-plugin.test.ts (+3): the expiry is registered with a crypto provider, unregistered on destroy, not registered without one, and boot survives a lifecycle service without the seam.
  • Existing pins adjusted for the seal default (not loosened): packages/cli/src/commands/audit/verify.integration.test.ts and verify.ownership-queue.integration.test.ts now expect sys_audit_log beside the fixture ledger in objects and in the unreachable-archive message, and case 4 reads that a project with no seal of its own still checks the platform's sealed audit log (exit 0); the four os migrate audit-* archive and preview integration files (audit-mail-bodies.archive, audit-key-material.archive, audit-side-copies.archive, preview-read-only) pass --sealer-stopped on their SQLite --apply runs (and preview-read-only, now judged by the test-source alias gate's source reach, pays its twelve dynamic imports at module top); and in plugin-audit, audit-seal-chain-field-34164.test.ts passes archive: () => 'none' (its boot connects no archive datasource, as os audit verify establishes), and audit-seal-host-seam-resolve-34280.integration.test.ts forgets what the loop's own first pass reported before each pin counts its own passes.
Ablations (each restored, blob == HEAD)
  • Verifier S4 arm || start <= this.newestSealedWindow() → || false: the new sole-chain pin goes red (expected [] to deeply equal [ Array(1) ]), 1 failed | 57 passed.
  • Lifecycle routing if (lc.seal) return this.reapSealed(…) disabled: 5 of the 9 new lifecycle pins go red.
  • Archive keep branch if (lc.seal) { disabled: the two archive pins go red.

Acceptance notes

  • Rows are kept, never over-deleted, whenever something is off. No crypto provider, a one-shot boot, a gap, an untrusted checkpoint, a reap guard veto, or a failing plan all keep the rows. A deployment whose AuditPlugin has no crypto provider now keeps sys_audit_log rows past archive.keep instead of pruning them, and says so once per process at warn.
  • os migrate audit-* --apply on SQLite or Turso now needs --sealer-stopped whenever it rewrites sys_audit_log: the 18.6.0 rule for a sealed object (ADR-0154 D3 amended, B, seat ruling 6885005594) now meets every deployment. Postgres and MySQL take the lock as before; dry runs are unchanged. Named in the changeset.
  • The day-aligned cutoff keeps a row at most one day past its policy, on top of D8's bound, so a drained chain gains at most one expiry amendment a day; amendments are never removed.
  • 10,000 rows a sweep per sealed object (the Archiver's own bound); a cut run continues in the next amendment.
  • Tenant-scoped retention overrides do not apply to a sealed object (global override and declaration do); said once. Changing that would need a per-organization policy value in the signed body.
  • os audit verify on a deployment with no archive datasource anywhere already reads the hot store alone ('none'); a library caller of verifyAuditLedger that composes no archive must now pass archive for sys_audit_log, as the adjusted test does.
  • File surface past the claim: the two CLI os audit verify integration pins and the four CLI os migrate audit-* integration files above (expectations and the flag only), packages/verify/vitest.config.ts (one anchored alias the source-alias gate asks for), scripts/engine-double-contract.pinned.json and the plugin-audit tenant-audit census page (both regenerated by their own --write). Named here for the seat.
  • The CLI os serve composition is unchanged (it already hands its host provider to AuditPlugin, P4b).
  • The skills/objectstack-data/rules/lifecycle.md "not built yet" wording follows in this claim's second PR (Tier H, amendment 7193137455).
  • Owed before queueing: a contract-review-tier L2 (Clause-② yes), done by the seat.

Verification

Two-minute check: cd packages/plugins/plugin-audit && pnpm exec vitest run src/audit-seal/audit-seal-expiry-live.integration.test.ts — expect Tests 8 passed (8).

Read first (risk order): packages/plugins/plugin-audit/src/audit-seal/expiry.ts (chainRun: resume, gap, admission, budget), packages/objectql/src/lifecycle/lifecycle-service.ts (sweepSealed / deleteSealedRows: complete only after every row is gone), packages/plugins/plugin-audit/src/audit-seal/sealer.ts (expire: locks around planning; the head fallback).

Local runs at 51ba1c1 (each under os-verify-lock, exit captured before any pipe)
  • pnpm turbo run build over the plugin-audit, verify and cli closures: exit 0.
  • plugin-audit full: Test Files 110 passed (110), Tests 1844 passed (1844), exit 0.
  • objectql full: Test Files 640 passed (640), Tests 14442 passed (14442), exit 0.
  • verify full: Tests 503 passed (503), exit 0 (re-run after the alias).
  • cli: src/commands/audit/, serve-audit-registration.contract, app-audit-plugin-host-crypto, schema-migrate.one-shot-family.integration: 4 red before the pin updates (all the seal default), then the two adjusted files 15 passed (15).
  • spec src/data + metadata-form-zod-reconciliation: 6963 passed | 1 todo; service-settings 1521 passed; lint validate-security-posture 224 passed; runtime's two sys_audit_log lifecycle integration files 14 passed | 2 skipped.
  • pnpm --filter @objectstack/{objectql,plugin-audit,verify} tsc --noEmit: exit 0. eslint --no-inline-config on the 15 changed sources: exit 0.
  • gen:schema && gen:docs regenerated content/docs/references/data/object.mdx.
  • dispatch-gates --commands: 128 derived. 127 exit 0 at the end, after four fixes (check:engine-double-contract and check:objectql-double-limit on the new lifecycle double, check:test-source-alias on verify's new import, check-tenant-audit-census on the new amendment insert, each --write regenerated or fixed at source). One NOT MEASURED: check-plugin-teardown-shape --self-test exits 3, PREREQUISITE NOT MET (needs an unshallow clone; its scan exits 0). Three that first exited 3 while a build ran beside them (check:skill-examples, check:dual-build-cjs-loads, check:i18n) exit 0 on re-run.
  • At 5860216 (after CI on 9177bc8): objectql typecheck (test files included) exit 0; cli audit-mail-bodies.archive, audit-side-copies.archive, audit-key-material.archive, preview-read-only and audit-redaction-seal.contract: Test Files 5 passed (5), Tests 57 passed | 1 skipped, exit 0 (14 red before --sealer-stopped, all the seal default).
  • 4deab94: check:test-source-alias exit 0; preview-read-only 8 passed | 1 skipped.
  • overlap-check at 4deab94: merges cleanly with origin/main 0f6a1e5, 0 PR heads.

Generated by Claude Code

🤖 Generated with Claude Code

https://claude.ai/code/session_01L6bhgUd6hon2o34LQSLbZt

…ned expiry amendments (WIP)

ADR-0154 D8/D10 P4c: sys_audit_log seals by default; the sealer writes an
expiry amendment before the lifecycle service deletes a covered prefix.

Claude-Session: https://claude.ai/code/session_01L6bhgUd6hon2o34LQSLbZt
Co-authored-by: Claude <noreply@anthropic.com>
…sealed expiry (WIP)

Claude-Session: https://claude.ai/code/session_01L6bhgUd6hon2o34LQSLbZt
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions

github-actions Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 4 package(s): @objectstack/objectql, @objectstack/plugin-audit, @objectstack/spec, @objectstack/verify, touching 62 documentable anchor(s). ⚠️ 2 changed file(s) yielded no anchor (packages/objectql/src/index.ts, packages/verify/vitest.config.ts), so the pages documenting them are NOT COVERED by this run — this is not a clean bill of health for those files.

15 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:

  • content/docs/automation/connectors.mdx (via keyId (symbol, a field of class ObjectExpiry))
  • content/docs/data-modeling/drivers.mdx (via LifecycleService (symbol, a top-level class))
  • content/docs/data-modeling/objects.mdx (via AuditPlugin (symbol, a top-level class), LifecycleService (symbol, a top-level class), archive.keep (literal, a string literal in archiveObject; a string literal in policy), expireAfter (literal, a string literal in reapSealed), maxAge (literal, a string literal in reapSealed), new_value (literal, a string literal in lifecycle), old_value (literal, a string literal in lifecycle), retention.maxAge (literal, a string literal in policy; a string literal in reapSealed))
  • content/docs/deployment/cli.mdx (via new_value (literal, a string literal in lifecycle), old_value (literal, a string literal in lifecycle))
  • content/docs/deployment/production-readiness.mdx (via maxAge (literal, a string literal in reapSealed))
  • content/docs/kernel/runtime-services/push-service.mdx (via keyId (symbol, a field of class ObjectExpiry))
  • content/docs/kernel/services.mdx (via LifecycleService (symbol, a top-level class))
  • content/docs/permissions/attachments-access.mdx (via LifecycleService (symbol, a top-level class))
  • content/docs/permissions/record-view-auditing.mdx (via AuditPlugin (symbol, a top-level class), new_value (literal, a string literal in lifecycle), old_value (literal, a string literal in lifecycle))
  • content/docs/plugins/index.mdx (via keyId (symbol, a field of class ObjectExpiry))
  • content/docs/plugins/packages.mdx (via AuditPlugin (symbol, a top-level class))
  • content/docs/protocol/kernel/config-resolution.mdx (via maxAge (literal, a string literal in reapSealed))
  • content/docs/protocol/kernel/index.mdx (via AuditPlugin (symbol, a top-level class))
  • content/docs/protocol/knowledge.mdx (via LifecycleService (symbol, a top-level class))
  • content/docs/protocol/objectql/security.mdx (via keyId (symbol, a field of class ObjectExpiry))

⛔ 6 release-owned page(s) also name something this change touched. These are read-only:

  • content/docs/releases/v14.mdx (via LifecycleService (symbol, a top-level class))
  • content/docs/releases/v15.mdx (via LifecycleService (symbol, a top-level class))
  • content/docs/releases/v17/17-1.mdx (via AuditPlugin (symbol, a top-level class))
  • content/docs/releases/v17/17-5.mdx (via expireAfter (literal, a string literal in reapSealed))
  • content/docs/releases/v17/17-6.mdx (via new_value (literal, a string literal in lifecycle), old_value (literal, a string literal in lifecycle))
  • content/docs/releases/v18/18-5.mdx (via AuditPlugin (symbol, a top-level class))

content/docs/releases/ is RELEASE-OWNED (AGENTS.md "Documentation Guardrails"): release
notes are written centrally at release time, and a code PR that edits them is the exact PR
that guardrail exists to stop. They are still audited — read-only. If one of them is actually
wrong, file an issue or open a dedicated docs-only PR; do not edit it here.

What this run could not see
  • 2 changed file(s) yielded no anchor (packages/objectql/src/index.ts, packages/verify/vitest.config.ts) — pages documenting those are invisible to this run
  • 26 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 69 of 252 client-bound route-ledger rows — the other 183 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 183: 0 are remediable by widening that discovery convention (an in-repo file declares the path; the convention did not scan it); 59 are structural — on a ledger where NOT ONE row is declared in-repo, so no discovery change reaches them at any price; 124 are undecided (no in-repo declaration, on a ledger that has other in-repo registrars — absence and an unreadable spelling are not distinguishable here). The rows themselves: node scripts/docs-audit/affected-docs.mjs --bridge-coverage
  • a page that states a rule by its inputs shares no identifier with the emitter that implements the rule, so an emitter-only diff cannot list it — not on this run and not on any run. Measured on fix(driver-sql): emit varchar(maxLength) for a text field a declared index keys on #11430: content/docs/protocol/objectql/types.mdx documents the text-family column mapping by the ObjectQL type names it maps FROM (text / textarea / html) while the diff changed createColumn; it went unlisted, and it was the page that diff falsified, in four places. No shared token exists to detect this on, so a rule your change carries has to be re-read by hand in the pages that restate it.
  • a key NAME is not a key, so the hand re-read the line above prescribes can land on the wrong schema. The same spelling is authorable on one governed type and a [REMOVED] tombstone on another for each of active, aria, joins, objects, template, tools and version (censused on [finding] tools is a key on BOTH AgentSchema (tombstoned, dead) and SkillSchema (live, cloud-attested), so a name-based search attributes skill examples to the agent key — it produced a false stop-the-line alarm on PR #19059 #19093 over the liveness ledger's governed types, top-level keys); nothing in a search result distinguishes the two, so a grep hit on a LIVE example reads as evidence about the DEAD key. Measured on fix(spec): the agent.tools liveness row says dead — it claimed live on a key the schema tombstoned #19059: content/docs/ai/agents.mdx was reported as contradicting the agent.tools tombstone over its tools: example at :161, which is inside the defineSkill({ block opened at :155 — the page was already correct. Settle ownership by PARSING the value against both schemas, never by the name: that literal PASSES SkillSchema, and as an AgentSchema it FAILS at tools with the tombstone prescription. ⛔ These names are not the whole class — a key retired through a .strict() guidance map leaves no tombstone in the walked shape and none of them here (tool.category, live as AIToolDefinition.category).

Coarse fallback — 183 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): node scripts/docs-audit/affected-docs.mjs --json 54d6726c09019bd1d9da29b7aee3fb9e907dbb0a → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 504032f30a7a8fae333833480ed56043fc2792e8 — the merge of head 4deab949980d45dd8a860ca86b187b4c38379691 into base 54d6726c09019bd1d9da29b7aee3fb9e907dbb0a, which is what actions/checkout gives a pull_request run. Not the PR head.

A worktree cut from an older main holds a different content/docs, so re-deriving there can legitimately return a different list — that is a different tree, not a wrong row. To answer on the same tree:

# while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 504032f30a7a8fae333833480ed56043fc2792e8 && git checkout 504032f30a7a8fae333833480ed56043fc2792e8
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 54d6726c09019bd1d9da29b7aee3fb9e907dbb0a 4deab949980d45dd8a860ca86b187b4c38379691 && git checkout -B drift-repro 54d6726c09019bd1d9da29b7aee3fb9e907dbb0a && git merge --no-ff 4deab949980d45dd8a860ca86b187b4c38379691

node scripts/docs-audit/affected-docs.mjs --json 54d6726c09019bd1d9da29b7aee3fb9e907dbb0a

⚠️ That checkout carried uncommitted changes, so the commit above does not fully identify what was read.

Advisory only, and a precision-first one (#9192): a page is listed because it names a
symbol, wire route or SDK method this diff touched — not because it mentions a changed
package. Each row says which anchor put it there, so a wrong row is reportable rather than
merely annoying. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs 54d6726c09019bd1d9da29b7aee3fb9e907dbb0a → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@github-actions github-actions Bot added documentation Improvements or additions to documentation protocol:data tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 26, 2026
…pins; type the sealed-expiry test's veto

sys_audit_log now declares lifecycle.seal, so an `os migrate audit-* --apply`
run on SQLite needs --sealer-stopped (ADR-0154 D3 amended, B). The four
archive/preview integration files pass it; the changeset names the operator
change. The lifecycle sealed-expiry test's partial-veto double returns
string ids.

Claude-Session: https://claude.ai/code/session_01L6bhgUd6hon2o34LQSLbZt
Co-authored-by: Claude <noreply@anthropic.com>
…ule load

The edited test file is now judged by the test-source alias gate's source
reach: each dist-resolved dependency its served boot reaches through a
dynamic import gets a module-top side-effect import.

Claude-Session: https://claude.ai/code/session_01L6bhgUd6hon2o34LQSLbZt
Co-authored-by: Claude <noreply@anthropic.com>
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-sales · session_01L6bhgV6i8jfWwSXjpWJrjA

Contract review

Served-tier: CONTRACT_REVIEW_TIER
Head-sha: 4deab949980d45dd8a860ca86b187b4c38379691
Local-runs: none
Scope: packages/spec/src/data/object.zod.ts + packages/objectql/src/lifecycle/lifecycle-service.ts, packages/objectql/src/index.ts, packages/plugins/plugin-audit/src/audit-seal/expiry.ts, packages/plugins/plugin-audit/src/audit-seal/sealer.ts, packages/plugins/plugin-audit/src/audit-seal/verifier.ts, packages/plugins/plugin-audit/src/audit-plugin.ts, packages/plugins/plugin-audit/src/objects/sys-audit-log.object.ts, packages/verify/src/harness.ts

Inputs: card #31908 (body and all 62 comments), PR #37605 (body, 28 files, net diff against merge base 061e3422), ADR-0154 as on the head, and the head's check-runs, read 2026-11-26T16:48Z: 62 success, 12 skipped, none failed or pending. The rest of the diff (tests, the changeset's prose, the three docs pages, the census page, engine-double-contract.pinned.json, packages/verify/vitest.config.ts) is the lane seat's ACCEPT at TIER_DEFAULT.

① Derived judgments

  1. sys_audit_log declares seal: { valueFields: ['old_value', 'new_value', 'metadata'] }. Right: ADR-0154 D10's value, word for word; the chain column is the default.
  2. Every project's os audit verify now reports sealed: true with sys_audit_log in objects, and exits 2 when the archive datasource the ledger names is declared and not reachable. Right (D9, D10).
  3. LifecycleService.registerSealedExpiry and the exported types LifecycleSealedExpiry, LifecycleSealedExpiryRequest, LifecycleSealedExpiryRun. Right as a widening (D8, "a seam beside registerReapGuard"). The name is not the one slice plan 6759503769 ruled; see ③.
  4. LifecycleSweepEntry.policy gains 'expiry' and report.skipped gains the reason seal-expiry-pending. Right, a widening of a published report shape; the declaration line does not name it.
  5. On an object declaring lifecycle.seal, retention.maxAge, ttl.expireAfter and archive.keep no longer delete by a row cutoff. Right against D8. It is a changed meaning of authored keys, which the declaration reads as none: wrong, see ② S2.
  6. A tenant-scoped retention_overrides window is not applied to a sealed object with no archive. Wrong as built, see ④ S1; and a narrowing the declaration does not carry.
  7. With no sealed expiry registered the rows are kept, including the cold archive.keep prune of sys_audit_log on a deployment whose AuditPlugin has no crypto provider. Right (D8's seam bullet), and stated.
  8. os migrate audit-* --apply needs --sealer-stopped on SQLite and Turso on every deployment, and takes the audit seal lock on Postgres and MySQL on every deployment. Ruled; declared wrong, see ② M2.
  9. The verifier's third sealed-window arm: more rows read late unsealed and os audit verify exits 1 where it exited 0. Right: seat ruling 6885452378 and D3 as amended, as written.
  10. verifyAuditLedger (a root export) needs archive passed where the datasource sys_audit_log archives to is not connected. Follows from 1; a narrowing for a library caller, stated in the PR body only.
  11. The verify harness hands harnessCryptoProvider() to an AuditPlugin it mounts, on all three mount paths, through adoptHostCryptoProvider. Right: ruling 6884540128 item 4.
  12. The sealer's head and floor fall back to the last expiry when no checkpoint is left. Right (D8).
  13. The lifecycle.seal .describe() sentence: prose only, no accept-set change, the reference page regenerated.

② Semver level

The changeset moves plugin-audit, objectql, verify and spec at patch, with Clause-②: yes (widening) and Metadata-protocol: none. The widening half is true. Two things are not.

M2 (must-fix) — the declaration carries no narrowing, and this diff narrows. This card's own precedent is changeset 35c9a30 (#33675): it declared the same refusal yes (narrowing) under a **BREAKING** banner with an ADR-0087 marker, and bounded it with "No object declares lifecycle.seal by default, so a deployment that did not opt in sees no change". This diff is the change that opts every deployment in. Narrowed here:

  • os migrate audit-key-material, audit-mail-bodies, audit-metadata-bodies and audit-side-copies with --apply on SQLite or Turso are refused without --sealer-stopped on every deployment. Their object lists name sys_audit_log statically and holdAuditSealLock reads lifecycle.seal off the registry, so the refusal does not depend on whether a row needs rewriting.
  • On Postgres and MySQL the same runs now take the audit seal lock on every deployment, wait up to ten minutes for a sealer pass, then refuse. The changeset's "as before" holds only for a deployment that had opted in.
  • os audit verify exits 1 on rows the new arm reads late unsealed (item 9).
  • verifyAuditLedger without archive (item 10).
  • The tenant-scoped window (item 6).
    Owed on both carriers: the (narrowing) arm beside the widening, the BREAKING banner with the one-line fix for each item, the ADR-0087 disposition marker, and the Skills-docs: line the arm brings. The changeset's bullet on --sealer-stopped is true as far as it goes; it is the banner and the arm that are missing.

S2 (should-fix) — Metadata-protocol: none reads the diff as a platform object's declaration only. The diff also changes what retention, ttl and archive.keep mean beside seal on any author's object (item 5), and rewrites the key's own .describe() to say so. AGENTS.md names a changed meaning semantic, and the shipped changelogs use semantic for runtime changes of this kind. semantic takes at least minor on a package the diff moves, so the level does not match either. The seat rules the kind on the card; if it keeps none, the ruling says why item 5 is not a changed meaning.

③ Boundary flags

  • Sealed by default, so --sealer-stopped on every SQLite and Turso deployment. Covered: D10 rules the default, D3 as amended (B) and seat ruling 6885005594 item 2 rule the flag for any object declaring lifecycle.seal, and slice plan 6759503769 put the default in this slice. Stated true in the changeset. Maintainer's decision: none is owed on the rule itself. What is owed is M2, the dev's to fix. It goes to the maintainer only if the seat contests that M2 is a narrowing, because 18.6.0 told operators a deployment that did not opt in would see no change.
  • Operator pages outside this diff, for the lane seat: content/docs/deployment/cli.mdx is on the claimed surface and untouched; its os migrate audit-* section says only "Run them with the server stopped" and never names the flag or the lock. content/docs/upgrading.mdx ties the flag to "where an app declares lifecycle.seal". Both are false for a default deployment once this lands.
  • Carrier: cloud. Turso environments meet the refusal on their next os migrate audit-* run, and a host that passes no crypto provider to AuditPlugin now keeps sys_audit_log past archive.keep and reports hourly at error.
  • No crypto provider: rows kept, said once at warn. Answered: right. D8 rules that a missing amendment keeps the rows, and the sealer's own error line carries the durability half.
  • A tenant-scoped override does not apply to a sealed object. Named for this review by amendment 7195525477; no ruling covers it. S1 below. It needs a ruling of record: the seat's, and the maintainer's if the ruling would let a chain expire under a window shorter than the one configured for it.
  • The cutoff aligned down to a UTC day, and 10,000 rows a sweep. Escalated to the seat. D8 states the extra retention as "at most one window plus the late horizon" and the Consequences line repeats it; the build adds up to one day, and a backlog adds more. The direction is safe and verification still honours the amendment. Under Prime Directive 13 the bound changes by a record: a seat ruling on the card and an add-only ADR-0154 note in its own governed PR, as docs(adr): ADR-0154 amendments — bounded checkpoints (D4) and the DB session seal lock (D3) #33489 did for the three rulings before it. The budget is also per object across all chains, where the Archiver bound it cites is per pass.
  • The seam's name. Slice plan 6759503769 ruled registerExpiryPrefix; the diff ships registerSealedExpiry and no later ruling renames it. The seat confirms the name on the card before it is published.
  • File surface. content/docs/deployment/production-readiness.mdx and the four os migrate integration files are in the diff and in no claim line (7193045552, 7193137455, 7195525477). An amendment is owed; the lane seat's.
  • The skills sentence. skills/objectstack-data/rules/lifecycle.md keeps "Not built yet ... the sweeper still deletes sealed rows" from this merge until the second PR, and this PR's closing keyword closes the card first. The seat's call; its own example there (retention beside seal, no archive) is the shape S1 is about.
  • SQL push-down. No finding. The chain walk, the run walk and the head reads push their filter, order and limit down. The id lists of runOf and deleteSealedRows are the row ids a checkpoint's signed body carries, which D8 makes the unit of deletion, and the per-row engine delete is batchedReap's, for the guards.
  • Ruling 6885452378 item 6 (the notice and the no-later-window case) is deferred by the ruling itself.

④ Design judgment

packages/spec/src/data/object.zod.ts. One .describe() sentence. It holds against D8 and D10 and against its first consumer, sys_audit_log: archive.keep expires by whole checkpoints through the seam, and without a registered expiry the sweeper keeps the rows. No shape change.

packages/plugins/plugin-audit/src/objects/sys-audit-log.object.ts. Holds: D10's value, class audit, no onlyWhen, archive.after equal to retention.maxAge.

packages/objectql/src/lifecycle/lifecycle-service.ts. The routing holds against D8: an archiving sealed object expires on keep alone, on both stores, by id; any other sealed object expires through its ttl and retention legs; rows go before complete(); an unfinished run is not completed; a throwing plan deletes nothing; no expiry means no delete.

S1 (should-fix) — reapSealed drops a tenant-scoped window and expires every chain under the global one. On main that window was applied to a sealed object like any other (reap, tenantWindowsFor). Where a tenant's window is longer than the global one, its rows are now expired earlier than the operator configured, after one warn. That is a delete, on an audit-class object, and it contradicts the PR's own rule that anything off keeps rows. The stated reason, one signed policy value per chain, does not force it: by default a chain is one organization's, and each chain's amendment carries its own policy value. The seat rules the shape (a per-chain value, or the longest window as the one value); either way a chain is never expired under a window shorter than the one configured for it. sys_audit_log itself is not affected: it archives, and keep has no override.

packages/plugins/plugin-audit/src/audit-seal/expiry.ts. The fresh run holds against D8 sentence by sentence: it starts at the first remaining sequence, which must follow the last admitted expiry; takes consecutive checkpoints whose windows ended by the cutoff; admits each; signs and stores the amendment before it answers; carries the last removed digest, the policy and its value; resumes a stored range before it signs another.

M1 (must-fix) — expiry.ts. One finding in a security-adjacent path. Its statement is withheld from this record and handed to the seat off the public thread, as report 6821958333 did. The delta record closes it by id.

S3 (should-fix) — the resumed range is read with no orderBy, so complete() removes its checkpoints in driver order. sealer.ts says of expire that the pass's locks keep a sealer pass from reading a chain head the expiry is moving, but complete() runs after expire has released them. What keeps a concurrent pass's head right is that the newest checkpoint goes last and the expiry fallback then answers the same head, which is true by construction only in the fresh run. Read the resumed range ascending by sequence, and make the sentence name what protects the head.

sealer.ts, audit-plugin.ts. expire holds: both locks around planning and signing, no run while either is held, a throw with no crypto or signer, the memo only for a plan that found nothing. The head and floor fallbacks hold against D8. Registration only with a crypto provider, and its removal on destroy(), hold.

verifier.ts. The arm is ruling 6885452378 item 1 as written, and D3's amended bullet says the same.

packages/verify/src/harness.ts, packages/objectql/src/index.ts. Hold: the one harness provider on all three mount paths, never a bare provider, an instance with its own provider left alone; the three types exported.

Nits:

  • n1 — the .describe() sentence and objects.mdx do not say what a tenant-scoped window or the day alignment does on a sealed object; they follow S1's ruling.
  • n2 — expiry.ts's header says rows stay at most one day past their policy on top of D8's bound; the row budget can add more.
  • n3 — on the stores path deleteSealedRows answers that every row is gone once bulkDelete did not throw, and asks bulkDelete of a cold driver the boot checked for upsert only (the old prune guarded deleteMany). A cold driver without it fails each sweep after the amendment is signed: loud, and it keeps the rows.

Implemented-by: claude/project-thread-vslp7g
Reviewed-by: session_01L6bhgV6i8jfWwSXjpWJrjA

VERDICT: FAIL

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation domain:server Domain lane — seat card indexed by label:pm:seat protocol:data size/xl tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

plugin-audit + objectql lifecycle: build the audit tamper-evidence ADR — sealer, signed checkpoints, redaction and expiry amendments, os audit verify

2 participants