Backend rework — structured logging, repository pattern, E2E tests#140
Closed
VECTORG99 wants to merge 1 commit into
Closed
Backend rework — structured logging, repository pattern, E2E tests#140VECTORG99 wants to merge 1 commit into
VECTORG99 wants to merge 1 commit into
Conversation
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.
Backend Rework — 4 Issues
This PR consolidates 4 backend improvements for the Joidy monorepo. All 90 tests pass.
Phase 1: #38 — Distributed Tracing & Structured Logging
All 3 Python services (api, ai-service, worker) now have:
X-Request-IDheader propagation: Worker → API → AI-serviceCorrelationLogFilteron both stream and file handlersRequestIdMiddlewarenow wired as outermost middleware (previously was missing frommain.py)Phase 2: #37 — DI / Repository Pattern
api/repositories.py— single-file repository layer:BaseRepository[T]generic + 18 domain repositories + FastAPIDependsprovidersapi/services/unit_of_work.py— dead code referencing non-existent classesembedding_service.py— removedSessionLocal()direct creation;trigger_embedding()accepts optionaldb(background task compatible)note_serviceandjoidy_vault_writerremain on raw session (compatible either way)Phase 3: #11 — E2E API Tests
.github/workflows/ci.ymlnow runspython -m pytestinstead ofunittest— discovers all 4 previously-skipped router testsPhase 4: #12 — Obsidian Sync Integration Tests
Files Changed
api/middleware/correlation_id.pyapi/middleware/request_id.pyapi/logging_config.pyapi/main.pyai-service/logging_config.pyai-service/main.pyworker/logging_config.pyworker/watchers/vault_watcher.pyworker/tasks/joidy_daily_writer.pyapi/routers/ai.pyapi/repositories.pyapi/services/embedding_service.pyapi/services/goal_service.pyapi/services/gamification_engine.pyapi/services/github_service.pyapi/services/skill_tree.pyapi/services/tag_graph.pyapi/services/personal_streak_service.pyapi/services/unit_of_work.py.github/workflows/ci.ymlapi/tests/test_e2e_notes.pyapi/tests/test_e2e_tags.pyapi/tests/test_e2e_goals.pyapi/tests/test_e2e_gamification.pyapi/tests/test_e2e_vault.pyCloses #38, #37, #11, #12