Skip to content

fix(plugin-audit, cli): isolate audit sealer faults per chain; os serve hands its crypto provider to an app-supplied AuditPlugin - #33503

Merged
objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/area-A2-31908-p4b1
Nov 15, 2026
Merged

objectstack-fleet[bot] merged 13 commits into
mainfrom
claude/area-A2-31908-p4b1

Conversation

@objectstack-fleet

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

Copy link
Copy Markdown
Contributor

Requested by Elon · project thread

Part of #31908 (slice P4b1; seat ruling 6884540128 items 2 and 3)

Clause-②: yes (widening)
Metadata-protocol: none

Maintainer quick read

  • What changes: the audit sealer isolates faults per chain. When a canonical rule refuses one of a chain's rows, or one of a chain's checkpoints (its head included) is malformed, only that chain is skipped, and the other chains seal as usual. Each chain has its own cursor and resumes from its own oldest unsealed window. Past a window that holds a skipped chain, sealed_through stops advancing. A lock lapse or a signer, crypto or storage fault still aborts the object's whole pass. Also: when an app puts its own AuditPlugin in plugins without a cryptoProvider, os serve now hands it the host's crypto provider. It does this only for the real AuditPlugin class, and it never overrides an explicit provider.
  • Why: before, one bad row stopped sealing for every chain of the object. And an app's own AuditPlugin (one added to turn on readAudit, for example) replaced the CLI's instance, got no crypto provider, and sealed nothing.
  • Risk and rollback: verdicts and refusal reasons are unchanged, and every existing seal and verify pin passes as is. The PR adds one public method, AuditPlugin.adoptHostCryptoProvider (widening). The sealer pass is window-major, and late never sweeps a lagging chain. Both are pinned per seat ruling 6885452378, the precondition for the verifier's sealed-window rule, which lands in P4c. Rollback is a revert.
  • Read first: in sealer.ts, run, cursorOf, skip, writeChains and the catch in readWindow. In serve.ts, the handHostCryptoToAppAuditPlugin line inside the stack plugins loop. In audit-plugin.ts, adoptHostCryptoProvider.
  • Two-minute check: pnpm --filter @objectstack/plugin-audit exec vitest run src/audit-seal/audit-seal-sealer.test.ts src/audit-plugin.test.ts. Expect 2 files and 65 tests, all green.
  • Needed from you: nothing. The seat lands it.

What changes

  1. S4, per-chain isolation (seat ruling 6884540128 item 2). sealer.ts:
    • Only a chain-local fault skips a chain: a row a canonical rule refuses (CanonicalFormError while reading the row), or a malformed checkpoint of that chain (SignedBodyError/CanonicalFormError while reading it back: its head in headOf, a lister in the late re-count, a lister in listedIn, or its window_start while the cursors are read). The skipped chain stays out for the rest of the pass; every other chain is sealed. Lock lapse, signer, crypto-provider and storage faults (and the Q6 coordinate bound) still throw out of the object's pass, as before.
    • Each chain has its own cursor: the window after its last window checkpoint at or past the object's floor (the stored sealed_through, before which every chain is complete). A row is late only before its own chain's cursor; at or past it the window pass seals it as window. So a skipped chain (or one a stopped pass left) resumes from its own oldest unsealed window as window checkpoints. This replaces the object-wide lastWindow / resumed pair.
    • sealed_through on every window checkpoint is min(window start, earliest window a skipped chain leaves unsealed), never below the stored floor. So it never passes a window that has a skipped chain.
    • The window walk starts at the floor. A window that only re-reads chains already sealed (or skipped) past it does not count toward MAX_WINDOWS_PER_PASS, so a stuck chain cannot stall the others behind the cap.
    • Each skipped chain is reported once at error per cause per hour, naming the object, the chain, the fault (code and reason, never a statement) and the window it is unsealed from. A chain sealed again is forgotten.
  2. App-supplied AuditPlugin (seat ruling 6884540128 item 3).
    • audit-plugin.ts: new adoptHostCryptoProvider(provider, { armSealer }). It takes the provider only when the instance was composed with no cryptoProvider, so an explicit one is never overridden. armSealer: false (a one-shot boot) keeps the sealer off. true leaves the instance's own armSealer standing, so an app's armSealer: false is never turned on. Kept in private fields; the app's options object is not mutated.
    • packages/cli/src/utils/app-audit-plugin-host-crypto.ts: handHostCryptoToAppAuditPlugin hands over only to instanceof the real class, as this host loads it. A same-named lookalike is never touched. It never throws.
    • serve.ts: the class is loaded once, best-effort, ahead of the stack plugins loop. Each entry is handed () => hostCrypto?.provider and !migrateAndExit (the same provider function and one-shot posture as the 5d instance and the requires: ['audit'] resolver) right before kernel.use. Boot is never refused. An instance left with no provider keeps D3's once-at-error report from its sealer.

Out of scope, untouched: S7, the item-5 DB session lock, verify's bootStack crypto (item 4, P4c), any lifecycle.seal default, expiry amendments, objectql lifecycle, docs/adr/**, .claude/**, skills/**, .github/workflows/**.

Tests

Tests first. Each new pin was run red before its fix.

  • audit-seal-sealer.test.ts, new describe per-chain isolation …:
    • A refused row in org_b's 08:00 window. The deployment chain and org_a are sealed at 08:00, 09:00 and 10:00. org_b is not. Every sealed_through stays at 08:00. One error line names the object, org:org_b, b1.payload and "NOT being sealed".
    • Once the row is fixed, org_b resumes: window checkpoints at 08:00 (seq 0) and 09:00 (seq 1), not late. A third pass writes nothing.
    • A malformed head (org_b's checkpoint root). org_a is sealed at 09:00 and 10:00, both with sealed_through 09:00. org_b is skipped with one error line naming root.
    • A storage fault (connection reset on org_a's insert) still stops the whole object: nothing is stored, and one object-level error line. This one is green before and after; it preserves the abort.
    • Verify stays loud: verifyAuditLedger over the first scenario answers ok: false, with totals unmodified: 2, late: 2, unsealed: 2. This is the verdict os audit verify exits 1 on.
    • Window-major (seat ruling 6885452378): org_a writes every hour for 30 hours, which is more windows than one pass seals, and org_b writes only at hours 0, 11, 23 and 29. After pass 1, both chains' newest window checkpoint is at 23:00. After pass 2, both are at 29:00, and there is no late checkpoint. It was green at first run, so no code change was needed: the pass is one loop over windows that seals every due chain under one shared budget. Giving org_b its own budget turns it red (Verification).
    • No late sweep (seat ruling 6885452378): org_x is skipped at 08:00 while org_a seals 08:00 and 09:00. In pass 2, org_x recovers into window checkpoints at 08:00 (seq 0) and 09:00 (seq 1), and the only late checkpoint is org_a's own late row at 08:00. It was green at first run, so no code change was needed. Restoring the old every-chain late rule turns it red (Verification).
  • audit-plugin.test.ts, new describe: takes the host provider when none was composed, and the sealer seals under it. Never overrides an explicit one. A one-shot host keeps the sealer off, and an app's armSealer: false stands. A host with no provider composes none, so the sealer is built without crypto and reports at error.
  • cli/src/utils/app-audit-plugin-host-crypto.test.ts: the real class with no provider is fed. An explicit provider is not replaced. A same-named lookalike with an adoptHostCryptoProvider of its own is never called. The class missing or no plugin feeds nothing. A one-shot host disarms the sealer.
  • serve-audit-registration.contract.test.ts: every existing assertion is kept. New: the hand-over call (exact spelling, with () => hostCrypto?.provider and !migrateAndExit) sits inside the stack plugins loop before await kernel.use(pluginToLoad);, and the real class is loaded ahead of the loop.

Acceptance notes

  • Ruled: verify for a window where the skipped chain is the only chain. The verifier today reads a window as sealed when a trusted window checkpoint names it, or when the window ends at or before the highest sealed_through. Ruling item 2 holds sealed_through at the skipped window. So if no other chain sealed that window, the skipped chain's rows there get no verdict. Seat ruling 6885452378 (option A) closes this in P4c: a window is also sealed when it starts at or before the highest window_start among trusted window checkpoints. The ADR-0154 D3 line is in docs(adr): ADR-0154 amendments — bounded checkpoints (D4) and the DB session seal lock (D3) #33489. Its two preconditions, a window-major pass and late never sweeping a lagging chain, are pinned in this PR (Tests).
  • A row whose created_at will not parse, when it is the oldest row of a span, is met by the window walk's firstRowAt before any chain is read. That still stops the object's pass, as before. In readWindow the same fault skips only its chain.
  • Cost while a chain is stuck. Each pass walks from the floor, so it re-reads the windows other chains already sealed past it until the stuck chain is fixed. This is bounded by how long the chain stays stuck. The cursor read fetches the window checkpoints at or past the floor. review#3 S1: bounding this re-walk is carried to P4b2.
  • A separately installed copy of @objectstack/plugin-audit in the app is a different class from the one the host loads, so an instance of it is treated as a lookalike and is not fed. Its sealer reports the missing provider at error.
  • OS_MIGRATE_AND_EXIT=1 with an app AuditPlugin that composed its own provider arms its sealer, as before. The ruling feeds only instances with no provider, so this PR does not touch them.
  • Stacked on P4a (fix(plugin-audit): redaction runs open each checkpoint once; the sealer re-reads before a late checkpoint and drops a lost sequence's seed #33476). Base is claude/area-A2-31908-p4a; the area thread retargets it to main once fix(plugin-audit): redaction runs open each checkpoint once; the sealer re-reads before a late checkpoint and drops a lost sequence's seed #33476 merges.

Verification

All readings were taken at head 4cbd2fca9 unless they name another commit; the follow-up block was taken at 22d4da3f6.

Red before the fixes
# 5ada48ff5 (sealer pins only)
× skips the chain of a row a canonical rule refuses, seals every other chain, and holds sealed_through at the skipped window
× resumes a skipped chain from its own oldest unsealed window, as window checkpoints and not late ones
× skips the chain whose head checkpoint is malformed, and seals the others past it
× keeps verify loud: the skipped chain's rows read unsealed and the verdict is not ok
Tests  4 failed | 30 passed (34)
os-verify-lock: VERDICT command-exit 1
# 03a059dad (plugin pins only)
TypeError: plugin.adoptHostCryptoProvider is not a function
Tests  4 failed | 25 passed (29)
os-verify-lock: VERDICT command-exit 1
# cli pins before the helper and the serve wiring
Error: Cannot find module './app-audit-plugin-host-crypto.js'
× hands the host crypto provider to an app-supplied AuditPlugin in the stack `plugins` loop, before the kernel takes it (seat ruling 6884540128 item 3)
Tests  1 failed | 7 passed (8)
os-verify-lock: VERDICT command-exit 1
Green: the full plugin-audit suite, and the CLI tests that read serve.ts
# pnpm --filter @objectstack/plugin-audit exec vitest run --maxWorkers=2
Test Files  93 passed (93)
     Tests  1511 passed (1511)
os-verify-lock: VERDICT command-exit 0
# pnpm --filter @objectstack/cli exec vitest run --project unit --maxWorkers=2 (every test file that reads serve.ts, plus the helper's)
Test Files  40 passed (40)
     Tests  600 passed (600)
os-verify-lock: VERDICT command-exit 0

48 files were named, and the unit project ran the 40 that are unit-tier. The rest are integration-tier, which CI's Test Core runs.

Follow-up pins (seat ruling 6885452378): green at first run, and each bites under ablation
# 22d4da3f6, sealer file: Tests 36 passed (36), VERDICT command-exit 0
# ablation: the sealLate accept against the chain's own cursor replaced by the every-chain rule (start before the pass end)
#   no-late-sweep pin red, expected 5 to be 3; Tests 3 failed | 33 passed (36); restored blob == HEAD (5e40b5178ea3)
# ablation: a separate per-pass budget for org_b in the window pass
#   window-major pin red, expected 25 to be 27; Tests 1 failed | 35 passed (36); restored blob == HEAD (5e40b5178ea3)
# full plugin-audit suite at 22d4da3f6: Test Files 93 passed (93), Tests 1513 passed (1513), VERDICT command-exit 0
Type-check, lint and gates
pnpm --filter '@objectstack/cli^...' build          -> VERDICT command-exit 0
pnpm --filter @objectstack/plugin-audit typecheck   -> VERDICT command-exit 0 (check:test-typecheck OK, 0 pinned)
pnpm --filter @objectstack/cli typecheck            -> VERDICT command-exit 0 (check:test-typecheck OK, debt unchanged)
eslint --no-inline-config (the eight changed source files) -> exit 0
node scripts/check-test-source-alias.mjs (pnpm check:test-source-alias) -> exit 0
dispatch-gates --ran: 99 derived, 22 run (each exit 0), 0 NOT-MEASURED, 77 left to CI

The 22 run locally: check-adr-0087-registration, check-changeset-no-major, check-empty-changeset, check-closing-keyword-parity, check-issue-citations (both), check-plugin-teardown-shape, check-tenant-audit-census, check-comment-mask-adoption, check:durability-log-level, check:startup-registry-verdict, check:nul-bytes, check:doc-authoring, check:engine-double-contract, check:test-source-alias, check:cross-package-test-inputs, check:optional-error-sink, check:system-context-census, check:keyed-text-bounds, check:undeclared-dep-imports, check:logger-receiver-detach and check:tier-file-adoption. The derivation is taken against main, so it includes P4a's files, and the spec families are mostly P4a's. CI's Lint & Repo Gates runs the rest.

Human Minimum

🤖 Generated with Claude Code

https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM

…, the keyset tie arm, and one opening per checkpoint per run

New pins, written before the fixes: a late checkpoint never lists a row
another sealer sealed since the pass read the window's lists (N1); the seed
of a checkpoint whose sequence another checkpoint holds is dropped (N2);
rows of one created_at straddling the page boundary are each read once
(S2 tie arm, N3); and one redaction run verifies each checkpoint and opens
each seed once, while still refusing every row a checkpoint that does not
verify, or whose seed does not open, lists.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…run; re-read a window's lists before a late checkpoint; drop a seed whose sequence another checkpoint holds

The redaction amendment writer verified every listed checkpoint, rebuilt its
root and opened its seed once per row (#32737). Each is now worked out once
per checkpoint per run and reused for every row it lists, the answer that
refuses included, so a checkpoint that does not verify, or whose seed does
not open, still refuses every row it lists.

The sealer re-read a chain's window head before a window insert only (S1).
A late checkpoint now re-reads the window's checkpoints once the chain head
is known and drops the rows already listed, so a row another sealer sealed
in between is not listed twice (N1). When a rejected insert reads back a
checkpoint at its sequence holding another seed, the seed it sealed can
never be stored and is dropped rather than left an orphan (N2).

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…the package registers sys_audit_amendment too

The comment still called sys_audit_amendment the one name in the group the
package does not register; AuditPlugin registers and provisions it beside
the checkpoints and the signing keys. Comment only. Adds the changeset for
this slice.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…lt skips only its chain, sealed_through holds, verify stays loud

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…lt skips only its chain, each chain resumes from its own cursor, sealed_through holds at a skipped window

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…s crypto provider, never over an explicit one

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…s provider when the instance was composed with none

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…d AuditPlugin, real class only

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…Plugin composed with none

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
…lation and the app AuditPlugin hand-over

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
@objectstack-fleet objectstack-fleet Bot added domain:server Domain lane — seat card indexed by label:pm:seat lease:A2 labels Nov 14, 2026
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tests tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 14, 2026
@github-actions

github-actions Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 2 package(s): @objectstack/cli, @objectstack/plugin-audit, touching 21 documentable anchor(s).

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

  • content/docs/data-modeling/objects.mdx (via AuditPlugin (symbol, a top-level class))
  • content/docs/permissions/record-view-auditing.mdx (via AuditPlugin (symbol, a top-level class))
  • content/docs/plugins/packages.mdx (via AuditPlugin (symbol, a top-level class))
  • content/docs/protocol/kernel/index.mdx (via AuditPlugin (symbol, a top-level class))

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

  • content/docs/releases/v17/17-1.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
  • 1 anchor(s) matched too much of the corpus to be a work list: os serve (command, 50 pages)
  • 6 name(s) were too generic to anchor anything (single lowercase words)
  • the SDK route bridge reached 65 of 247 client-bound route-ledger rows — the other 182 have no registrar path: tail to select them, so pages documenting THEIR client methods cannot appear above, on this or any run. Of those 182: 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; 123 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 — 45 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 8e63ed877771d6f3492309e596fb5422b3f0898e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 7e8cf4f1934db928891edf7407d23ce1b1df3ce1 — the merge of head 4412d2ffd37cc7c5f763f809115ae7695abfb895 into base 8e63ed877771d6f3492309e596fb5422b3f0898e, 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 7e8cf4f1934db928891edf7407d23ce1b1df3ce1 && git checkout 7e8cf4f1934db928891edf7407d23ce1b1df3ce1
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 8e63ed877771d6f3492309e596fb5422b3f0898e 4412d2ffd37cc7c5f763f809115ae7695abfb895 && git checkout -B drift-repro 8e63ed877771d6f3492309e596fb5422b3f0898e && git merge --no-ff 4412d2ffd37cc7c5f763f809115ae7695abfb895

node scripts/docs-audit/affected-docs.mjs --json 8e63ed877771d6f3492309e596fb5422b3f0898e

⚠️ 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 8e63ed877771d6f3492309e596fb5422b3f0898e → pass the list as
args.docs, on the commit named under Which tree this was computed on.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract-review-claim: session_016WV4d1PGptBW3QRQNmy5e6 · head 4cbd2fc · 2026-11-14T22:49:01Z

review#3.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Contract review

Served-tier: TIER_DEFAULT
Head-sha: 4cbd2fca9faeaa5e7ab0116e5ff068ad3ed46b13
Local-runs: none

I read the diff against the base branch claude/area-A2-31908-p4a at 3bcc3320 (#33476): 9 files. I checked it against seat ruling 6884540128 items 2 and 3.

① Derived judgments

  • Item 2 (S4): fault classes match the ruling. Only CanonicalFormError and SignedBodyError are chain-local:

    • a row a canonical rule refuses (readWindow);
    • a malformed checkpoint of the chain (headOf → ChainFault; listedIn → ChainFault for its own chain, skip for another; sealLate's holders).

    writeChains swallows only a ChainFault whose chainKey is the chain being written. Every other throw (lock lapse, signer, crypto, storage, Q6) still propagates and aborts the object's pass. A skipped chain stays out for the rest of the pass: readWindow and writeChains both test skipped.

  • Per-chain cursor. cursors is built from each chain's window checkpoints at or past the floor. cursorOf takes the max of the floor and the chain's cursor. A chain with nothing past the floor (a previously skipped one included) restarts at the floor, so it resumes as window from its own oldest unsealed window. sealLate treats a row as late only before its chain's cursor, which replaces the old resumed set.

  • sealed_through. The watermark passed in is max(watermark, min(start, stuckFrom())). It is evaluated after readWindow, so a skip met while reading that window already holds it back. A skip met while writing that window has from ≥ start, so sealed_through = start does not pass it either. It starts from the floor, so it never drops below it. This matches the ruling: it never advances past a window a skipped chain leaves unsealed.

  • The report. The error names the object, chain, fault and window. It repeats once per cause per REPORT_REPEAT_MS and is forgotten once the chain is sealed again.

  • Item 3, which matches the ruling. adoptHostCryptoProvider is taken only when options.cryptoProvider === undefined, so an explicit provider is never overridden. armSealer: false from the host only disarms; it never turns on an app's armSealer: false. handHostCryptoToAppAuditPlugin acts only on an instanceof the class serve itself imports, so it never feeds a lookalike. An app bundling its own copy of the class fails instanceof and is left alone, which is fail-safe. Nothing throws or refuses the boot. D3's once-at-error report still covers an instance left without a provider. The provider is read lazily at startSealer, after the hand-over at kernel.use.

  • Declaration. Clause-②: yes (widening), Metadata-protocol: none, patch on both packages. This is correct: AuditPlugin gains a public method, and the sealer seals strictly more than before (a chain-local fault used to stop every chain).

  • should-fix S1: re-read cost while a chain stays skipped. The floor stays at the skipped chain's window (by design). Every pass then walks every window from there to due, and a window whose rows all belong to chains already sealed past it does not count toward MAX_WINDOWS_PER_PASS. So while one chain stays faulty, each hourly pass re-reads every row of the object since that window, and the work grows by one window an hour without bound. Bound it, for example with a separate, larger cap on uncounted windows, or by seeking from the minimum per-chain cursor of the chains that still have rows. It is not a correctness fault, and the fix is the operator's, so it does not block this PASS. Track it in P4b2 or in a card.

② Semver level

@objectstack/plugin-audit: patch, @objectstack/cli: patch, Clause-②: yes (widening). This is correct for a non-protocol widening.

③ Boundary flags

Implemented-by: claude/area-A2-31908-p4b1
Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6

VERDICT: PASS

…n recovers into window checkpoints, never late ones

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
@github-actions github-actions Bot added size/l and removed size/m labels Nov 14, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Review carry — PASS stands

Head-sha: 22d4da3f6ea47cf704793e3012f02a5050f5f7ba

I read the delta 4cbd2fca...22d4da3f. It is test-only: two pins in audit-seal-sealer.test.ts, and sealer.ts is unchanged. The pins cover seat ruling 6885452378's preconditions:

  • Window-major. A dense chain and a sparse chain reach the same newest window checkpoint after each pass, with no late. The ablation (a per-chain budget) turns it red.
  • No late sweep. A skipped chain recovers into window checkpoints (seq 0 and 1), and the only late checkpoint is the healthy chain's own. The ablation (the every-chain late rule) turns it red.

My PASS at 4cbd2fca9faeaa5e7ab0116e5ff068ad3ed46b13 carries to this head (Regen-provenance: test-pin-only move). S1 is tracked to P4b2. Before landing, retarget the base to main; the ACCEPT re-reads every check at the landing head.

Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6 (review#3)

Base automatically changed from claude/area-A2-31908-p4a to main November 15, 2026 00:26
P4a merged into main as its own commit, so sealer.ts and
audit-seal-sealer.test.ts conflicted. Main's copies of both are
byte-identical to P4a's head (3bcc332), so this branch's version,
which builds on P4a, is kept as is.

Co-Authored-By: Claude <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016WV4cz2MxDkQYCC4U8indM
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

Review carry — PASS stands

Head-sha: 4412d2ffd37cc7c5f763f809115ae7695abfb895

This head is a merge of main at 8e63ed87 into the PASSed head 22d4da3f6ea47cf704793e3012f02a5050f5f7ba, made after P4a landed and the base moved to main. I compared what this PR changes on each side: the old base 3bcc3320...22d4da3f against 8e63ed87...4412d2ff. Every added and removed line is identical, so no source or pin of this PR changed. The PASS at 4cbd2fca, carried to 22d4da3f, carries to this head (Regen-provenance: merge-only move), and S1 still goes to P4b2. Before landing, every check at the landing head must be green.

Reviewed-by: session_016WV4d1PGptBW3QRQNmy5e6 (review#3)

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cz2MxDkQYCC4U8indM

ACCEPT: head 4412d2f

Landing: ready for review, then auto-merge (area rule for PRs that passed review, 2026-11-15T01:05Z).

@github-actions

Copy link
Copy Markdown
Contributor

⛔ merge queue 构建失败 — 先分诊,再决定要不要重排

队列构建 43671207320 红了。队列跑的是全量套件(PR 侧 CI 只跑 affected 子集),
所以失败的测试可能在本 PR 没碰过的包里 —— 那不是重排能修的。每次盲目重排都会让排在后面的所有 PR 重建一轮。

分类:failure —— 按下面的日志分诊。

失败的 job(日志抽取,best effort):

  • Dogfood Regression Gate (3/3) — 失败步骤: Boot example apps and exercise real user flows

    @objectstack/dogfood:test:  FAIL   isolated  test/settings-audit-global-rung-sibling.dogfood.test.ts > [18.x step 2] the settings audit trail's global rung is deployment-level > B. one home: sys_setti
      ↳ 失败原因: @objectstack/dogfood:test: Error: Test timed out in 5000ms.
    

↳ 失败原因 是判读的关键:超时(Test timed out in … / Hook timed out in …)多半是负载/时序,不是本 PR 的回归;
断言(AssertionError: …)才指向真实的行为改变。两者的 FAIL 行长得一模一样,只有这一行能区分。

⚠️ 断言这一侧有一类例外,判据是断言在测什么,不是它是不是 AssertionError。 断言的对象是产品行为(一个值、一个形状、一次拒收)⇒ 照上面读:真实的行为改变,去查,⛔ 不要重排掉;
断言的对象是这次实验自身的有效性前提(跑完的耗时、负载下的先后、任何只在时间预算内才成立的条件)⇒ 它跟超时是同一类,同样对负载敏感,重排一次是合法的判别手段。
识别是机械的:断言的消息或它比较的值本身点名了一段时长、一个时间戳、一个耗时计数。实测过的一对 —— AssertionError: SecurityPlugin.init() ran: expected false to be true 测的是产品行为(真回归);
AssertionError: this run took over a second, so second-precision stamps could have differed too: expected 1006 to be less than 1000 测的是实验前提:它守护的那条不变式当时是绿的,同一个 head 原样重排一次即成功。
穿着 AssertionError 外衣的时间测量,仍然是时间测量。(⛔ 这只改「怎么读一次红」,不改「哪些测试可以重排」——后者由别处管。)

跨 PR 相同签名(24h,按失败测试文件聚合):

  • test/settings-audit-global-rung-sibling.dogfood.test.ts — 24h 窗口内只有本 PR 撞到过,暂不汇总(再有一个不同 PR 撞到就会自动开汇总 issue)。
  • ⚠️ 24h 评论账本没读完(超过 5 页仍未读到窗口尽头),所以上面的「不同 PR 数」是下界,不是全量。

历史信号:

  • 本 PR 过去 24h 无队列失败记录(首次)。
  • 过去 24h 队列共有 12 个失败构建(不含本次)。

分诊清单:

  1. 失败测试在本 PR 改动的包里 → 真回归,修 PR。
  2. 失败测试与本 PR 无关 → 看上面的「跨 PR 相同签名」;已有汇总 issue ⇒ flaky/环境问题实锤,去那张 issue 上谈,修好前重排只会再烧一轮全队列。
  3. 两者都不是 → 可能与同组 PR 语义冲突;等前面的 PR 落地或失败出队后再重排一次即可,不要连续重排。

Generated by Claude Code · merge-queue-triage workflow (#4859)

Merged via the queue into main with commit 4f0a5f3 Nov 15, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/area-A2-31908-p4b1 branch November 15, 2026 04:13
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

domain:server#5 · os-elon-musk · session_016WV4cyNkH7W7e89m6j4aQq

Queue ejection triage: run 43671207320, read 2026-11-15T04:24Z

Signature (new, no ledger entry, first occurrence in 24h): Dogfood Regression Gate (3/3) / step "Boot example apps and exercise real user flows" / FAIL isolated test/settings-audit-global-rung-sibling.dogfood.test.ts › [18.x step 2] the settings audit trail's global rung is deployment-level › B. one home: sys_setting_audit refuses a global-scope row › a global-scope row is refused on scope, and the table still holds none / Error: Test timed out in 5000ms. (test:133, 5006ms; 1 failed, 1412 passed in the shard)

Verdict: load/timing flake, not a regression from this PR. Evidence:

  1. Import closure vs diff: not disjoint by import. The test composes new AuditPlugin() from @objectstack/plugin-audit, and this PR changes audit-plugin.ts and audit-seal/sealer.ts. The changed code does not run in this test, though:
    • adoptHostCryptoProvider is only called from packages/cli/src/commands/serve.ts. The test boots through @objectstack/verify bootStack, which does not depend on @objectstack/cli. So hostCryptoProvider stays unset and hostDisarmsSealer stays false, same as on main.
    • No object in packages/** or examples/** declares lifecycle.seal on the PR head. AuditSealer.runPass therefore returns at plans.length === 0, before it takes the lock, so the rewritten ObjectPass path (S4 chain isolation) is never reached. Across 8 local runs the log printed 0 AuditSealer lines, while 4482 INFO lines per run were visible. On any pass that reached the lock, the in-process-lock INFO line would have printed.
  2. Same shard on the queue base: green. Queue base 720b7caab70a (run 43669773378, job 132677437173 Dogfood Regression Gate (3/3)) ran 154 passed / 2 skipped, and this file passed (4 tests, 9410ms).
  3. First error: a timeout (Test timed out in 5000ms), not an assertion. The [driver-sqlite-wasm] Writing .../expand.db to disk failed (ENOENT ...) line printed right after it fits a stack.stop() flush that was still running when vitest moved on to afterAll's rmSync.

Local reproduction: same 3 files (this test plus settings-config-change-audit and upgrade-18x-harness), 4 runs each, under the verify lock on a shared box. Each run: 25/25 tests passed.

tree the timed-out test (ms) control test (ms)
origin/main 4c32b969 25, 41, 36, 29 9, 9, 13, 10
PR head 4412d2ff merged onto 4c32b969 (local b9c3292e; plugin-audit and cli rebuilt, PR code confirmed in dist) 28, 32, 24, 24 9, 10, 8, 9

Load on the ejected run: the shard's cumulative test time was 1232.86s, against 1143.38s on the base run (+7.8%).

Three-line receipt:

  • closure: shares an import with the diff (plugin-audit), but the changed paths never execute here: the host-crypto hand-over is CLI-only, and with no lifecycle.seal object there is no sealer pass. Measured: 0 sealer lines in 8 runs.
  • base shard: Dogfood Regression Gate (3/3) green on queue base 720b7caa (job 132677437173), and this file is green there.
  • first error: Test timed out in 5000ms, no assertion. Locally the test takes 24-41ms on both trees, so the timeout is about 150 times the measured runtime.

Not re-enqueued from here. landing-operations.md requires K before arming: K = git rev-list --count --first-parent PRBASE..origin/main, where PRBASE is 8e63ed877771 (the Affected-set diff base that Test Core printed on green PR run 43658226056). K is 57, at or above the 15 threshold, so main has to be merged and the PR checks re-run green before this PR is enqueued. That merge moves the head off review#3's PASS (4412d2ff), so the area thread handles the merge, the review carry and re-arming. A local merge onto 4c32b969 applied cleanly (one auto-merged file, serve.ts). main has moved since then.

Suspected new flaky signature, for the ledger owner (proposed here, not added to the ledger): the test's 5000ms default budget covers an insert plus a full stack.stop() with an SQLite flush.


Generated by Claude Code

scbdzhwl pushed a commit to scbdzhwl/objectstack-analysis that referenced this pull request Nov 16, 2026
…rows, and bound the idle re-walk (P4b2) (objectstack-ai#33637)

<!-- claude-projects-attribution: {"github_login":"os-elon-musk"} -->
_Requested by **Elon** · [project
thread](https://claude.ai/code/project/chan_01WedDzV26nniwxv7jC88B9D?thread=cmsg_01WedDzV26nniwxv7jC88B9DXuamRUC67fx2TTYrFfyuSH)_

Part of objectstack-ai#31908 (slice P4b2)
Blocked-by: objectstack-ai#33489 (governed ADR-0154 amendment; merged to `main` as
8f915f2, which this branch now contains)

Clause-②: yes (narrowing) — narrowed: `os audit verify` reports a row id
that two checkpoints list as the new chain fault `listed_twice` and
fails the run, where the 18.4.0 verifier accepted it, and the 18.4.0
sealer could write such a chain when two of its late sealings
overlapped. Widened: two optional signed-body fields (`part_index`,
`final_part`), two nullable `sys_audit_checkpoint` columns for them, and
the `AuditChainFaultKind` member `listed_twice`.
Metadata-protocol: none
Skills-docs: follow-up objectstack-ai#33773 —
skills/objectstack-data/evals/objects-fields-relationships.json,
skills/objectstack-data/rules/lifecycle.md — both still teach that the
sealer signs each `created_at` hour into one checkpoint per
organization, where this change cuts a window into checkpoints of at
most 10,000 rows each (the eval's graded `expected_output`, and
`lifecycle.md` § Sealing); the card also carries their older stale claim
that no verifier exists, which `os audit verify` already contradicts.
`skills/**` is changed only on a `domain:skills` PR, so this one does
not edit them; `content/docs/data-modeling/objects.mdx` and
`content/docs/deployment/cli.mdx` gain the parts, the new fault and what
a removed checkpoint shows in this change.

**BREAKING** for `os audit verify` on a chain that an 18.4.0 sealer
wrote while two of its late sealings overlapped (two replicas with no
cluster service, whose lock is in-process only, or a lease that lapsed).
Such a chain lists one late row in two checkpoints. Verify now reports
it as `listed_twice` and fails, where it passed. No tolerance and no
repair ships for it (seat ruling 6888674846 item 1). A chain one sealer
wrote at a time is not affected. ADR-0087 disposition, in the changeset:
`not-required (no-migration-prescription)`. `@objectstack/plugin-audit`
stays `patch`, because `Metadata-protocol: none`.

## Maintainer quick read

- **What changed:** the audit sealer now seals each organization's hour
of audit rows into checkpoints of at most 10,000 rows each, instead of
one checkpoint of any size. `os audit verify` now fails when two
checkpoints list the same row. While one organization's chain is stuck,
a pass stops re-reading old windows after 168 windows that seal nothing,
and once no chain is stuck the walk is not cut, so sealing catches up.
- **Why:** one busy hour made one huge checkpoint, so the work and
memory of a single seal grew without limit. And while one chain stayed
stuck on a bad row, every hourly pass re-read every row since that
window. Seat ruling 6884540128 item 1 (S7) and review#3 S1 on objectstack-ai#33503 ask
for both bounds.
- **Risk and rollback:** this changes how new checkpoints are cut, not
the insert path. Checkpoints written before this release still verify,
as one final part. Upgrading is one way once this release writes a
checkpoint: an 18.4.0 verifier fails the signature of every checkpoint
that carries the two new fields, and an 18.4.0 sealer's next checkpoint
is a `link` fault. No object opts into sealing by default, so this only
matters for an app that declared `lifecycle.seal`.
- **Look first:**
`packages/plugins/plugin-audit/src/audit-seal/sealer.ts` (the walk in
`run` and what counts toward the idle cap, the S1 re-check in
`writeCheckpoint`, `writeChain`, `leavesOf`), then `signed-body.ts`
(`checkpointPartOf` and the part docblocks), then `verifier.ts`
(`listed_twice` in `judgeCheckpoint`).
- **Two-minute check:** `pnpm --filter @objectstack/plugin-audit exec
vitest run --maxWorkers=2 src/audit-seal/audit-seal-sealer.test.ts`:
expect 52 passed, including the "bounded checkpoints" and "uncounted
re-walk" groups.
- **What you need to do:** nothing: objectstack-ai#33489 has merged, and the seat
lands this once review passes.

## What changes

**S7: bounded checkpoints (ADR-0154 D4 as amended in objectstack-ai#33489).**
- A chain's window seals into consecutive checkpoints of at most
`AUDIT_SEAL_MAX_LEAVES = 10_000` leaves. N is a fixed exported constant,
not a knob. The internal `AuditSealerOptions.maxLeaves` is a test seam
beside `now`. `AuditPlugin` never passes it, and the sealer is not
exported from the package.
- Parts are cut in D1 order, `(created_at, id)`, and each part's leaves
are in that order. Each part draws its own seed (D2), so one seed still
covers one checkpoint.
- A window is read twice: once for each row's id and canonical
`created_at`, then each part's rows by id, in `$in` batches of 500,
hashed under that part's seed. So one checkpoint's hashing, ids, body
and memory are bounded by N. A row deleted or moved between the two
reads is left out of its part.
- The signed body gains `part_index` (from 0) and `final_part`.
`sys_audit_checkpoint` stores them in two new nullable columns.
- Resume: a chain whose newest `window` checkpoint is not final resumes
that window as further `window` parts. They continue its part count and
seal only rows no checkpoint lists yet. They are never sealed as `late`.
- `late` sealings split the same way. A late part's index counts within
that one late sealing (the prose line for this is on objectstack-ai#33489, seat ruling
6888674846 item 2).
- The sealer's S1 check ("not sealed twice") is relaxed for parts. A
`window` part is refused when the chain already holds a later window, a
part of this window at this index or past it, or a checkpoint of this
window written before the amendment (NULL part index).
- `os audit verify` faults a row id that two checkpoints list, as the
new fault kind `listed_twice`. The second listing holds nothing for that
row.
- Compatibility: a checkpoint with neither field (written before this
release, NULL columns) reads back without them. Its signed bytes are
unchanged, so it verifies and reads as one final part. A body with one
field and not the other is refused.

**What verify does and does not see of a removed part (seat ruling
6888674846 item 3).** Verify adds no continuity check and no final-part
check. The chain links expose a removed *interior* part, as a `gap` or a
`link` fault. They do not see a removed *newest* part; its rows are
reported as late and unsealed instead, because a surviving part of the
same window still names that window as sealed. A final part cannot be
required, because `writeChain` skips a part whose rows all went between
the two reads: `part_index` can then skip a number, and a window whose
last part emptied has no final part.

**review#3 S1: bounded idle re-walk.** The separate cap
`AUDIT_SEAL_MAX_IDLE_WINDOWS_PER_PASS` (168, one late horizon of
windows) counts windows that seal nothing, and only while a chain is
skipped in the pass. A pass that has walked that many stops walking, and
the sealer reports it at `error`, naming the skipped chains. With no
chain skipped the walk is not cut, so it reaches the next window that
seals something and the floor moves past the rest.

Why the cap and not the seek. Seeking from the minimum per-chain cursor
is only correct if the sealer knows every chain that still has rows.
Per-chain cursors exist only for chains with a `window` checkpoint at or
past the floor. Two kinds of chain are missing from that set:
- a chain skipped at a later window than the one holding the floor;
- a chain with no checkpoint since the floor.

Neither is recorded anywhere durable. A seek would pass over their
windows, and once the floor moved their on-time rows would seal as
`late`. That breaks S4's rule that a skipped chain resumes "from its own
oldest unsealed window" as `window` checkpoints. The cap never changes
how a row seals, only when. Its cost: after about a week of a chain that
stays skipped, chains past the cap wait for it, and that is loud.

The window-major pin and the no-late-sweep pin from P4b1 are unchanged
and green.

**Docs.** `content/docs/data-modeling/objects.mdx` said each hour seals
into one checkpoint per organization; it now says one checkpoint, or
consecutive checkpoints of at most 10,000 rows.
`content/docs/deployment/cli.mdx` gains what verify shows of a removed
checkpoint, and its exit code 1 entry now names a row that two
checkpoints list.

**Spec.** The signed body is declared in `plugin-audit`
(`audit-seal/signed-body.ts`), not in `packages/spec`. There is no Zod
schema, generated JSON schema or reference doc for it, so nothing in
spec is regenerated.

## Round 2: what each item of review#3 got

- **M1** (ff13294): the changeset and this body declare `Clause-②: yes
(narrowing)`, carry the BREAKING banner, and the changeset holds one
ADR-0087 marker, `not-required (no-migration-prescription)`, stating
that a chain sealed by 18.4.0 with overlapping late sealers now reports
`listed_twice`. `Metadata-protocol: none`, so `patch`. No tolerance or
heal code.
- **M2** (6bb7f49, ff13294, this body): the wording above, in the
`part_index` / `final_part` docblocks and in the changeset. Pinned: a
removed interior part is a `gap`, and a removed newest part reads
unsealed with no chain fault.
- **N1** (ff13294): the one-way upgrade note is in the changeset.
- **N2** (6bb7f49): the S1 re-check's `$or` gains `{ window_start in
this window, part_index: { $null: true } }`. The seal-store testkit now
judges a `where` as SQL does (a comparison with a NULL column is never
true, and `$null` is `IS NULL`), so the pin is red without the arm.
- **N3** (b189644, e930216): the five pins asked for, plus an emptied
middle part. See Tests.
- **N4** (6bb7f49): the `part_index` docblock says the count may skip
an emptied part.
- **Found while pinning N3's last item, fixed here** (6bb7f49): the
idle cap never let go. It counted every window that sealed nothing,
skipped chain or not. Once the stuck chain was fixed, the windows the
cap had left behind still counted, so the walk stopped short of the next
window that seals something again. No checkpoint was written, the floor
never moved, and the object never sealed past the cap. That held whether
the stuck row was corrected in place or deleted. The cap now counts only
while a chain is skipped in the pass.
- **Docs** (f08afca): the two pages above, which this PR had made
false or incomplete, and the changeset's `Skills-docs:` line that the
`(narrowing)` arm owes.
- The base moved to `main` after objectstack-ai#33503 merged; `origin/main` is merged
in (faadaaa, then 60960cd, which brings in objectstack-ai#33489), and this PR's
diff against `main` is P4b2 alone.
- b234eee (another agent, test-only): a 30 s budget on the three
stalled-chain re-walk tests, after a Test Core timeout. The local runs
below predate it.
- 5ef334e merges `main` again (412fbf7); the full dogfood battery at
5ef334e ran green, 467 test files and 3958 tests. 55dfebc (review#3
record 6891899947, M1): the changeset's `Skills-docs:` line and this
body's now name the filed follow-up card, objectstack-ai#33773, in place of `follow-up
owed` and `none`.

## Why

Seat ruling 6884540128 item 1 (S7), with the ADR-0154 amendment in
objectstack-ai#33489. review#3's should-fix S1 on objectstack-ai#33503 (comment 6885454935).
review#3 on this PR (comment 6888713592) and seat rulings 6888674846.

## Tests

Each new pin that covers new behaviour was run red before its fix.

Round 1: the pins were committed first (4827322), the implementation
files were set back to the base, and the pins were run. 10 failed: the
seven S7 sealer pins, the duplicate-id verifier pin, two signed-body
pins, and the idle re-walk pin, which read **200** windows in one pass
before the cap. The pin "a checkpoint written before the amendment still
verifies" was run red against the first implementation, before the
compatibility fix in 0dd58a8.

Round 2: the pins were committed first (b189644, then e930216 for one
precondition) and run against the round-1 implementation, on the tree
merged with `main`:
- red: the pre-amendment S1 pin (`expected 1 to be +0`: a second
`window` checkpoint listing `r1` was written);
- red: both re-seal pins after the idle cap, once the stuck row was
fixed in place and once it was deleted (`expected [ 'a0', … (182) ] to
deeply equal [ 'a0', … (197) ]`, and the same with 181 and 196: 15 of
org_a's rows never sealed);
- green, as they pin behaviour round 1 already had: the tie across a
part boundary, a row deleted or moved between the reads, an emptied
middle part, an emptied last part and its resume, and the removed
interior and newest parts.

New pins this round, in `audit-seal-sealer.test.ts`:
- A window part is refused beside a pre-amendment checkpoint of that
window that another sealer wrote after this pass read the window (NULL
part columns, re-signed without the keys); the error names the part, and
the ledger verifies.
- A `created_at` tie that straddles a part boundary cuts the same way
whichever order the rows were written in: the id decides the side.
- A row deleted, or moved to the next window, between the two reads is
left out of its part; the moved row seals in its new window.
- A middle part that empties between the reads is skipped without taking
its index: parts 0 and 2.
- A last part that empties leaves the window with no final part; the
next pass writes nothing, and a row that arrives in that window
afterwards is `window` part 1, final, never `late`.
- A removed interior part is a `gap` fault and its rows read unsealed; a
removed newest part raises no chain fault and its rows read unsealed.
- After the idle cap was hit, the whole object seals again once the
stuck chain's row is fixed in place, and once it is deleted: every row
is listed exactly once, none as `late`, and the second case verifies ok.

<details><summary>plugin-audit suite at f08afca, merged with main at
8f915f2 (under os-verify-lock)</summary>

```
pnpm --filter @objectstack/plugin-audit test && pnpm --filter @objectstack/plugin-audit typecheck
 Test Files  94 passed (94)
      Tests  1541 passed (1541)
check:test-typecheck: OK — @objectstack/plugin-audit's test layer compiles under packages/plugins/plugin-audit/tsconfig.test.json
os-verify-lock: VERDICT command-exit 0 · held the lock 146s (2m26s)
```
</details>

<details><summary>The round-2 red runs, before 6bb7f49 (under
os-verify-lock)</summary>

```
vitest run src/audit-seal/audit-seal-sealer.test.ts   (at faadaaa, tests of b189644)
  × refuses a window part when the chain, re-read under the lease, holds a checkpoint of that window written before the amendment ... (S1, N2)
      AssertionError: expected 1 to be +0
  × seals the whole object again once the skipped chain is fixed ...      (failed on its precondition, corrected in e930216)
  × seals the whole object again once the skipped chain has nothing left to seal ...
 Tests  3 failed | 49 passed (52)

vitest run src/audit-seal/audit-seal-sealer.test.ts -t "uncounted re-walk"   (at e930216)
  × seals the whole object again once the skipped chain is fixed ...
      AssertionError: expected [ 'a0', 'a1', 'a10', 'a100', …(182) ] to deeply equal [ 'a0', 'a1', 'a10', 'a100', …(197) ]
  × seals the whole object again once the skipped chain has nothing left to seal ...
      AssertionError: expected [ 'a0', 'a1', 'a10', 'a100', …(181) ] to deeply equal [ 'a0', 'a1', 'a10', 'a100', …(196) ]
 Tests  2 failed | 1 passed | 49 skipped (52)
```
</details>

## Acceptance notes

- **Part index of a `late` part** counts within the one late sealing
that wrote it. A second late sealing of the same window starts at 0
again. Seat ruling 6888674846 item 2 accepts this; its prose line is on
objectstack-ai#33489.
- **A part whose rows all went** between the two reads is not written
and takes no index, so `part_index` can skip a number. If that was the
last part, the window has no final part; the next pass resumes it, and a
row that arrives in it later seals as the next `window` part. Verify
checks neither part continuity nor a final part. The chain links show a
removed interior part as a `gap` or `link` fault; they do not show a
removed newest part, whose rows read unsealed instead. When the removed
checkpoint was the only one naming the object's newest window, that is
ADR-0154's head truncation, which this check alone cannot see.
- **Rows moved between the two reads** (a changed `created_at` or
`tenant_id`) are left out of the part. They are sealed later in their
new window (as `late` if that window is already sealed), or the verifier
reports them.
- **The S1 re-check against a pre-amendment checkpoint** matters only
when a sealer of an earlier release runs beside this one during a
rolling upgrade with no cluster lock; the unique `(sealed_object,
chain_key, sequence)` index does not cover it, because the later pass
reads the chain head after the other sealer's insert.

## Verification

All local runs below were at head f08afca, the tree merged with `main`
at 8f915f2, except the direct dependents: I ran them at ff13294
(merged with `main` at d95ddeb), and the A2 landing step that merged
`main` in ran them again at 60960cd, which differs from f08afca only
in two docs pages and the changeset (cli unit 421 files / 5979 tests,
verify 51 / 437, service-storage 86 / 1651 passed and 1 skipped,
plugin-security 267 / 6681 passed and 45 skipped, service-automation 282
/ 3976; all exit 0).

- `pnpm --filter @objectstack/plugin-audit typecheck`: exit 0. Tests are
included through `check:test-typecheck`.
- eslint `--no-inline-config` on the 8 changed source and test files:
exit 0.
- `node scripts/check-test-source-alias.mjs`, `node
scripts/check-nul-bytes.mjs`: exit 0.
- `check-adr-0087-registration --base origin/main`: exit 0, one
declared-breaking changeset, `not-required (no-migration-prescription)`.
- `check-changeset-no-major --base origin/main` with this body as the
`pull_request` payload: exit 0, "declares clause-② `yes (narrowing)` and
metadata-protocol `none` ... a non-protocol change at `patch`".
- Direct dependents of `@objectstack/plugin-audit`, after building their
closure: `typecheck` exit 0 for `cli`, `verify`, `service-storage`,
`service-automation` and `plugin-security`. Tests: `cli` unit layer 421
files / 5972 tests passed (its integration layer is CI's); `verify` 51 /
437; `service-storage` 86 / 1641 passed, 1 skipped; `plugin-security`
267 / 6679 passed, 45 skipped; `service-automation` 282 / 3959. All exit
0.
- `dispatch-gates --commands`: 97 derived on this tree (the docs pages
add 31 doc families), all run. 96 exit 0, including
`check:doc-authoring`, the `docs-audit` checks, `check:i18n`,
`check:dts-closure` and `check:dual-build-cjs-loads`. 1 exits 3,
PREREQUISITE NOT MET, so NOT MEASURED: `check-plugin-teardown-shape
--self-test` (needs an unshallow clone; its scan is green).
`dispatch-gates --ran` with the exit codes: 97 derived, 96 run, 1
NOT-MEASURED, 0 UNRUN.
- Full dogfood battery (owed by the `(narrowing)` arm): at ff13294,
`pnpm --filter @objectstack/dogfood test` under os-verify-lock gave
`Test Files 467 passed | 3 skipped (470)`, `Tests 3953 passed | 42
skipped`, `VERDICT command-exit 0` (28m49s). NOT MEASURED at f08afca:
the re-run was stopped during its closure build when the area thread
asked for the report. Since ff13294 this branch gained the `main`
merge, two docs pages, the changeset line and the test-only b234eee,
and no change to this PR's code.
- CI at ff13294: `TypeScript Type Check`, `Lint & Repo Gates`, `Check
Changeset`, `Build Core`, `Governed Surface Queue Guard` and the eight
`Test Core` shards concluded success. The reds on b189644, faadaaa and
6bb7f49 were lanes concluded `cancelled` by my next push (no `error TS`
in those logs), not failures. CI at f08afca is in the round-2 report
on objectstack-ai#31908.

## Human Minimum

- [x] 1. Schemas start as Zod; `packages/spec` holds no runtime logic.
(spec not touched)
- [x] 2. Every name I added uses the casing for its kind.
- [x] 3. No formatter ran; eslint is green on the changed files (`pnpm
lint` is CI's).
- [x] 4. One issue, one branch off an up-to-date `main`, one pull
request.
- [x] 5. A change that publishes carries a changeset, and both
declaration lines are filled in here and in the changeset.
- [x] 6. `packages/spec` touched: n/a.
- [x] 7. No hand edits to `content/docs/references/`,
`packages/*/CHANGELOG.md` or `content/docs/releases/`.
- [x] 8. Title, body and comments are in English.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_016WV4cyNkH7W7e89m6j4aQq

<!-- signed: domain:server#5 · os-elon-musk ·
session_016WV4cyNkH7W7e89m6j4aQq -->

---------

Co-authored-by: Claude <noreply@anthropic.com>
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 size/l 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.

2 participants