Per-spec event history: GET /v1/events?spec= serves the durable record - #196
Merged
Conversation
The audit store keeps every RECORD-class event forever, but the API could only answer the global /v1/events/recent window, so a spec's lifecycle rows vanished from its room on an active control plane. Add the bounded scoped read: EventStore.forSpec(specId, afterId, limit, excludedTypes) range-scans idx_events_spec (verified by a query-plan test), the route requires spec, treats since as an exclusive monotonic event-id cursor for SSE gap-fill, clamps limit, and serves RECORD-class events only — the telemetry taxonomy now lives once in Event.WellKnownTypes and is shared with the retention sweeper. A spec with no events answers an empty list, not 404. The record is node-local by contract; ARCHITECTURE now states it plainly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec: sail-spec-events (mast PR: standardapplied/mast — same branch name).
Why
The audit store keeps every RECORD-class event forever (retention prunes telemetry only), but the API could only answer the single global
/v1/events/recent?limit=window. Mast's rooms backfilled from the last 100 global events, so on an active control plane a spec's lifecycle rows (dispatches, stops, review beats, guardrails, snapshots) silently vanished from its room while sitting durably in the store. Storage existed; retrieval was never finished.What
GET /v1/events?spec=<id>[&since=<eventId>][&limit=]— a thin route over the store.specis required for this shape (the unscoped firehose stays/recent);sinceis the exclusive monotonic event-id cursor for gap-fill after SSE reconnects, omitted means the newestlimitrows; results are oldest first;limitis clamped (default 100, max 1000); same auth tier as every other read.EventStore.forSpec(specId, afterId, limit, excludedTypes)— the bounded variant. Both query shapes range-scanidx_events_spec(spec_id + implicit rowid); a query-plan test asserts no table scan.Event.WellKnownTypes.TELEMETRY_TYPES, shared byretentionClassand the retention sweeper. Retention itself is unchanged.SailOperationsnever had a working/recentsource (SpecStoreAuditPersisteris not anAuditPersister), so the new read is wired explicitly viauseEvents(eventStore)inServerStartCommand.Behavior change:
GET /v1/eventswithoutspecnow answers 422 with a pointer to both shapes (previously 405).Verification
mvn clean verifygreen (all modules, coverage gates included). New tests: store scoping/sinceexclusivity/limit/telemetry exclusion/query plan; operations validation, wiring-absent, corrupt-data tolerance; route auth, missing/invalidspec,sincevalidation, limit clamping.