01Tiered fallback
`llm_router.py` tries a locally running Ollama, then Gemini, then Groq, then a deterministic heuristic tier that never touches the network and never raises. A cached two-second probe decides whether Ollama is up, and every network tier catches its own exceptions so it falls through rather than propagating. I made the same rule mandatory for every free client: embeddings degrade to a hash vector, PageSpeed to local heuristics, search to empty.
02A tenancy leak
I enforce tenant isolation with a SQLAlchemy `do_orm_execute` listener that injects `WHERE tenant_id = :tenant` for any model tagged `@tenant_scoped`. I had built the criteria with `lambda model_cls, t=tenant: ...`, and SQLAlchemy caches lambda statements without tracking default arguments, so the first request's tenant id was baked in permanently and every later tenant's queries filtered on it. I fixed it by capturing the tenant as a tracked closure variable; until then I had been papering over the symptom with `_bypass_tenancy=True` escape hatches.
03Edge URL validation
I front the public `/grade` endpoint with a TypeScript Cloudflare Worker whose URL validator rejects non-http(s) schemes, private and loopback IP literals, reserved TLDs, userinfo credentials and oversized URLs. The file states plainly that edge validation is necessary but not sufficient, and that the backend must re-resolve the hostname at connect time to defend against DNS rebinding. I wrote the limit down rather than assume it away.
04Labelled, not implied
Without paid engine APIs you cannot capture literal ChatGPT output, so I route all five engines through one free pipeline: live DuckDuckGo results fed to the free LLM with per-engine personas, every result labelled free-web-synthesis rather than dressed up as real engine output. Brand detection runs three layers, exact substring, then fuzzy match against canonical brand variants, then an LLM implicit-reference check only when the first two miss. I skip layer three deliberately for competitors, so cost stays flat however many a project tracks.
05A dead flag
I declare `free_mode` once in `config.py` and read it nowhere, and my `docker-compose.yml` sets `FREE_MODE: "true"` on two services where it does nothing. It reads like the switch that turns the free stack on, and it is not one: inside the containers `backend/.env` is dockerignored and never copied, so the mock-on defaults win and the compose path serves fixtures. Real crawls need `CRAWLER_MODE` flipped off its mock default as well. A loose end I own.