Skip to main content

Module audit

Module audit 

Source
Expand description

Centralized audit table — the AuditStore trait.

Cheers’s audit table is the durable, queryable copy of every MCP-mediated action kamaji observes on its host. Kamaji retains a local JSONL as the source of truth and forwards batches here via POST /audit/ingest; cheers’s responsibility ends at “accepted and durable on cheers’s side” (see .yah/docs/working/mcp-auth-and-ownership.md §Audit ingest).

Append-only. There is no in-place edit or delete — the only writes are AuditStore::insert_batch. Reads (paged by on_behalf_of) land in F14 atop this same trait.

Record shape per W159 §Audit journal: { at, sub, act, camp_id, aud, method, scope, result, request_id }. The wire and storage shapes match one-to-one — cheers doesn’t repackage what kamaji sends, it just durably appends. The only field cheers contributes is the row id and the ingested_at server timestamp.

Structs§

AuditRecord
One audit record — verbatim with W159 §Audit journal.
AuditRow
One row in the audit table — an AuditRecord plus the bits cheers contributes (id and ingested_at).
MemoryAuditStore
In-memory AuditStore for tests and single-node bootstrapping. Cheap to clone — shares one backing queue. Records keep insertion order.

Enums§

AuditValidationError
Why an AuditRecord failed validation before reaching the store.

Traits§

AuditStore
Append-only persistence for audit records.