Repository navigation
Commit ad192cb
docs(kernel): correct the audit-write failure report granularity to once per cause (#19212)
Fixes #17451
## What this changes
One bullet on `content/docs/kernel/runtime-services/audit-service.mdx`
(the `## Typical Errors`
section, lines 76-79 before this change). It described the failed ledger
insert of
`recordAuthEvent` as reported at `error` level **once per process**,
with every later failure
dropping to `debug`. That sentence is false on `origin/main` today, and
the page it sits on is the
audit service's own contract documentation.
The bullet now states the granularity the runtime actually has: **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`; a **new** cause gets its own `error` line, once.
## Where the behaviour actually lives
Measured in this worktree at `24d622b94` (the branch point), re-read
rather than inherited from the
card:
- The paragraph's subject is `recordAuthEvent`, whose implementation is
`packages/plugins/plugin-audit/src/auth-event-audit.ts:282` — the same
file the page already
names as its **Canonical source** (`:7`).
- The dedupe there is cause-keyed, not a process-wide boolean:
`auth-event-audit.ts:211` declares `reportedAuthEventFailureCauses` as a
`Set` of cause keys (a
`Set` parameterised by the string type — spelled out here rather than
written literally), filled
at `:229` and read at `:221`. The key is built at `:220` by
`auditFailureCauseKey(SESSION_OBJECT, err)`, with `SESSION_OBJECT =
'sys_session'` at `:152`.
- The shared key is
`packages/plugins/plugin-audit/src/audit-writers.ts:739`
`export function auditFailureCauseKey(object: string, err: unknown):
string` — the error's `code`
when it is a string or a number, and the single bucket `(no code)`
otherwise, joined with the
object name.
- The runtime message this seam prints already says the same thing in
words
(`auth-event-audit.ts:239-240`): "this CAUSE is reported ONCE … a
DIFFERENT cause gets its own
`error` line". The page was the last place still describing the old
unit.
1 parent 24d622b commit ad192cb
1 file changed
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
80 | 83 | | |
81 | 84 | | |
82 | 85 | | |
| |||
0 commit comments