Put every Claude call behind one helper in the Python service

rowing.py and jobs.py repeated the same call, error mapping, fence
stripping and validation; that now lives in claude.ask_json, and the
internal routes share one wrapper and one exception handler in main.py.

Add /internal/email/classify, which takes over the email pipeline's
Claude call from the Go backend (prompt ported verbatim, plus a sentence
fencing the email off as data).

The internal-only guard is now a dependency, so a request that came
through nginx gets 404 even when its body is invalid, where it used to
get 422.

requirements-dev.txt adds pytest and httpx on top of requirements.txt so
the tests run on a host; the image still installs only requirements.txt.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-12 14:39:18 +01:00
co-authored by Claude Opus 5.5
parent 2786bce022
commit 307268fbea
11 changed files with 875 additions and 180 deletions
+2 -4
View File
@@ -3,7 +3,5 @@ uvicorn[standard]==0.34.0
requests==2.32.3
anthropic==1.12.1
# Dev only, deliberately commented out so the image stays slim: the test suite
# (python/tests) needs pytest. Install it with `pip install pytest` locally and
# run `python -m pytest` from this directory.
# pytest==9.0.3
# Runtime only - this is all the Docker image installs. What the test suite
# (python/tests) needs on top lives in requirements-dev.txt.