You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(plugin-audit): a lost audit row is an error, said once (#5226) (#5350)
An audit-write failure is a durability / data-consistency degradation, not a
functional one: the audited write itself succeeds, its row is on disk and the
API returns 200, so nothing looks broken from the outside while the
`sys_audit_log` entry recording WHO did it never landed and nothing retries it.
AGENTS.md "Degradation log levels" puts that at `error`; it was at `warn`.
The error names both things such a line owes: the consequence (the compliance
trail is now incomplete, and the system will keep looking healthy) and the fix
(ADR-0057 lifecycle-class routing sends sys_audit_log to the `telemetry`
datasource when one is registered, so "no such table" here means the write ran
against a different datasource than the one holding the table; OS_TELEMETRY_DB=0
collapses the split).
Reported ONCE per process, not once per failed write — an audit write runs on
every mutation, and one error per write is what trained everyone to skim the
channel in #4420. Subsequent failures degrade to `debug`.
The write is extracted as a named `persistAuditTrailRow` callee and registered
in DURABILITY_CRITICAL_CALLEES so `pnpm check:durability-log-level` holds the
level; verified by reverting it to `warn` and watching the gate go red.
NOTE: this does NOT fix the missing-table symptom #5226 reports. That premise
was disproven on a real `dev --fresh` boot — the table IS created (in
dev.telemetry.db, 50 rows) — and the real defect is an ambient transaction
leaking across datasources in the engine. See the PR body.
Claude-Session: https://claude.ai/code/session_01FTszibd6C8sUCCZnM4VcrL
Co-authored-by: Claude <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: scripts/check-durability-degradation-log-level.mjs
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -144,6 +144,10 @@ const DURABILITY_CRITICAL_CALLEES = new Map([
144
144
'saveMetaItem',
145
145
'The metadata definition was never written to the authoritative store — the runtime looks completely normal because the in-memory registry already has it, and the definition simply vanishes on the next provision/restart (#4754, from #4669).',
146
146
],
147
+
[
148
+
'persistAuditTrailRow',
149
+
'The compliance audit row was never written — the audited write itself succeeded and returned 200, so the API, the data and every counter read clean, while the `sys_audit_log` entry that records WHO did it is simply absent and nothing retries it. The gap surfaces, if ever, to an auditor who cannot connect it back to the write (#5226, the #4420 shape on the compliance ledger).',
150
+
],
147
151
[
148
152
'deleteMetaItemFromLoader',
149
153
'The metadata definition was never deleted from the authoritative store — `unregister()` still resolves and still announces `deleted`, the in-memory registry entry is gone, and the surviving row is read straight back out of storage by the very next `list()`/`get()`, so the "deleted" item reappears and survives every restart. Nothing retries it (#5259).',
0 commit comments