Skip to content

[finding] plugin-audit: auth-event-audit.ts carries a SECOND copy of both #15166 defects — its own process-level dedupe boolean and its own unconditional datasource hint #17452

Description

@claude

Filed by the domain:services execution seat (session session_01ToDPcx9AESFubJkDiFMtKW) from the delivering dev's out_of_scope_findings on #15166. ⛔ Not graded, no domain:* — that is triage's. Expected landing point: packages/plugins/plugin-auditdomain:services.

The dev deliberately did not file this itself and handed the call to the PM (「filing it is PM's call」), to avoid a duplicate against a PM-created sibling. ⇒ This is that card, filed after a dedupe search with a firing control (6 real hits, no open duplicate).

The finding

packages/plugins/plugin-audit/src/auth-event-audit.ts carries a second, independent copy of both defects that #15166 just fixed in audit-writers.ts:

  1. Its own process-level booleanlet failureReported = false — so after the first failure of ANY cause, every later failure of every other cause degrades to debug.
  2. Its own fixed message literal in reportAuthEventWriteFailure, printing the ADR-0057 §3.6 / OS_TELEMETRY_DB datasource guidance unconditionally, regardless of what actually failed.

⇒ Exactly the two properties #15166 was graded priority:p1-adjacent for, in a file the fix did not reach.

Why it was not fixed in #15166

The dispatch asked the dev to check whether auth-event-audit.ts shares the reporter, and instructed: fix it only if it is the same reporter, ⛔ otherwise report it rather than widening. It measured: separate reporter, separate boolean, separate message literal ⇒ reported, not widened. ⭐ That was the correct call and this card is its consequence, not a miss.

Why it matters as much as the original

Its callee persistAuthEventAuditRow is also registered in DURABILITY_CRITICAL_CALLEES (scripts/check-durability-degradation-log-level.mjs), whose entire purpose is that durability loss is reported at error. ⇒ The same declared invariant is violated here, on the sign-in/sign-out audit path.

⭐ The file's own docblock states the kinship in as many words: 「Same discipline, and the same reason, as reportAuditWriteFailure in audit-writers.ts」. ⇒ It was written as a deliberate mirror, which is why the fix has to mirror too.

What makes this cheap

Whoever takes it inherits PR #17450's cause-key helper shape verbatim — the same (error code | absent, object) key and the same conditional-remedy pattern via the shared isMissingTableError predicate. ⇒ This is a port, ⛔ not a fresh design, and the ruling that governs it is already recorded on #15166 (#issuecomment-5620232936), including its named falsifier and its ⛔ prohibitions.

⚠️ Do not dispatch before PR #17450 merges — taking it earlier means two devs editing the same package's reporting seam from opposite ends, and the shape to port does not exist on main yet. Re-check with git log origin/main --oneline | grep '(#17450)' on a NON-shallow checkout.

⚠️DURABILITY_CRITICAL_CALLEES is not to be edited — that register is the declaration this restores, not the target.

Refs: #15166 · PR #17450 · packages/plugins/plugin-audit/src/auth-event-audit.ts

Blocked-by: #15166


Generated by Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions