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>
This commit is contained in:
Thomas KarnerandClaude Opus 5 committed 2026-09-21 22:01:35 +02:00
1 parent 29c8cf6bfe
commit f9d0b09d2f
4 files changed
+46 -22

No files matched your search

+28 -10
View File
@@ -1,7 +1,10 @@
# poorBird server
Phases 1 and 2: configuration, schema, health, job queue, scheduler, and every
endpoint the camera calls.
Phases 1 and 2 plus the Phase 3 server half: configuration, schema, health, job
queue, scheduler, every endpoint the camera calls, and user auth with the
gallery's API behind it.
**Device endpoints** — bearer token, no cookies:
```
POST /api/v1/enroll X-Enroll-Secret, returns a bearer token
@@ -14,11 +17,23 @@ GET /api/v1/firmware/{version}.bin OTA image, exact Content-Length
GET /api/v1/health
```
[`../firmware/API.md`](../firmware/API.md) is the contract, and it wins over
anything here: it is what the firmware already does, and the camera is the side
that cannot be patched from a laptop once it is mounted outdoors. The operator
half — firmware *upload*, device management, the gallery — needs user auth and
arrives with Phase 3.
**Operator endpoints** — session cookie + CSRF, never a bearer token:
```
POST /api/v1/auth/login password + TOTP, sets the session cookie
POST /api/v1/auth/logout 204, and the session row is deleted
GET /api/v1/auth/session who am I, or 401
GET /api/v1/captures cursor-paged, filterable
GET /api/v1/captures/{id} detail incl. observations and tags
GET /api/v1/captures/{id}/image authorized, then handed to Caddy
GET /api/v1/captures/{id}/thumb 404 when the thumbnail job has not run
```
[`../firmware/API.md`](../firmware/API.md) is the contract for the device half,
and it wins over anything here: it is what the firmware already does, and the
camera is the side that cannot be patched from a laptop once it is mounted
outdoors. Of the operator half, auth and the gallery exist; firmware *upload*
and device management are Phase 4.
Stack per SPEC §6, deployed natively per [`../TODO.md`](../TODO.md) Phase 1.2:
FastAPI + PostgreSQL 17 + SQLAlchemy 2.0 + Alembic, run as systemd units
@@ -108,7 +123,7 @@ Queue and schema tests need a real PostgreSQL — `FOR UPDATE SKIP LOCKED` has
no equivalent elsewhere, and mocking it would test nothing. They skip
automatically when the database is unreachable, so a green run with no
Postgres proves less than it looks. **Check for `skipped` in the summary**;
a complete run is 12 passed, 0 skipped.
a complete run is 308 passed, 0 skipped.
`test_schema_matches_models.py` creates and drops a `poorbird_schema_check`
database on the same server. It needs a role that may `CREATE DATABASE`.
@@ -124,9 +139,12 @@ src/poorbird/
db.py engine + session factory (sync, deliberately)
models/ SPEC §3 schema + the SPEC §0 additions
images.py JPEG sniffing, atomic writes, thumbnails
api/ FastAPI app, device routes, auth, rate limiting
passwords.py Argon2id — slow on purpose, unlike the device tokens
totp.py 2FA secrets, provisioning URIs, code verification
seed.py synthetic captures, so the gallery has volume to face
api/ FastAPI app, device + operator routes, auth, rate limiting
worker/ queue (SKIP LOCKED), handlers, scheduler
cli.py serve | worker | migrate | check | enqueue
cli.py serve | worker | migrate | check | enqueue | user | seed
migrations/ Alembic
deploy/ systemd units, Caddyfile, env template, INSTALL.md
tests/