docs(kernel): correct the audit-write failure report granularity to once per cause - #19212
Merged
Merged
Conversation
…nce per cause `content/docs/kernel/runtime-services/audit-service.mdx` described the failed ledger insert of `recordAuthEvent` as reported at `error` level "once per process", with every later failure dropping to `debug`. That stopped being true when the auth-event sink's dedupe was re-keyed from a process-wide boolean to a per-cause key in `packages/plugins/plugin-audit/src/auth-event-audit.ts`. The bullet now states the real granularity: once per cause, a cause being the error `code` plus the object the row is about; a repeat of an already-reported cause still degrades to `debug`, and a new cause gets its own `error` line once. Claude-Session: https://claude.ai/code/session_017ef78bLdybu3AffehKkhfk Co-authored-by: Claude <noreply@anthropic.com>
os-try-charles
marked this pull request as ready for review
September 19, 2026 23:41
This was referenced Sep 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #17451
What this changes
One bullet on
content/docs/kernel/runtime-services/audit-service.mdx(the## Typical Errorssection, lines 76-79 before this change). It described the failed ledger insert of
recordAuthEventas reported aterrorlevel once per process, with every later failuredropping to
debug. That sentence is false onorigin/maintoday, and the page it sits on is theaudit service's own contract documentation.
The bullet now states the granularity the runtime actually has: once per cause, a cause being
the error
codeplus the object the row is about. A repeat of an already-reported cause stilldegrades to
debug; a new cause gets its ownerrorline, once.Where the behaviour actually lives
Measured in this worktree at
24d622b94(the branch point), re-read rather than inherited from thecard:
recordAuthEvent, whose implementation ispackages/plugins/plugin-audit/src/auth-event-audit.ts:282— the same file the page alreadynames as its Canonical source (
:7).auth-event-audit.ts:211declaresreportedAuthEventFailureCausesas aSetof cause keys (aSetparameterised by the string type — spelled out here rather than written literally), filledat
:229and read at:221. The key is built at:220byauditFailureCauseKey(SESSION_OBJECT, err), withSESSION_OBJECT = 'sys_session'at:152.packages/plugins/plugin-audit/src/audit-writers.ts:739export function auditFailureCauseKey(object: string, err: unknown): string— the error'scodewhen it is a string or a number, and the single bucket
(no code)otherwise, joined with theobject name.
(
auth-event-audit.ts:239-240): "this CAUSE is reported ONCE … a DIFFERENT cause gets its ownerrorline". The page was the last place still describing the old unit.audit-writers.ts. That is the wrong file for this paragraph:audit-writers.tsbacks the CRUDaudit writers, not
recordAuthEvent. The second, independent copy of the process-wide boolean —the one this page documents — lived in
auth-event-audit.tsand was re-keyed separately. Thecard's conclusion holds; only its citation is corrected here.
Scope
git diff --staton this branch:1 file changed, 7 insertions(+), 4 deletions(-).packages/**.once per processoccurs 1 time in this page's 114 lines (:76).Positive control for the query: the same phrase returns 3 further hits elsewhere under
content/docs/— so that1is a reading, not a broken pattern.Changeset
No changeset,
skip-changesetlabel applied. Measured rather than assumed:content/docs/isconsumed by
apps/docs, whose manifest is"private": true, and no published package in theworkspace lists a
content- ordocs-shaped entry in itsfiles[]. Positive control for thatscan: published packages with a
files[]array are found and printed (@objectstack/hono,@objectstack/cli,@objectstack/client-react, …), all of them shippingdist/README.md/CHANGELOG.mdonly. This diff therefore publishes nothing.Tests
node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstackderived 40commands for this path; all 40 were run. See the PR's Acceptance notes below for the four that
first reported
PREREQUISITE NOT METagainst unbuilt workspace packages and were re-run afterbuilding them.
Acceptance notes
content/docs/permissions/record-view-auditing.mdx:221carries thesame phrase for a different surface. It is deliberately untouched by this PR — the card fences it
and so does the
domain:servicesseat. It is neither excluded-because-verified nor cleared; it issimply out of this PR's surface, and is reported to the PM for separate triage.
Generated by Claude Code