Skip to content

[P1] Audit-log WAL secondary buffer (crash-resilient append) #31

@se-jo-ma

Description

@se-jo-ma

Problem

Per design-docs/04-architecture-operations.md:107, the audit log today is buffered before flush. "If Nautilus crashes while the buffer is full and persistence is down, audit log entries are lost. This is an accepted risk for v1. v2 may add a write-ahead log to local disk as a secondary buffer."

Distinct from session-state WAL (#22) — that one covers CLIPS fact ops; this one covers audit-log entries.

Why it matters

Audit log is the forensic record. Losing entries — even rarely — undermines compliance posture. Local-disk WAL gives crash-resilience without requiring the primary persistence path to be synchronous.

Design references

  • design-docs/04-architecture-operations.md:107 — v2 mitigation

Code locations to modify

  • nautilus/audit/logger.py — audit logger gains optional WAL writer; flush ordering: WAL first, then primary sink (file/Postgres/OTEL)
  • nautilus/audit/__init__.py — config plumbing for WAL path
  • nautilus/config/models.pyaudit.wal_enabled / audit.wal_path

Acceptance

  • WAL writes are durable (os.fsync per record).
  • On startup, unflushed WAL entries are replayed into primary sink, then WAL is truncated.
  • Latency overhead measured; default off; documented tradeoff.
  • Integration test: write entry, kill broker before flush, restart, assert entry surfaces in primary sink.

Priority

P1 — audit integrity is core security promise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority: load-bearing v1 gaparea/auditAudit log, attestations, JWSenhancementNew feature or requestsize/M<2 days: multi-file feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions