Commit Graph
4 Commits
Author SHA1 Message Date
Thomas KarnerandClaude Opus 5 f9d0b09d2f Correct the docs the gallery work made wrong
Housekeeping, not new behaviour. The status table still said the WebUI was
"nothing beyond the Vite scaffold" and the server was "Phases 1 and 2" at 194
tests, all of which stopped being true three commits ago. A status table that
is wrong is worse than no status table: it is the first thing read and the last
thing checked.

Endpoint lists in server/README.md were taken from the app's own OpenAPI
schema rather than from memory, which is how the last round of this found that
/ingest was documented as multipart when it is a raw body. The operator half is
now listed separately from the device half, because the two authenticate in
ways that must not be mixed up -- bearer token and no cookies on one side,
session cookie plus CSRF on the other.

Ticked auth-checked image serving, which shipped in 735cbcc, and recorded why
there are two delivery paths and only one authorization path.

The test count is 308 because the suite was run, not because 308 was the number
I remembered.

Two comments in api/app.py contradicted the code beside them. One said the
enroll-secret warning was "not fatal at Phase 1 -- no device endpoint exists
yet", six lines above the device endpoints being mounted; it now says the real
reason the API starts anyway, which is that an enrolled camera keeps working
and refusing to start would take the gallery down too. The other said the
Phase 3 UI endpoints were still to come, directly below the two lines that
mount them.

Left alone deliberately: the "12/12 tests" in docs/reviews/**. Those are
point-in-time review snapshots, and updating them to current numbers would
destroy the only thing they are for.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 22:01:35 +02:00
Thomas KarnerandClaude Opus 5 c40072f644 Correct the docs that Phase 2 made wrong
Both entry-point documents still described the server as a Phase 1 skeleton,
which is the kind of drift that costs someone an afternoon before they think
to distrust the README.

server/README.md opened with "There are no device endpoints yet". There are
eight, so it now lists them, checked against the mounted routes rather than
from memory. images.py joins the layout; api/ no longer says Phase 2 will
mount routes there one day.

TODO.md Phase 2 had every box unticked. Ticked with what was actually built,
and the three deviations from the plan written down where the plan was wrong:

  - /ingest was specified as "multipart image + JSON meta". The firmware
    sends a raw JPEG body with the metadata in headers. Multipart was a
    misreading of API.md, and the note now says so, because the next person
    to read the old line would implement the wrong endpoint.
  - "server_time in every response" is not compatible with /status being
    204, which API.md requires. The envelope goes on /heartbeat and /ingest.
  - Enroll accepts a device's own reenroll_secret as well as the shared
    bootstrap secret. Checking only the shared one, as the review's sample
    code did, locks out every device that has ever enrolled.

Two boxes stay open, and they are the honest ones: no gallery page, and no
end-to-end run against real hardware. The server half is proven only against
synthetic uploads, and the status table now says that rather than implying a
verified path.

Also recorded two deliberate deferrals that were living only in a
conversation, which is the same as not existing:

  - CORS, in Phase 3: not configured because Caddy serves the UI and the API
    from one origin, so there is no cross-origin request to permit and
    permissive headers would only weaken that.
  - The missing single-row constraint on firmware.is_target, in Phase 4
    beside the upload endpoint that will create the second target row.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 17:36:37 +02:00
Thomas KarnerandClaude Opus 5 5d16ded553 Server: verify Phase 1 end to end against PostgreSQL 17
Set up the dev environment (uv-managed CPython 3.14.7, postgres:17 in a
Podman container) and ran the skeleton for real: migrations apply, the
API serves /api/v1/health and /healthz, the worker claims a job and
drains it, 12/12 tests pass with nothing skipped.

The schema-drift test failed on its first real run and found a genuine
problem: Postgres reflects a varchar default as 'x'::character varying
while the model renders 'x', so all ten string defaults read as
permanent drift. Left alone that is the failure mode where you learn to
ignore the test and then miss the one real change. Add schema_compare.py,
a normaliser shared by migrations/env.py and the test so autogenerate and
the test can never disagree about what counts as a difference. A real
default change still fails it.

Also: ruff import-order fix in captures.py, and the README gains the
uv + Podman dev setup, the expected test count, and the CREATE DATABASE
privilege the drift test needs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 00:30:52 +02:00
Thomas Karner 8a51e3d95e Server: basic implementation. Not tested => no python installed; bugfix in ESP (uvicorn on port 8090) 2026-09-20 23:49:40 +02:00