feat(api): add minimal session events timeline pipeline#28
Merged
Conversation
added 3 commits
March 8, 2026 15:54
Implement a minimal append-only session_events pipeline with typed event names, standardized metadata for the first five lifecycle events, and a timeline API response for immediate observability. Add focused tests for emitter inserts, ordered timeline reads, and boundary event emission ordering. Made-with: Cursor
Document that non-UUID legacy session_ids are intentionally discarded during normalization and emit a migration notice with the discarded-row count. Rename the session-events test suite to reflect metadata standardization scope. Made-with: Cursor
Keep session timeline ordering deterministic with created_at plus id, and update sprint observability docs to reflect the API contract change to eventType/createdAt/metadata. Made-with: Cursor
Owner
Author
|
Contract change note for reviewers:
I also verified there is currently no |
Make db.getSessionTimeline delegate to events/getSessionTimeline so timeline SQL ordering and shape are maintained in one canonical helper. Made-with: Cursor
Owner
Author
|
Follow-up refactor pushed:
|
Stop gate exit flow when insertPolicyDecision fails by returning a 500 and structured error log, and add regression coverage to ensure decision events and pending intents are not emitted after persistence failure. Made-with: Cursor
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.
Summary
session_eventsmodel (id,session_id,event_type,created_at,metadata) with migration + indexeseventType/createdAt/metadataand standardize metadata shape for the first 5 eventsTest plan
pnpm --filter api test -- test/events/emitSessionEvent.test.ts test/events/getSessionTimeline.test.ts test/routes/sessions.test.ts test/routes/gate.test.ts test/db/queries.session-events.test.tspnpm --filter api test -- test/db/queries.session-events.test.ts test/routes/gate.test.ts test/stripeWebhook.test.ts test/services/paymentWatcher.matching.test.tsMade with Cursor