feat(clients): OCRClient + GenAIClient protocols + fakes #10

Merged
goldstein merged 1 commit from feat/client-protocols into main 2026-04-18 09:08:38 +00:00
Owner

Chunk 2, Task 2.2.

Adds ix.ocr and ix.genai packages with runtime-checkable Protocols and hermetic Fake clients per spec §6.2/§6.3. Real Surya/Ollama clients land in Chunk 4.

Tests

8 new unit tests (120 total) — protocol conformance via isinstance, canned-return behaviour, default/explicit usage + model_name, and raise_on_call propagation.

uv run pytest tests/unit -q → 120 passed.
uv run ruff check src tests → clean.

Merge gate

Forgejo Actions trigger bug is still in effect — local test + ruff are the gate.

Chunk 2, Task 2.2. Adds `ix.ocr` and `ix.genai` packages with runtime-checkable Protocols and hermetic Fake clients per spec §6.2/§6.3. Real Surya/Ollama clients land in Chunk 4. ## Tests 8 new unit tests (120 total) — protocol conformance via isinstance, canned-return behaviour, default/explicit usage + model_name, and raise_on_call propagation. `uv run pytest tests/unit -q` → 120 passed. `uv run ruff check src tests` → clean. ## Merge gate Forgejo Actions trigger bug is still in effect — local test + ruff are the gate.
goldstein added 1 commit 2026-04-18 09:08:34 +00:00
feat(clients): OCRClient + GenAIClient protocols + fakes (spec §6.2, §6.3)
All checks were successful
tests / test (push) Successful in 1m0s
tests / test (pull_request) Successful in 1m1s
118a9abd09
Adds the two Protocol-based client contracts the pipeline steps depend on,
plus test-oriented fakes. Real engines (Surya, Ollama) land in Chunk 4.

- ix.ocr.client.OCRClient — runtime_checkable Protocol with async ocr().
- ix.genai.client.GenAIClient — runtime_checkable Protocol with async
  invoke(); GenAIInvocationResult + GenAIUsage dataclasses carry the
  parsed model, token usage, and model name.
- FakeOCRClient / FakeGenAIClient: return canned results; both expose a
  raise_on_call hook for error-path tests.

8 unit tests across tests/unit/test_ocr_fake.py + test_genai_fake.py
confirm protocol conformance, canned-return behaviour, usage/model-name
defaults, and raise_on_call propagation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
goldstein merged commit 2709fb8d6b into main 2026-04-18 09:08:38 +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#10
No description provided.