# Unified Event Timeline Service ## Module Timeline ## Status IMPLEMENTED ## Description Cross-service event timeline with HLC-ordered events, deterministic event IDs (SHA-256 of correlation_id+t_hlc+service+kind), W3C Trace Context integration, PostgreSQL append-only storage with materialized critical-path views. Provides event SDK for Scheduler/AirGap/Attestor/Policy/VexLens integration, timeline query API with HLC range filtering, causal latency measurement, and forensic event export with DSSE attestation. ## Implementation Details - **TimelineQueryService**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/TimelineQueryService.cs` -- central query engine: GetByCorrelationIdAsync (HLC range, service/kind filters, limit/offset, cursor paging), GetCriticalPathAsync (stage duration analysis: consecutive event pairs with percentage of total, sorted by duration descending), GetByServiceAsync (cross-correlation service queries) - **TimelineEndpoints**: `src/Timeline/StellaOps.Timeline.WebService/Endpoints/TimelineEndpoints.cs` -- `/api/v1/timeline`: GET /{correlationId} returns TimelineResponse (events with EventId, THlc, TsWall, Service, Kind, Payload, EngineVersion; totalCount, hasMore, nextCursor); GET /{correlationId}/critical-path returns CriticalPathResponse (totalDurationMs, stages with durationMs/percentage/fromHlc/toHlc) - **ReplayEndpoints**: `src/Timeline/StellaOps.Timeline.WebService/Endpoints/ReplayEndpoints.cs` -- deterministic replay: POST /{correlationId}/replay (dry-run/verify modes, HLC range), GET /replay/{replayId} (progress, deterministic match verification via SHA-256 chain digest comparison) - **ExportEndpoints**: `src/Timeline/StellaOps.Timeline.WebService/Endpoints/ExportEndpoints.cs` -- forensic export: POST /{correlationId}/export (NDJSON/JSON, optional DSSE signing), GET /export/{exportId}, GET /export/{exportId}/download - **TimelineReplayOrchestrator**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/Replay/TimelineReplayOrchestrator.cs` -- background replay execution with FakeTimeProvider for determinism, IncrementalHash chain digest, progress tracking, cancellation support - **TimelineBundleBuilder**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/Export/TimelineBundleBuilder.cs` -- NDJSON/JSON bundle building with IEventSigner integration for DSSE-attested exports; includes event_id, t_hlc, ts_wall, correlation_id, service, kind, payload_digest, engine_version, schema_version - **ServiceCollectionExtensions**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/ServiceCollectionExtensions.cs` -- DI registration for all timeline services - **TimelineMetrics**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/Telemetry/TimelineMetrics.cs` -- OpenTelemetry metrics: RecordReplay, RecordExport - **Program.cs**: `src/Timeline/StellaOps.Timeline.WebService/Program.cs` -- maps TimelineEndpoints, ReplayEndpoints, ExportEndpoints, HealthEndpoints - **Tests**: `src/Timeline/__Tests/StellaOps.Timeline.Core.Tests/TimelineQueryServiceTests.cs`, `src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests/TimelineApiIntegrationTests.cs`, `ReplayOrchestratorIntegrationTests.cs` - **Source**: SPRINT_20260107_003_000_INDEX_unified_event_timeline.md ## E2E Test Plan - [ ] GET /api/v1/timeline/{correlationId} returns cross-service events ordered by HLC timestamp - [ ] Verify deterministic event IDs are SHA-256 hashes of correlation_id+t_hlc+service+kind - [ ] Test HLC range filtering returns only events within the specified window - [ ] Verify critical path analysis computes correct stage durations and percentages - [ ] Test deterministic replay: initiate -> poll status -> verify deterministicMatch=true - [ ] Verify forensic export produces NDJSON bundle with all event fields - [ ] Test DSSE-signed export bundles include valid signature attestation - [ ] Verify service and kind filters work correctly across multiple source services - [ ] Test pagination with cursor returns consistent ordered results