Design documents for event replay, audio processing test, audio loopback test, and protocol probe tools. iOS audio session test plan with 28 scenarios and 3-phase automation approach.
2.7 KiB
2.7 KiB
Event Replay Tool Design
Date: 2026-06-11 Status: Design proposal TODO: TODO-043 Requirements: SysRS-171, SRS-098 Effort: L
Purpose
Replay recorded protocol events for debugging state synchronization. Enables deterministic reproduction of state bugs by replaying a captured event sequence through the state reducer and comparing the result with expected state.
Inputs
- Event log file (JSON or protobuf) recorded in diagnostics mode (SRS-097)
- Optional: expected final state snapshot for comparison
Outputs
- Replayed session state at each step
- Diff between replayed state and expected state (if provided)
- Reducer execution trace for debugging
Architecture
┌──────────────┐ ┌───────────────┐ ┌──────────────────┐
│ Event Log │────>│ Event Iterator│────>│ State Reducer │
│ (JSON/PB) │ │ (ordered) │ │ (chanora_state) │
└──────────────┘ └───────────────┘ └────────┬─────────┘
│
┌────────v─────────┐
│ State Comparator │
│ (expected vs │
│ actual) │
└──────────────────┘
- Load: Parse event log file into ordered
StateEventsequence - Iterate: Feed events one-by-one to
chanora_statereducer - Capture: Record state after each event for step-through debugging
- Compare: If expected snapshot provided, diff final state against it
- Report: Output pass/fail with reducer trace and state diff
Implementation Plan
- New Rust binary crate:
tools/event-replay/ - Reuse
chanora_state::ServerStateand reducer functions directly - JSON event format matches
chanora_diagnosticsevent recording output - CLI interface:
event-replay <event-log> [--expected <snapshot>] [--trace] --traceflag prints state after each event
Dependencies
chanora_state(reducer, ServerState)chanora_diagnostics(event log format)serde_jsonorprost(event deserialization)
Verification
- Unit test: replay known event sequence, assert final state matches expected
- Integration test: record events from live session, replay, verify state reconstruction
- Demo: replay recorded session and show state diff