SPB Git

Repository Public

REPOSITORY_AUDIT.md 6.0 KB

# Repository and infrastructure audit — 2026-12-04

Everything below was observed on that date by commands run from the operator laptop; nothing is assumed. Commands are given so the audit can be repeated.

# 1. KVCE (KA Visual Connector Engine) — the prior art

The reference document describes KVCE as "5 433 lines, Playwright, Chromium/WebKit, OCR Apple Vision, MLX multimodal, segmentation, fusion, SQLite coordinator". The real code was read on the kvce branch of both repositories (git clone --depth 1 -b kvce gitsrv:srv/git/<repo>.git, read-only, in a scratch directory; neither repository nor any deployed service was modified).

lou-ka.git immo-ka.git
Commit read 27326e5 73e648c
Files matching kvce 62 61
Lines in those files (code, tests, docs, deploy) 9 383 9 238
kvce/ package itself (Python + JS + Swift) ≈ 4 900 ≈ 4 900

Findings:

  • Two copies that have diverged. The design says the package is "copied identically" in both repositories with a manifest check; diff -rq lou-ka/kvce immo-ka/kvce reports every one of the 23 source files as different (headers and later fixes). There is no shared package.
  • Stack: Python 3, Playwright ≥ 1.56 (Chromium, WebKit possible), a 152-line Swift tool (VNRecognizeTextRequest + VNClassifyImageRequest, one process per call), mlx_vlm with mlx-community/Qwen2.5-VL-3B-Instruct-4bit (one process per question), a SQLite job queue held by a single coordinator process over HTTP with a shared token.
  • Domain-specific: profiles, field ranges, extraction heuristics (extract.py, 874 lines), photo pipeline and bridges are written for rental and real-estate listings. They are not general.
  • Licence and ownership: all files carry the SP Boucher header, licence ISC, owner Simon-Pierre Boucher. No third-party code was found in kvce/.
  • Tests: 13 test modules under tests/kvce_tests/ (policy, queue, extraction, photos, bridge…).
  • Policy model worth keeping: refusal/CAPTCHA/login wall = suspension with doubling, never a bypass; no account on third-party sites; TLS errors are not ignored; the bot names itself; values are never invented; a vision answer must be found again by OCR before it is accepted.
  • State: in production for one source only (apartments.com on Lou-Ka, manual bridge); the rest is built and measured but not activated.

# Reuse decision

KVCE element Decision for SPIDER Why
Access rules (refusal detection markers, suspension doubling, UA naming) Re-implemented from the same rules (spider/refusal.py, spider/browser/refusal.py, orchestrator._suspend) Rules are right; code is tied to KVCE state files
Swift Vision tool Rewritten as services/ocr-worker (serve mode, banding, orientation, alternatives, quads) One process per image does not scale; no batch protocol
MLX runner Rewritten as a warm process with a queue (spider/vision/) KVCE reloads the model for every question
"Vision answer must be attested by OCR" Kept as the deterministic guard of vision/client.py Central anti-hallucination / anti-injection rule
Confidence table (JSON-LD 0.95, DOM 0.90, OCR 0.55×, vision 0.50) Kept as heuristic priors, explicitly not probabilities; calibration tooling added Mandate §12
snapshot.js, browser.py scroll/settle Inspiration only; new stability criteria, tiling, state graph KVCE relies on networkidle and fixed sleeps
SQLite queue + coordinator Not reused; PostgreSQL leases with fencing tokens Multi-worker, multi-tenant, restart-safe
Listing extraction, profiles, photos, bridges Not reused Domain-specific

Compatibility strategy: SPIDER does not import, vendor or modify KVCE. Lou-Ka and Immo-Ka keep their KVCE unchanged. A later migration path is to make the KVCE "bridge" call SPIDER's API (examples/integrations/groupe_ka.py shows the call); that is a change in those repositories and needs the owner's decision.

# 2. Infrastructure actually available (mld scan, mld status, 2026-12-04)

  • 29 LAN Macs (Apple Silicon, 8–96 GB), 14 rented Macs (Macly, MacStadium), 7 OVH Linux servers. No node is assumed free: mld status lists 72 deployed apps.
  • Nodes without any PM2 app at audit time: M4BP48, M4BP36, M4M36, m4mc, m4ma, m4mb, m2m16, M3BA24, M3BA16, m2m8a, m2m8b (LAN); all Macly/MacStadium minis. BHS128, R9128 and R764 are documented as empty; BHS64 is the public gateway and mail server; BHS64b, BHS128b and BHS192 are production for other projects and must not be used.
  • Runtimes on candidate nodes: Homebrew, git, uv everywhere; Node/pm2 and PostgreSQL 17 only on some (see mld scan). Apple Vision needs macOS; MLX needs Apple Silicon with enough free memory.
  • Outbound address: every LAN Mac leaves through one residential address. Per-host politeness is therefore enforced centrally (one request in flight per host for the whole fleet). Rented Macs and OVH servers have other addresses; SPIDER does not use them to get around a source's restrictions (ADR-0005).
  • Ports: 8900–8909 are unused in the mld registry (highest allocated: 9320, 9210, 8880…); 8900 is taken as SPIDER's gateway port, to be confirmed by mld at deployment.
  • DNS: spider.spboucher.ai already resolves to 51.161.112.61 (BHS64, the tunnel gateway) — a wildcard, no record was created or changed. No Caddy route exists for it yet.
  • Git: https://git.spboucher.ai/spider did not exist (HTTP 404) and was created public by sp-git init on 2026-12-04.
  • Shared storage: OVH Enterprise File Storage 2 TB mounted on /opt/efs (Macs) and /mnt/efs (servers), NFSv3 without locks. Suitable for the content-addressed blob store (immutable files, atomic rename); not suitable for PostgreSQL data.

# 3. Toolchain on the build machine

Python 3.13 (uv), Playwright 1.65 (Chromium, WebKit), Swift 6.4, PostgreSQL 17.9, Node 26, Go 1.26, Docker 29. NATS, DuckDB and OpenSearch are not installed anywhere in the fleet.

Files main
Menu

Theme