Append-only per-workflow event-log substrate in Zig 0.16. Ports Temporal L381 workflow event log + scd-zig backfill duality semantics into a single library.
v0.0.1 — 11/11 tests pass on Zig 0.16. Each WorkflowId owns an ordered stream; appends enforce strict-monotonic gap-free sequence numbers; replays walk the stream in order from a given start point. Two workflows can share the same seq space without collision.
WorkflowId/EventSeq/Timestamp—u64/u64/i64.EventKindenum:workflow_started,activity_scheduled,activity_completed,activity_failed,timer_fired,signal_received,workflow_completed,workflow_failed,custom.WorkflowEvent—{ seq, timestamp, kind, bytes }.WorkflowLogwithinit/deinit/append/read(from, to)/replay(from, state, apply_fn)/eventAt(seq)/streamLen/nextSeq.- Idempotency: re-appending the LAST event with the same
seqis silently accepted (at-least-once safety; matches Temporal's worker retry contract).
zig build test # 11 unit tests- No persistence. Memory-only at v0.0.1. v0.0.2 wires the on-disk layer via shipped
tableformat-zigmanifest. - No replay engine (P178). v0.0.1 ships the iteration primitive; the deterministic-replay engine (wf-rand seed + side-effect dedup + activity-result memoisation) lands in v0.0.2 as a separate module.
- No snapshot pruning. v0.0.3 ships continuation-events + retention.
- No multi-writer coordination. Single-writer per stream at v0.0.1; commit-or-retry transaction support comes via integration with shipped
cow-branch-zigin v0.0.2. - No event-time queries. v0.0.1 reads + replays by seq only; v0.0.2 adds timestamp-bounded reads.
- scd-zig backfill duality. Workflow event log IS the source-of-truth log for backfill ↔ incremental rebuilds; the duality property is enforceable at the log layer.
- tableformat-zig (v0.0.2 persistence) — manifest-of-events for on-disk durability.
- cow-branch-zig — workflow branches at LSN boundaries enable history-preserving experimentation.
- thompson-bandit-zig — Temporal's adaptive retry pattern composes with the Beta posterior for activity retries.
- Pre-1.0 substrate. v0.0.1 stores everything in memory.
eventAtdoes a linear scan within the stream; v0.0.2 swaps to direct indexed access (events are stored in seq order).- No single-writer coordination; caller serialises appends.
- The
replaycallback is a fn pointer; v0.0.2 wires a more ergonomic visitor pattern.
Concepts adapted from Temporal workflow event log (castle L381) + scd-zig backfill duality (B2 in the castle inventory). Frontier port by Sean Collins (sean@sunlitmoon.online).
AGPL-3.0-or-later. See LICENSE.
