3.1 KiB
3.1 KiB
Timeline Indexer Service
Module
Timeline
Status
IMPLEMENTED
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
- Verify GET /api/v1/timeline/{correlationId} returns indexed events with correct HLC ordering
- Test service and kind filters narrow indexed results
- Verify HLC range queries (fromHlc/toHlc) return correct event subsets
- Test cursor-based pagination produces consistent results across pages
- Verify critical path endpoint computes stage durations and percentages correctly
- Test export API: initiate -> check status -> download bundle
- Verify NDJSON export includes all event fields (event_id, t_hlc, ts_wall, service, kind, payload_digest, engine_version)
- Test evidence linkage: events with attestation references are queryable by correlation