Skip to main content
This document outlines the persistence model, checkpoint schema, optimistic concurrency guarantees, and adapter error modes in Siglo v1.0.0.

1. Checkpoint Schema v2.0.0

A checkpoint represents a serialized snapshot of an execution stack at a point in time:

Key Schema Guarantees:

  • version: 2 & schemaVersion: '2.0.0': Explicit storage schema version tracking. Attempting to restore a checkpoint from an unsupported future storage engine version (version > 2) throws CheckpointVersionException. (Note: This storage schema version is distinct from workflow code semantic versioning, which throws WorkflowVersionMismatchException if workflow steps differ without a migration).
  • revision: number: Monotonically incremented on each checkpoint save, state transition, or migration.
  • expiresAt?: number: Optional Unix epoch expiration timestamp (calculated from ttlMs). Expired checkpoints can be cleaned via cleanExpiredCheckpoints().
  • status: Indicates execution lifecycle status: 'running', 'completed', 'failed', 'cancelled', or 'waiting'.

2. Optimistic Concurrency Control (OCC)

To prevent lost updates in distributed or concurrent environments, checkpoints support optimistic concurrency:
  • If the current revision does not match expectedRevision, CheckpointConflictException is thrown:
  • On conflict, callers can reload the latest checkpoint, reconcile state, and retry.

3. Namespace Scoping & Partitioning

Checkpoints recorded with a namespace partition data across tenants:
  • Restoring a checkpoint with restoreCheckpoint(cp, { expectedNamespace: 'ns-A' }) throws NamespaceMismatchException when both expectedNamespace and cp.namespace are present and differ.
  • Storage adapter operations pass namespace for key prefixing and partitioning.
  • Note: Namespace scoping is logical key partitioning, not an enforced authenticated tenant boundary. Application-level authorization and explicit validation are still required.

4. Field Redaction (redactFields)

Sensitive context fields (tokens, passwords, API keys) can be redacted from checkpoints:
  • Redaction applies recursively to both top-level context fields and nested sub-objects.
  • Matched keys are replaced with "[REDACTED]".

5. Storage Error Modes (StorageErrorMode)

Configured via defaultStorageManager.setErrorMode(mode):

6. Storage Adapter Interface

Custom adapters implement the StorageAdapter interface:
Registered globally via: