Framework.Overlay.ReplayHarness (Framework v0.5.0)

View Source

Replay Harness for observability overlay.

Enables reconnection from any sequence for state reconstruction and debugging. Essential for verifying replay determinism and testing consumer behavior.

Features

  • Replay from arbitrary sequence positions
  • State reconstruction verification
  • Consumer simulation
  • Replay validation against schema digests
  • Performance measurement during replay

Summary

Functions

Get all consumer cursors for replay harness.

Get available replay checkpoints.

Get sequence range available for replay.

Get validation information for replay setup.

Replay events from a specific sequence position.

Replay from a specific cursor position.

Test consumer behavior with simulated gaps and failures.

Validate replay determinism between multiple runs.

Functions

get_all_consumer_cursors()

Get all consumer cursors for replay harness.

get_replay_checkpoints(limit \\ 20)

Get available replay checkpoints.

Returns significant sequence positions useful for replay testing.

Returns

List of checkpoint information including sequence and context

get_sequence_range()

Get sequence range available for replay.

get_validation_info()

Get validation information for replay setup.

replay_from(from_sequence, to_sequence \\ nil, options \\ %{})

Replay events from a specific sequence position.

Simulates consumer reconnection and validates deterministic reconstruction.

Parameters

  • from_sequence: Starting sequence (exclusive - events with sequence > from_sequence)
  • to_sequence: Ending sequence (inclusive, optional)
  • options: Replay configuration
    • validate_digests: Verify schema digests during replay (default true)
    • batch_size: Events per batch (default 100)
    • max_events: Maximum events to replay (default 1000)
    • consumer_mode: :simulation | :validation (default :validation)

Returns

%{ events_replayed: count, start_sequence: number, end_sequence: number,
duration_ms: milliseconds, validation_results: [...], errors: [...] }

replay_from_cursor(cursor)

Replay from a specific cursor position.

test_consumer_resilience(scenario, from_sequence, options \\ %{})

Test consumer behavior with simulated gaps and failures.

Validates consumer resilience under adverse conditions.

Parameters

  • scenario: :gaps | :out_of_order | :duplicate | :schema_drift

  • from_sequence: Starting sequence
  • options: Test configuration

Returns

Test results with pass/fail status and detailed findings

validate_determinism(from_sequence, to_sequence, iterations \\ 3)

Validate replay determinism between multiple runs.

Ensures that replaying the same sequence range produces identical results.

Parameters

  • from_sequence: Starting sequence
  • to_sequence: Ending sequence
  • iterations: Number of replay runs (default 3)

Returns

Determinism validation results with consistency metrics