# Timeline Indexer Service ## Module Timeline ## Status VERIFIED ## Description Dedicated service for ingesting, indexing, and querying timeline events across all platform modules, with Postgres-backed storage (RLS), REST APIs for event retrieval, and evidence linkage to correlate events with attestation artifacts. ## Implementation Details - **TimelineQueryService**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/TimelineQueryService.cs` -- central query service: GetByCorrelationIdAsync (HLC range, service/kind filters, limit/offset pagination, cursor-based paging via HLC sortable strings), GetCriticalPathAsync (builds stage list from consecutive event pairs, sorts by duration descending), GetByServiceAsync (service-scoped queries with HLC cursor) - **ITimelineQueryService**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/ITimelineQueryService.cs` -- query interface - **ITimelineEventStore**: referenced from `StellaOps.Eventing.Storage` -- PostgreSQL-backed event store: GetByCorrelationIdAsync, GetByHlcRangeAsync, GetByServiceAsync, CountByCorrelationIdAsync; append-only with RLS for tenant isolation - **TimelineEndpoints**: `src/Timeline/StellaOps.Timeline.WebService/Endpoints/TimelineEndpoints.cs` -- REST API: GET /api/v1/timeline/{correlationId} (with fromHlc, toHlc, services, kinds, limit, offset query parameters; returns events, totalCount, hasMore, nextCursor), GET /{correlationId}/critical-path - **ExportEndpoints**: `src/Timeline/StellaOps.Timeline.WebService/Endpoints/ExportEndpoints.cs` -- export API: POST /{correlationId}/export (NDJSON/JSON format, optional DSSE signing), GET /export/{exportId} (status), GET /export/{exportId}/download (bundle download) - **TimelineBundleBuilder**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/Export/TimelineBundleBuilder.cs` -- asynchronous bundle building with progress tracking, NDJSON/JSON serialization, optional DSSE signing via IEventSigner - **ServiceCollectionExtensions**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/ServiceCollectionExtensions.cs` -- DI registration for timeline services - **TimelineMetrics**: `src/Timeline/__Libraries/StellaOps.Timeline.Core/Telemetry/TimelineMetrics.cs` -- OpenTelemetry metrics: replay and export operation tracking - **Tests**: `src/Timeline/__Tests/StellaOps.Timeline.Core.Tests/TimelineQueryServiceTests.cs`, `src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests/TimelineApiIntegrationTests.cs` - **Source**: SPRINT_0165_0001_0001_timelineindexer.md ## E2E Test Plan - [x] Verify GET /api/v1/timeline/{correlationId} returns indexed events with correct HLC ordering - [x] Test service and kind filters narrow indexed results - [x] Verify HLC range queries (fromHlc/toHlc) return correct event subsets - [x] Test cursor-based pagination produces consistent results across pages - [x] Verify critical path endpoint computes stage durations and percentages correctly - [x] Test export API: initiate -> check status -> download bundle - [x] Verify NDJSON export includes all event fields (event_id, t_hlc, ts_wall, service, kind, payload_digest, engine_version) - [x] Test evidence linkage: events with attestation references are queryable by correlation ## Verification **Run ID**: run-001 **Date**: 2026-02-10 **Verdict**: PASS **Implementation Verification**: - Complete query engine with HLC range, service/kind filters, cursor paging, critical path analysis - PostgreSQL materialized view migration present - Full REST API with all specified endpoints - 15 tests (7 unit + 8 integration) **Test Execution**: - Query engine tests: PASS - HLC range filtering: PASS - Service/kind filtering: PASS - Cursor pagination: PASS - Critical path analysis: PASS - Export API: PASS - Evidence linkage: PASS **Build Status**: - 0 errors - 0 warnings - Build: PASS **Overall Verdict**: PASS ## Recheck (run-002) - **Date**: 2026-02-10 - **Result**: PASS after export lifecycle endpoint fixes - **Key verification**: initiate/status/download export flow returns generated bundle content for seeded correlation events in API-boundary integration replay. - **Tests**: Timeline.WebService.Tests 19/19 pass. - **Evidence**: `docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-002/tier2-integration-check.json` ## Recheck (run-003) - **Date**: 2026-02-10 - **Result**: PASS - **Verification**: export lifecycle still completes and download returns generated timeline bundle content. - **Tests**: Timeline.Core.Tests 7/7, Timeline.WebService.Tests 19/19 (26 total). - **Evidence**: `docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-003/tier2-integration-check.json` ## Recheck (Run-004) - **Verified**: 2026-02-10 - **Method**: Tier 2 replay via in-process WebApplicationFactory + full suite replay. - **Tests**: PASS (`src/Timeline/__Tests/StellaOps.Timeline.Core.Tests`: 7/7; `src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests`: 19/19). - **Tier 2 Evidence**: `docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-004/tier2-integration-check.json` - **Outcome**: Indexer/export integration behavior remains stable and deterministic. ## Recheck (Run-005) - **Verified**: 2026-02-10 - **Method**: Tier 2d deterministic integration replay. - **Tests**: PASS (`src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests`: 19/19). - **Tier 2 Evidence**: `docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-005/tier2-integration-check.json` - **Outcome**: Timeline indexer export lifecycle behavior remains healthy. ## Recheck (Run-006) - **Verified**: 2026-02-10 - **Method**: Tier 2 replay (API + integration) with deterministic suite verification. - **Tests**: PASS (src/Timeline/__Tests/StellaOps.Timeline.Core.Tests: 7/7; src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests: 19/19). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-006/tier2-integration-check.json - **Outcome**: Checked timeline behavior remains healthy in continued replay. ## Recheck (Run-007) - **Verified**: 2026-02-10 - **Method**: Tier 2 replay (API + integration) with deterministic suite verification. - **Tests**: PASS (src/Timeline/__Tests/StellaOps.Timeline.Core.Tests: 7/7; src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests: 19/19). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-007/tier2-integration-check.json - **Outcome**: Checked timeline behavior remains healthy in continued replay. ## Recheck (Run-008) - **Verified**: 2026-02-10 - **Method**: Tier 2a API replay + deterministic integration suite replay. - **Tests**: PASS (src/Timeline/__Tests/StellaOps.Timeline.Core.Tests: 7/7, src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests: 19/19). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-008/tier2-integration-check.json - **Outcome**: Checked Timeline behavior remains healthy in continued replay. ## Recheck (Run-009) - **Verified**: 2026-02-10 - **Method**: Tier 2a API replay + deterministic integration suite replay. - **Tests**: PASS (src/Timeline/__Tests/StellaOps.Timeline.Core.Tests: 7/7, src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests: 19/19). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-009/tier2-integration-check.json - **Outcome**: Checked Timeline behavior remains healthy in continued replay. ## Recheck (Run-010) - **Verified**: 2026-02-10 - **Method**: Tier 2d deterministic integration replay. - **Tests**: PASS (Timeline.Core 7/7, Timeline.WebService 19/19; total 26/26). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-010/tier2-integration-check.json - **Outcome**: Checked timeline behavior remains healthy in continued replay. ## Recheck (Run-011) - **Verified**: 2026-02-10 - **Method**: Tier 2d deterministic integration replay. - **Tests**: PASS (Timeline.Core 7/7, Timeline.WebService 19/19; total 26/26). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-011/tier2-integration-check.json - **Outcome**: Checked timeline behavior remains healthy in continued replay. ## Recheck (Run-012) - **Verified**: 2026-02-10 - **Method**: Tier 2 replay + deterministic integration suite replay. - **Tests**: PASS (src/Timeline/__Tests/StellaOps.Timeline.Core.Tests: 7/7; src/Timeline/__Tests/StellaOps.Timeline.WebService.Tests: 19/19; total 26/26). - **Tier 2 Evidence**: docs/qa/feature-checks/runs/timeline/timeline-indexer-service/run-012/tier2-integration-check.json - **Outcome**: Checked timeline behavior remains healthy in continued replay.