Strict runtime-validated sinks need producer-contract tests even when the sink itself is mocked.

Strict runtime-validated sinks need producer-contract tests even when the sink itself is mocked.

When a producer sends an event or record to a strict canonical parser, a mocked writer can make an invalid payload look valid. The producer test should capture the emitted object and run it through the canonical parser; keep separate integration coverage for persistence and transaction behavior. This applies to audit events, queues, webhooks, and other typed sinks whose runtime schema can reject a write. It is less useful for internal calls with no runtime validation, and parser coverage does not replace database or atomicity tests.

Evidence/example — 2026-09-10

In e3-solutions/theft PR #838 (COR-4157), a batch-submission route emitted an extra client timestamp in audit-event details, while the canonical audit schema allowed only the reason and source. The route test mocked the writer, so the incompatible payload passed until review traced the real sink parser. The correction removed the unsupported field and made the producer test validate the emitted event through the canonical parser.

Source provenance: PR #838 diff, commits 382aca68 and 07d124da; repository record docs/caught-bugs.md. This was established by static contract tracing and regression coverage, not by a live production replay.