Merged
Conversation
Implemented:
- Core /collect and /collect/{stream} endpoints
- Convenience endpoints: /v1/identify, /v1/track, /v1/page
- Health checks: /health (liveness), /ready (readiness with Firestore check)
- Dependency injection (get_queue, get_event_store, get_settings)
- FastAPI app with lifespan manager (start/stop queue)
- Always return 202 Accepted (no rejections at edge)
Components:
- src/eventkit/api/ - FastAPI application with router, dependencies, and app
- src/eventkit/stores/ - Added health_check() protocol and implementation
- src/eventkit/config.py - Removed unused FIRESTORE_*_COLLECTION settings
Tests:
- 14 new tests for API endpoints (150 total passing)
- 94% code coverage
- Mock-based unit tests for API layer
- Tests for both healthy and unhealthy states
CI:
- Updated GitHub Actions to use docker-compose (consistent with local dev)
- Firestore emulator with healthchecks via --wait flag
- All tests (unit + integration) run in CI
Documentation:
- LOCAL_DEV.md - Comprehensive local development guide
- README.md - Streamlined setup with link to LOCAL_DEV.md
- CLAUDE.md - Updated with latest patterns (queue-agnostic processor, API patterns, Docker Compose workflow)
Updated all references to use Docker Compose v2 command syntax: - CI workflow (.github/workflows/test.yml) - Documentation (LOCAL_DEV.md, README.md, CLAUDE.md) - Specs (plan.md, tasks.md) Docker Compose v2 is the current standard and uses 'docker compose' (space) instead of 'docker-compose' (hyphen). This is what's available in GitHub Actions runners and modern Docker installations. Reference: https://docs.docker.com/compose/gettingstarted
c78d203 to
8054d57
Compare
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.
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