SPB Git

Repository Public

ADR-0001-python-single-codebase.md 1.4 KB

# ADR-0001 — One Python codebase for control and data plane (Swift for OCR only)

Status: accepted, 2026-12-04. Reversible.

Context. The mandate proposes Go (gateway), TypeScript/Playwright (navigation), Python (extraction, MLX), Swift (OCR), "to be confirmed after the audit". The audit shows that the existing engine (KVCE) is Python + Playwright-for-Python + Swift + mlx_vlm, that every candidate node already has uv, and that Go and Node are absent from many of them.

Decision. Gateway, orchestrator, workers, extraction and fusion are one Python 3.12+ package (src/spider), with FastAPI/asyncpg/aiohttp and Playwright for Python. Only the OCR worker is native (Swift, services/ocr-worker). Control plane and data plane stay strictly separated by process and by protocol, not by language: workers hold no database credentials and talk to the gateway through a versioned internal HTTP API.

Consequences. One contract definition (spider/contracts.py, pydantic) serves the API, the workers, the CLI and the tests. A Go gateway can replace the Python one later behind the same OpenAPI document if profiling shows the gateway is the bottleneck (not measured so far: the browser is). The directory layout of the mandate is kept at the top level (apps/, services/, sdk/, infra/, migrations/, tests/, docs/), with the Python services living in src/spider/ as sub-packages instead of one directory per service.

Files main
Menu

Theme