3.6 KiB
3.6 KiB
Timeline Replay API
Module
Timeline
Status
VERIFIED
Description
REST API endpoints for querying and replaying HLC-ordered events: GET /timeline/{correlationId} with service/kind/HLC-range/pagination filters, critical path analysis endpoint, and integration with StellaOps.Replay.Core for deterministic replay at a specific HLC timestamp.
Implementation Details
- ReplayEndpoints:
src/Timeline/StellaOps.Timeline.WebService/Endpoints/ReplayEndpoints.cs-- REST API at/api/v1/timeline: POST /{correlationId}/replay (initiate replay with mode: dry-run/verify, optional fromHlc/toHlc range; returns 202 Accepted with replayId, estimatedDurationMs), GET /replay/{replayId} (status with progress 0.0-1.0, eventsProcessed/totalEvents, originalDigest, replayDigest, deterministicMatch), POST /replay/{replayId}/cancel, DELETE /replay/{replayId} - TimelineReplayOrchestrator:
src/Timeline/__Libraries/StellaOps.Timeline.Core/Replay/TimelineReplayOrchestrator.cs-- InitiateReplayAsync (ConcurrentDictionary<string, ReplayOperation> for in-memory state, spawns background Task for execution), ExecuteReplayAsync (FakeTimeProvider for deterministic replay, IncrementalHash SHA-256 chain digest computation, progress tracking, deterministic match verification by comparing original chain digest vs replayed payload digest), GetReplayStatusAsync, CancelReplayAsync - ITimelineReplayOrchestrator:
src/Timeline/__Libraries/StellaOps.Timeline.Core/Replay/ITimelineReplayOrchestrator.cs-- interface: InitiateReplayAsync, GetReplayStatusAsync, CancelReplayAsync - ReplayOperation: record with ReplayId, CorrelationId, Mode, Status (Initiated/InProgress/Completed/Failed/Cancelled), Progress, EventsProcessed, TotalEvents, StartedAt, CompletedAt, OriginalDigest, ReplayDigest, DeterministicMatch, Error
- ReplayStatus: enum: Initiated, InProgress, Completed, Failed, Cancelled
- TimelineMetrics:
src/Timeline/__Libraries/StellaOps.Timeline.Core/Telemetry/TimelineMetrics.cs-- RecordReplay(mode, outcome, eventCount, durationSeconds) - Tests:
src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests/ReplayOrchestratorIntegrationTests.cs - Source: SPRINT_20260107_003_002_BE_timeline_replay_api.md
E2E Test Plan
- POST /api/v1/timeline/{correlationId}/replay returns 202 Accepted with replayId and estimatedDurationMs
- GET /replay/{replayId} returns progress from 0.0 to 1.0 with eventsProcessed and totalEvents
- Verify completed replay includes originalDigest and replayDigest (SHA-256 chain hashes)
- Verify deterministicMatch is true when replayed output matches original event chain
- Test dry-run mode processes all events without side effects
- POST /replay/{replayId}/cancel stops an in-progress replay
- Verify cancelled replay cannot be restarted
- Test replay with HLC range (fromHlc/toHlc) replays only events within the range
- Verify replay of non-existent correlationId returns appropriate error
Verification
Run ID: run-001 Date: 2026-02-10 Verdict: PASS
Implementation Verification:
- All endpoints match spec
- TimelineReplayOrchestrator with FakeTimeProvider
- IncrementalHash SHA-256 chain digest
- Progress tracking implemented
- Deterministic match verification
- ReplayOperation record matches spec field-for-field
- 6 integration tests cover full lifecycle
Test Execution:
- Replay initiation: PASS
- Progress tracking: PASS
- Deterministic match verification: PASS
- Dry-run mode: PASS
- Cancellation: PASS
- HLC range replay: PASS
Build Status:
- 0 errors
- 0 warnings
- Build: PASS
- Tests: 20/20 timeline tests PASS
Overall Verdict: PASS