feat(app): production wiring factories + /healthz real probes (Task 4.3) #26

Merged
goldstein merged 1 commit from feat/production-wiring into main 2026-04-18 10:09:35 +00:00
Owner

Closes the Chunk 4 loop: lifespan selects fakes vs real clients via IX_TEST_MODE, /healthz probes call selfcheck() on OllamaClient / SuryaOCRClient, worker spawns with a real Pipeline factory.

Summary

  • make_genai_client / make_ocr_client factories keyed off AppConfig.test_mode
  • New AppConfig.test_mode field (env: IX_TEST_MODE) — CI runs with fake
  • FastAPI lifespan sets up dependency_overrides for get_probes; probes run async selfcheck() on a fresh loop in a throwaway thread so they're safe from either sync or async callers
  • build_pipeline() assembles SetupStep -> OCRStep -> GenAIStep -> ReliabilityStep -> ResponseHandler
  • Drops obsolete worker-loop spawn_worker_task stub

Test plan

  • 11 new unit tests: 5 factories + 6 app-wiring / probe adapter / pipeline build
  • Full suite: 236 passed, 33 skipped (DB-gated), ruff clean
  • CI file already sets IX_TEST_MODE=fake so the new code path exercises correctly
Closes the Chunk 4 loop: lifespan selects fakes vs real clients via IX_TEST_MODE, /healthz probes call selfcheck() on OllamaClient / SuryaOCRClient, worker spawns with a real Pipeline factory. ## Summary - make_genai_client / make_ocr_client factories keyed off AppConfig.test_mode - New AppConfig.test_mode field (env: IX_TEST_MODE) — CI runs with fake - FastAPI lifespan sets up dependency_overrides for get_probes; probes run async selfcheck() on a fresh loop in a throwaway thread so they're safe from either sync or async callers - build_pipeline() assembles SetupStep -> OCRStep -> GenAIStep -> ReliabilityStep -> ResponseHandler - Drops obsolete worker-loop spawn_worker_task stub ## Test plan - [x] 11 new unit tests: 5 factories + 6 app-wiring / probe adapter / pipeline build - [x] Full suite: 236 passed, 33 skipped (DB-gated), ruff clean - [x] CI file already sets IX_TEST_MODE=fake so the new code path exercises correctly
goldstein added 1 commit 2026-04-18 10:09:30 +00:00
feat(app): production wiring — factories, pipeline, /healthz real probes
All checks were successful
tests / test (push) Successful in 1m9s
tests / test (pull_request) Successful in 1m13s
ebefee4184
Task 4.3 closes the loop on Chunk 4: the FastAPI lifespan now selects
fake vs real clients via IX_TEST_MODE (new AppConfig field), wires
/healthz probes to the live selfcheck() on OllamaClient / SuryaOCRClient,
and spawns the worker with a production Pipeline factory that builds
SetupStep -> OCRStep -> GenAIStep -> ReliabilityStep -> ResponseHandler
over the injected clients.

Factories:
- make_genai_client(cfg) -> FakeGenAIClient | OllamaClient
- make_ocr_client(cfg)   -> FakeOCRClient  | SuryaOCRClient (spec §6.2)

Probes run the async selfcheck on a fresh event loop in a short-lived
thread so they're safe to call from either sync callers or a live
FastAPI handler without stalling the request loop.

Drops the worker-loop spawn_worker_task stub — the app module owns the
production spawn directly.

Tests: +11 unit tests (5 factories + 6 app-wiring / probe adapter /
pipeline build). Full suite: 236 passed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
goldstein merged commit c234b67bbf into main 2026-04-18 10:09:35 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: goldstein/infoxtractor#26
No description provided.