SPB Git

Repository Public

ADR-0001-python-single-codebase.md 1.4 KB 22 lines markdown

1# ADR-0001 — One Python codebase for control and data plane (Swift for OCR only)23Status: accepted, 2026-12-04. Reversible.45Context. The mandate proposes Go (gateway), TypeScript/Playwright (navigation), Python (extraction,6MLX), Swift (OCR), "to be confirmed after the audit". The audit shows that the existing engine7(KVCE) is Python + Playwright-for-Python + Swift + mlx_vlm, that every candidate node already has8`uv`, and that Go and Node are absent from many of them.910Decision. Gateway, orchestrator, workers, extraction and fusion are one Python 3.12+ package11(`src/spider`), with FastAPI/asyncpg/aiohttp and Playwright for Python. Only the OCR worker is12native (Swift, `services/ocr-worker`). Control plane and data plane stay strictly separated *by13process and by protocol*, not by language: workers hold no database credentials and talk to the14gateway through a versioned internal HTTP API.1516Consequences. One contract definition (`spider/contracts.py`, pydantic) serves the API, the workers,17the CLI and the tests. A Go gateway can replace the Python one later behind the same OpenAPI18document if profiling shows the gateway is the bottleneck (not measured so far: the browser is).19The directory layout of the mandate is kept at the top level (`apps/`, `services/`, `sdk/`,20`infra/`, `migrations/`, `tests/`, `docs/`), with the Python services living in `src/spider/`21as sub-packages instead of one directory per service.22
Files main
Menu

Theme