HTTP Collection API (#7) #17
Merged
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.
Implements Issue #7: HTTP Collection API with health checks, dependency injection, and CI integration.
Summary
Built a production-ready HTTP collection API with FastAPI that:
What's Implemented
Collection Endpoints
POST /collectandPOST /collect/{stream}- Accept any JSON payloadConvenience Endpoints (Segment-compatible)
POST /v1/identify→ routes to "users" streamPOST /v1/track→ routes to "events" streamPOST /v1/page→ routes to "pages" streamHealth Checks
GET /health- Liveness check (returns 200 if process running)GET /ready- Readiness check (verifies Firestore connectivity, returns 503 if unhealthy)Architecture
Dependency Injection:
get_settings()- Singleton settings from environmentget_queue()- Wires entire pipeline (adapter → sequencer → buffer → processor → queue)get_event_store()- EventStore instance for health checksFastAPI Application:
await queue.start()(start workers, buffer flusher)await queue.stop()(drain queue, flush buffers)Queue-Agnostic Design:
EventQueueprotocol (not DirectQueue/AsyncQueue)EVENTKIT_QUEUE_MODEconfigStorage Layer Updates
health_check()method toEventStoreprotocolhealth_check()inFirestoreEventStoreTests
14 new API tests (
tests/unit/api/test_router.py):Coverage: 94% for API layer, 150 total tests passing (unit + integration)
CI/CD
Updated
.github/workflows/test.ymlto use docker-compose (consistent with local dev):docker-compose up -d --waitleverages healthchecks fromdocker-compose.ymlDocumentation
LOCAL_DEV.md
Comprehensive local development guide:
README.md
Updated with link to LOCAL_DEV.md for quick onboarding
CLAUDE.md
Updated with latest patterns:
Manual Testing
All functionality verified with manual testing:
/ready)Files Changed
New Files:
src/eventkit/api/__init__.pysrc/eventkit/api/app.pysrc/eventkit/api/dependencies.pysrc/eventkit/api/router.pytests/unit/api/__init__.pytests/unit/api/test_router.pyLOCAL_DEV.mdUpdated Files:
src/eventkit/stores/event_store.py(addedhealth_checkprotocol)src/eventkit/stores/firestore.py(implementedhealth_check)src/eventkit/config.py(removed unused FIRESTORE_*_COLLECTION settings).github/workflows/test.yml(docker-compose integration)README.md(added LOCAL_DEV.md link)CLAUDE.md(updated patterns)specs/core-pipeline/tasks.md(marked Task 10 complete)Closes