Audit semantics in Sigra

Copy Markdown View Source

This page complements Audit logging with implementation-level vocabulary used in library code and tests.

Primitives

Atomicity (C-1 / SEED-002)

Where a business operation and its audit row must commit together, prefer Ecto.Multi + log_multi/3 + __log_internal__/3 (or log_multi_safe/3 where provided) inside a single transaction.

Sigra historically shipped a hybrid: a few hot paths use Ecto.Multi, while others still call log_safe/3 after the fact. Converting remaining sites is tracked as SEED-002; v1.3 proves the pattern on the API token create path in Sigra.APIToken with Postgres-backed tests.

C-1 matrix (post–v1.4 inventories): the authoritative “which boundary is T1 vs intentional T2 (EX-*)” table lives in 09-VERIFICATION.md (tag snapshot) — keep that file aligned with 43- / 44- / 45- AUD-04 inventories when audit mechanics change.

Testing

Non-goals

  • This document does not list every built-in action string; search lib/sigra/ for Sigra.Audit call sites.
  • OAuth ceremony audit rows are not guaranteed to have dedicated example-app smoke in every milestone; check release notes when upgrading.