Thomas KarnerandClaude Opus 5 269a6eadcb Add GET /firmware/{version}.bin, and fix test teardown (Phase 2)
The last device endpoint. With it, the whole firmware/API.md contract is
implemented apart from /stream, which is Phase 6.

The device checks three things before it erases a partition
(ota_mgr.cpp:110-128): status exactly 200, a Content-Length header at all -
it refuses chunked, because it wants to size-check first - and that length
equal to the size the envelope advertised. FileResponse gives an exact
length from the file, and the camera's :8080 Caddy block has no encode
directive, so nothing recompresses it on the way out.

A row whose file is missing, or whose file does not match its recorded size,
is 503 with a loud log rather than a quiet 404. The device would abort on the
Content-Length check anyway; failing here turns a confusing remote abort into
one clear server line.

A test walks the whole OTA handshake: heartbeat names a target, and the
relative URL it advertises is fetched the way ota_mgr builds it, base plus
url, and the bytes hash to the advertised sha256.

The admin-facing POST /firmware is not included. It needs user auth and an
admin role, neither of which exists yet (SEC-007).

Also fixes a real defect in the tests. Several put their cleanup at the end
of the test body, so a failing assertion skipped it. A deliberate mutation
made two tests fail, which left two is_target firmware rows behind, and
those rows then picked themselves as the OTA target for unrelated tests -
one broken thing looked like three. Teardown now lives in fixtures and runs
whatever happens. Re-running the same mutation now fails exactly the two
tests it should and leaves the database clean.

Tests: 148 -> 158.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-21 13:19:26 +02:00
S
Description
Bird feeder with cam + radar sends pics to database with UI for watching pics and editing bird's attributes
19 MiB
0 Stars 1 Watchers 0 Forks
Languages
Python 59.2%
C++ 20%
TypeScript 10.7%
C 7%
CSS 2.2%
Other 0.8%