Trim comments to the non-obvious why
Test and deploy / test (push) Successful in 28s
Test and deploy / deploy (push) Successful in 31s

Drop narration, history and restated-code comments across the repo,
keep short ones for security boundaries, upstream quirks and ordering
constraints, and record the convention in CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-24 20:49:03 +00:00
co-authored by Claude Opus 5.5
parent effddd2794
commit 4530cb8dc4
222 changed files with 1173 additions and 5423 deletions
+5 -13
View File
@@ -1,20 +1,12 @@
"""Read a rowing machine display from a photo with Claude.
This is the image half of the Go backend's admin-only POST /rowing. The Go
handler keeps everything that needs the database or the session cookie - the
admin gate, the EXIF date, the duplicate check, the sanity bounds, the insert -
and hands the image here only once it has decided the Claude call is worth
paying for. This module just turns pixels into three numbers.
Like `travelodge`, it never imports FastAPI; `main` is the HTTP skin.
The Go handler does auth, EXIF, dedup and bounds; this only turns pixels into
three numbers.
"""
from pydantic import BaseModel, Field
# Re-exported under the names this module has always had: the tests reach the
# exceptions and the fence stripping through `rowing`. `_client` is the seam
# they replace to fake the API, which is why it is handed to ask_json below
# rather than left to its default.
# `_client` is the seam the tests replace.
from .claude import MODEL, NotConfigured, ReadError, ask_json, strip_markdown_fence
from .claude import client as _client
@@ -23,8 +15,8 @@ __all__ = ["MODEL", "NotConfigured", "ReadError", "RowingReading", "read_display
# The answer is a three-key JSON object, so this is a ceiling, not a target.
MAX_TOKENS = 256
# The keys named here are the JSON contract: RowingReading's field names below
# and ExtractedRowingData in backend/handlers/handle_rowing.go must match them.
# Keys must match RowingReading below and ExtractedRowingData in
# backend/handlers/handle_rowing.go.
PROMPT = """Look at this rowing machine display. Extract the total elapsed time and total distance.
Return ONLY a JSON object with these exact keys and numeric values: