Skip to main content

Module durable

Module durable 

Source
Expand description

Durable, append-only, per-workspace persistence for execution traces.

Governed by spec 079-durable-trace-journal (specs/518-durable-trace-journal/spec.md, ADR-0017). Reuses the existing crate::events::DurableEventJournal rather than a second storage engine: trace records are canonical JSON Lines, appended and fsync-committed exactly like domain events (FR-001), and inherit that journal’s existing recovery semantics (FR-003, spec 066 FR-009: discard only an incomplete final record, fail loudly on any other corruption) and deterministic oldest-first, whole-segment pruning (FR-005) unchanged. “Per workspace” retention (FR-005) is achieved by opening one journal per workspace root – a caller opens a DurableTraceJournal at a workspace-scoped directory, so pruning is inherently workspace-isolated without threading a workspace_id field through every trace record, mirroring how crate::data_store is host-opened at an explicit root rather than auto-wired by crate::Runtime.

This is an additive durability layer alongside super::TraceStore (spec 012-execution-trace-tiered’s process-local, in-memory store) and super::store/517-embedded-trace-api’s process-local query surface – it does not replace or change either.

Structs§

DurableTraceConfig
A durable-trace sink plus the caller’s audit posture for it (FR-002).
DurableTraceJournal
Durable, per-workspace persistence layer for execution traces.
TracePrunedEvidence
Evidence produced by DurableTraceJournal::prune (FR-005).
TraceRecoveryReport
Deterministic evidence of what survived recovery when a DurableTraceJournal was opened (FR-003). A frozen snapshot taken at open time – it is not updated by later DurableTraceJournal::record calls in the same session, so it always answers “what did recovery find,” not “what has this session written since.” An incomplete final record left by a crash mid-write is silently absent here (discarded by the underlying journal’s recovery) rather than reconstructed: recovery MUST NOT invent trace evidence (ADR-0017).

Enums§

TraceJournalError
Errors surfaced by the durable trace journal.

Traits§

TraceDurabilitySink
Durable persistence sink for execution traces. Implemented for Mutex<DurableTraceJournal> for real persistence; test doubles may implement this directly to exercise a caller’s fail-closed behavior (FR-002) without real filesystem fault injection.