Skip to content

fix(plugin-audit): a registered audit seam that fails to resolve stops the sealer instead of falling back - #34495

Merged
objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-qajjjq
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 1 commit into
mainfrom
claude/project-thread-qajjjq

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34280

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么: 审计封存器每轮取宿主的签名服务、导出服务和集群服务时,分清三种情况:没注册就用本机兜底(和以前一样);注册了能取到就用;注册了却取不到(比如 KMS 客户端起不来)就这一轮不封存,并报一条 error 点名哪个服务。
  • 为什么改: 以前「取不到」被当成「没注册」,于是悄悄改用本机密钥签名、悄悄不导出、悄悄不加集群锁,没有任何日志;客户以为是 KMS 签的,其实不是。另外用工厂方式注册的签名服务以前根本取不到,也被悄悄忽略。
  • 风险与回滚: 只影响注册了这三个服务的宿主;配置坏掉的宿主从「悄悄降级」变成「停止封存并报错」,配置正常的宿主无变化。回滚即还原本 PR。
  • 先看: packages/plugins/plugin-audit/src/audit-seal/sealer.ts 的 resolveSeams;packages/plugins/plugin-audit/src/audit-plugin.ts 末尾的 hostSeamResolver。
  • 两分钟验证: cd packages/plugins/plugin-audit && npx vitest run src/audit-seal/audit-seal-host-seam-resolve-34280.integration.test.ts,预期 5 条全绿。
  • 需要你做的: 无,席位落地。

What changes

  • audit-seal/sealer.ts: a pass resolves its three host seams (audit.checkpointSigner, audit.checkpointSink, cluster) once, at its start, in resolveSeams(). A getter that answers undefined means "not registered" and keeps its stand-in (local signer, no export, in-process lock). A getter that throws means "registered and not resolvable": the pass seals nothing and reports at error, naming the slot and the fallback it refused, once per REPORT_REPEAT_MS while it lasts (the sealer's existing report() discipline). The resolved sink and cluster are handed to the lock and the object passes; the lock no longer absorbs a throwing cluster getter, and delivery no longer re-resolves the sink per checkpoint. A sink whose deliver() fails is still only a warning, unchanged. The getters may now return a promise; AuditSealer is not exported from the package root.
  • audit-plugin.ts: startSealer resolves each seam with hostSeamResolver, which uses the kernel's async accessor and absorbs only the branded "never registered" rejection (isServiceNotRegisteredError, @objectstack/core), the pattern service-automation already uses for tenancy. Every other rejection propagates. The async accessor also builds a factory-registered seam, which the sync accessor refused with "is async" and the old helper read as absent. A host with no async accessor (LiteKernel, no factories) keeps the sync accessor, where "not registered" is the only fault.

Tests

New src/audit-seal/audit-seal-host-seam-resolve-34280.integration.test.ts, on a real ObjectKernel with ObjectQL over SQLite (wasm):

  1. No host signer: one checkpoint, signed under the local key (its fingerprint is the only sys_audit_signing_key row); no error.
  2. Host signer registered as a factory that throws: runPass() → 0, no checkpoint, no local key created, exactly one error naming audit.checkpointSigner and "does not sign with the local key"; a second pass adds no second line.
  3. Host signer that resolves, as an instance and as a factory: the checkpoint carries the host key id and verifies under the host public key; no local key created.
  4. Sink factory that throws: nothing sealed, one error naming audit.checkpointSink; a resolving sink factory is handed the checkpoint.
  5. Cluster factory that throws: nothing sealed, one error naming cluster.

Ablation (fix reverted, test kept): cases 2–5 red (expected 1 to be +0 for 2/4/5; case 3's factory leg signs under the local key), case 1 green.

No existing test changed. plugin-audit: 100 files / 1659 tests green; pnpm typecheck (incl. check:test-typecheck) green.

Acceptance notes

  • Narrowing declaration (the card asks the dev to measure it): Clause-②: no. No key, config value or service shape a host writes is refused; what changes is the reaction to a registration that already fails. A host whose signer, sink or cluster registration threw used to seal silently with the local key or without its lock and now seals nothing until it is fixed, which is the card's rule. A working host sees no change. The changeset says this in its last paragraph.
  • Same-family site, not changed here (out of the claimed file surface): packages/cli/src/utils/audit-redaction-seal.ts resolves audit.checkpointSigner / audit.checkpointSink with the same catch-all helper, so a CLI redaction run with a failing host signer falls back to the local signer in amendment-writer.ts. Handed to the seat for a follow-up card.
  • "Logged once": the line repeats at most once per REPORT_REPEAT_MS while the fault lasts, as every other sealer fault does; the test pins that a second pass inside the window adds no line.

Verification

Gates per node scripts/pm/dispatch-gates.mjs --commands after the last commit: see the os-dev-report comment on #34280.

…s the sealer instead of falling back

The sealer resolved audit.checkpointSigner, audit.checkpointSink and
cluster through a helper that turned every resolution error into "not
registered", so a host signer whose factory threw was silently replaced
by the local key, a failing sink dropped the export, and a failing
cluster service let the pass run on the in-process lock. It also used
the sync accessor, which cannot build a factory-registered seam.

Seams now resolve once per pass through the kernel's async accessor,
three-state: never registered => the stand-in, as before; registered
and resolved => used (factories included); registered and failing =>
the pass seals nothing and reports at error, naming the slot.

Claude-Session: https://claude.ai/code/session_01ADHkmRPxhTmqbUbMrqygh4
Co-authored-by: Claude <noreply@anthropic.com>
@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 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-audit, touching 10 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))

⛔ 2 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/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
  • 5 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 — 12 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 495a79c7b38c82b4ca4c840b387626b6a1a4b16e → packageMentionDocs.

Which tree this was computed on

This run read content/docs from 10520036599bdf242ebb1eaeead9b5cc76fea424 — the merge of head 34600be3f54e9a41bffd21abc8b52ff3be4bb86c into base 495a79c7b38c82b4ca4c840b387626b6a1a4b16e, 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 10520036599bdf242ebb1eaeead9b5cc76fea424 && git checkout 10520036599bdf242ebb1eaeead9b5cc76fea424
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 495a79c7b38c82b4ca4c840b387626b6a1a4b16e 34600be3f54e9a41bffd21abc8b52ff3be4bb86c && git checkout -B drift-repro 495a79c7b38c82b4ca4c840b387626b6a1a4b16e && git merge --no-ff 34600be3f54e9a41bffd21abc8b52ff3be4bb86c

node scripts/docs-audit/affected-docs.mjs --json 495a79c7b38c82b4ca4c840b387626b6a1a4b16e

⚠️ 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 495a79c7b38c82b4ca4c840b387626b6a1a4b16e → 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

repo:objectstack#2 · os-steve · session_01ADHkmRPxhTmqbUbMrqygh4

Final head for review: 34600be3f54e9a41bffd21abc8b52ff3be4bb86c · 2026-11-16T23:50Z

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQVWXw7KT8ThxT4CBy

席位核对

L1 verdict: ACCEPT · PR #34495 · card #34280 · first review · read 2026-11-16T23:51Z

Head-sha: 34600be3f54e9a41bffd21abc8b52ff3be4bb86c (the head named in final-head comment 6932977335)

Read from GitHub at this head (get_files, diff, check-runs), not from the report.

Checklist

  • Shape: draft, base main; the body opens with the attribution lines and then Fixes #34280. The whole card is delivered. No other card number is in the body.
  • Scope: 4 files: plugin-audit/src/audit-plugin.ts, audit-seal/sealer.ts, one new integration test, and a root changeset. No content/docs/releases/. The docs-drift advisory names pages only through the AuditPlugin symbol; none of them states the seam-resolution rule changed here.
  • Changeset: root, patch for @objectstack/plugin-audit (published). I checked each sentence against the diff:
    • "It turned every resolution error into 'not registered'" matches main's optional() helper, whose bare catch returned undefined.
    • "A seam registered as a factory was never built at all, because the sealer used the synchronous accessor" matches the old ctx.getService; the new hostSeamResolver uses kernel.getServiceAsync.
    • "only an absent seam falls back" matches: only isServiceNotRegisteredError (exported from @objectstack/core) maps to undefined, and every other rejection rethrows.
    • "stops the pass … reports it at error, naming the slot, once while it lasts. Each pass retries" matches resolveSeams() returning null, runPass answering 0, report('resolve:<slot>'), and the key cleared on the next successful resolve.
  • Tests: the new file runs a real ObjectKernel with ObjectQL over SQLite (wasm), with 5 cases. Case 1 is the control (absent seam, local key, no error); it also proves the branded not-registered path on a real kernel, since no sink or cluster is registered in it. The absorbing cases assert 0 checkpoints, no local key minted, and one error line naming the slot, and none on a second pass. The recorded ablation (fix reverted, test kept) turns cases 2–5 red and leaves case 1 green.
  • Gates: 51 check-runs on this head, all completed: 35 success, 16 skipped, 0 failed. Lint & Repo Gates success, TypeScript Type Check success, Test Core 1–8 success, Build Core success, Check Changeset success, Governed Surface Queue Guard success. The skips are the UI and opt-in jobs a server-only diff does not trigger.

Spot checks (mine)

  1. AuditSealer and AuditSealerOptions are not re-exported from src/index.ts or src/audit-seal/index.ts, and the package exports map has only .. So the option getters' widened return type (T | Promise<T>) is not a published-surface change.
  2. Seams are now resolved once per pass and handed down. acquireLock(cluster) no longer swallows a throwing getter, and ObjectPass.deliver uses the pass's resolved sink. A sink whose deliver() rejects is still only a warn, as on main.
  3. Ordering: plans() returns first, so a deployment with nothing to seal never resolves seams and gets no new error line.
  4. Without crypto and without a host signer, signer resolves to undefined and the existing no-crypto report fires, unchanged.

Narrowing declaration: agreed, Clause-②: no with no (narrowing) arm. No key, config value, or service shape a host or author writes is refused. What changes is the reaction to a registration that already fails at resolution: a silent fallback becomes a stopped pass with an error line. That is the card's rule. A host with a working registration sees no change. A factory-registered seam that resolves is now used where it was ignored, which repairs the stated D11 contract rather than widening it. Metadata-protocol: none is right too: nothing a metadata author writes changes.

Outside this PR, owed: packages/cli/src/utils/audit-redaction-seal.ts still resolves AUDIT_CHECKPOINT_SIGNER_SERVICE / AUDIT_CHECKPOINT_SINK_SERVICE through a catch-all helper (bare catch at :60, consumed at :67), so a CLI redaction run with a failing host signer still falls back to the local signer. It is outside the claimed file surface, so it is correctly left alone here; the seat files the follow-up card.

L2 owed: no. None of the four contract faces is touched: Clause-②: no, no narrowing (agreed above), no packages/spec/src/** path, no governed rule text.

Landing tier: check-governed-merges.mjs --pr 34495 reports 0 of 4 paths governed and +326/−30 = 356 lines ≤ 3000. Ordinary queue landing by the area at this head.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmRPxhTmqbUbMrqygh4

Landing at 2026-11-16T23:52Z — L1 ACCEPT 6933008071 on head 34600be3f54e9a41bffd21abc8b52ff3be4bb86c (the head this lands); no L2 owed (L1 reading).

probe reading
check-governed-merges.mjs --pr 34495 NOT governed: 0 of 4 paths hit the register; 356 changed lines (+326 / −30) ≤ 3000
CI on the head 35 success, 16 skipped, 0 failed or pending; mergeable state clean

Ready and auto-merge armed in this stroke; the merge queue lands it, and Fixes #34280 closes the card on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 16, 2026 23:53
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 16, 2026
Merged via the queue into main with commit 23a07c8 Nov 17, 2026
52 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/project-thread-qajjjq branch November 17, 2026 00:42
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 size/m 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.

audit seal: a host checkpoint signer that fails to resolve stops the sealer instead of signing with the local key

2 participants