audit-core/tests
tegwick b098fb12ca AUDIT-WP-0009 T04/T06/T07 — heartbeats, reconciliation, and a home for findings
The detection half audit-core argued up to a MUST and then could not support.
Two registered sources were waiting on it.

T04, heartbeats. A heartbeat is an ordinary event — same envelope, same
append-only custody, same chain, no special table. Deliberate: a heartbeat
stored outside the chain would be the one record here that could be back-dated.
Declared per class rather than per source, because a per-source heartbeat from
a mixed-volume emitter is satisfied by its chattiest class and says nothing
about the quiet, security-relevant one, which is the only reason heartbeats
exist. Not the §17 cadence schema T05 waits on: cadence describes expected
rate, this says how often a source promises to say "nothing to report" for a
class that may legitimately be silent.

no_heartbeat_since_registration is its own finding kind rather than a skip —
it is the case most likely to be a broken integration and the one a naive
"compare against last seen" implementation silently drops. Grace widens the
window so one late run does not flap; it never removes a finding.

T06, reconciliation. Counts, never payloads. The awkward part is that every
registered sender holds may_read: false, which taken literally makes the §9.6
reconciliation obligation undischargeable by every source actually registered.
Resolved by observing that a source asking how many of its own events we hold
is not reading the archive — it learns nothing it did not itself emit. So the
surface is scoped to the caller's own sources and tenants and returns no
payloads; anything wider stays behind may_read and full tenant scope. Another
source's counts return 403 rather than an empty count, because a zero would
read as "we hold none of yours" — a false answer to a question about
completeness. No default window, since a count whose bounds the caller did not
choose is not comparable to anything the caller computed.

T07, the findings surface. /v1/stream-findings, following the dead-letter and
secret-finding conventions: may_read plus full tenant scope, since findings
span every sender and carry no tenant key to filter on.

The bound is on every response rather than in a document nobody opens beside
it. A missing heartbeat is not proof of suppression, and agreement on counts
proves neither completeness nor that any event occurred. Both controls cover
loss, outage, drain failure and accident; neither covers a source lying about
itself, and where the emitter is compromised both agree with it. Closing that
needs an observer independent of the emitter, which §16 put outside our scope.

The scope overlay may shorten a heartbeat interval or add a class, never
lengthen or remove one — same asymmetry as evidence_kind, and for the same
reason: a ConfigMap refresh must not widen the window in which a suppressed
class goes unnoticed without anyone deciding to.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Nb7Q6ZmXppNDkTWytfYqfv

Assistant: claude-code
Assistant-Model: opus
Assistant-Process: 2069992@bnt-lap001
Assistant-Session: 167dd7f8-2a25-4be1-aa46-3b6f1a5f94c6
2026-09-10 16:43:26 +02:00
..
test_approval_validity_prohibition.py AUDIT-WP-0009-T08 — assert the approval-validity prohibition by test 2026-09-06 20:35:41 +02:00
test_attest_publish.py AUDIT-WP-0009 T02/T10 — schedule attestation, and make the §5 check total 2026-09-10 16:39:20 +02:00
test_backend_conformance.py Implement AUDIT-WP-0007 hash-chain integrity. 2026-08-16 01:18:30 +02:00
test_capability_case.py Close AUDIT-WP-0007 after live chain attestation. 2026-08-16 01:23:54 +02:00
test_cli.py Implement AUDIT-WP-0007 hash-chain integrity. 2026-08-16 01:18:30 +02:00
test_credentials.py Read mounted DB credentials from a Kubernetes snapshot 2026-08-13 12:25:32 +02:00
test_ingestion.py feat(AUDIT-WP-0008): enforce temporary sender expiry 2026-08-22 11:59:26 +02:00
test_integrity.py AUDIT-WP-0009-T01 — derive tamper_evidence from live attestation state 2026-09-06 20:34:22 +02:00
test_interface.py Implement AUDIT-WP-0006 honest operational custody. 2026-08-16 00:24:33 +02:00
test_layer_conformance.py AUDIT-WP-0009 T02/T10 — schedule attestation, and make the §5 check total 2026-09-10 16:39:20 +02:00
test_migrate_store.py Establish pre-production record disposition and add the migration tool 2026-08-10 17:31:18 +02:00
test_mock_file_backend.py Add mock file audit backend 2026-06-01 23:44:03 +02:00
test_networkpolicies.py AUDIT-WP-0010 T01/T03/T04 — admit tenant-engine, and the envelope does not match 2026-09-10 16:34:45 +02:00
test_senders.py AUDIT-WP-0010 T01/T03/T04 — admit tenant-engine, and the envelope does not match 2026-09-10 16:34:45 +02:00
test_stream_findings.py AUDIT-WP-0009 T04/T06/T07 — heartbeats, reconciliation, and a home for findings 2026-09-10 16:43:26 +02:00
test_t02_synthetic_load_driver.py test(AUDIT-WP-0008): exercise T02 driver over HTTP 2026-08-22 16:55:37 +02:00
test_tenant_engine_envelope.py AUDIT-WP-0010 T01/T03/T04 — admit tenant-engine, and the envelope does not match 2026-09-10 16:34:45 +02:00