Four documents and two fixes to the deploy directory that the documents
exposed while being written.
The repo had no root README. Cloning it landed you on a 40 KB spec and a 24 KB
plan with nothing to orient you, which mattered more once main stopped being
an empty branch. The new one links rather than duplicates, and its status table
says plainly what has never run on hardware and that there are no backups.
docs/README.USER.md and its German twin are written for someone who will use
this, not build it: what radar buys over a PIR sensor, why there is no sign-up
page, what "pre-trigger" means, what to do when the six-digit code is refused.
Every POORBIRD_* setting is described in plain language, including the two that
cost an hour each the first time they bite. The German version is a
translation, not a mechanical flip of the English.
docs/OPEN-TOPICS.AI.md is the list nobody writes: unfixed security issues,
traps, and test debt, each labelled ACCEPTED, OPEN or TRAP, because the
difference between "known trade-off" and "not done yet" is the only thing that
makes such a list usable. It ends with a section of things that are NOT
problems -- the SHA-256/Argon2id split, the frozen 0001 migration, the finite
pool_timeout -- so they stop being rediscovered and "fixed".
Two real defects surfaced while documenting the install:
Nothing served the WebUI in production. The Caddyfile's human-facing block
only reverse-proxied to FastAPI, and FastAPI mounts no static files, so a
by-the-book install produced a working API and no gallery. It now has a
file_server with a try_files fallback, because the router does client-side
routing and without it only the entry page survives a reload.
INSTALL.md never created an account. With no sign-up endpoint, following it
end to end left you at a login form with no credentials that work -- the exact
wall hit on the dev machine today, and worse on a headless host. It also never
built or copied the UI, so a git pull on the server silently kept the old
bundle; that is now its own step, with --delete spelled out because Vite emits
content-hashed filenames.
Verified: caddy validate via the official caddy:2 image reports "Valid
configuration" (with the cloudflare-DNS block stripped, since that plugin is
not in the stock image and the block is unchanged); npm run build is clean at
192 modules; all 31 relative links across every .md resolve; the committed
line endings are LF, so caddy fmt's complaint was my working tree only.
Not verified: none of the install has run on a real host. The doc says so.
One claim was wrong before it shipped: both guides said signing out ends every
session everywhere. logout calls revoke_session for the current token only --
revoke_all_for_user exists but is not called there -- so it ends that browser's
session alone, and `user passwd` is what clears them all. Corrected in both
languages.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
In-process token buckets, no Redis and no slowapi - for the same reason the
job queue has no Redis (SPEC C8). This is one uvicorn process serving a
handful of cameras on a LAN, and slowapi's default storage is in-process
anyway, so a dependency would buy convenience rather than capability.
That assumption is named in the module: poorbird serve runs a single process,
and if the deployment ever gains workers each gets its own buckets and the
effective limit multiplies. Move the state to PostgreSQL at that point rather
than widening the numbers.
Buckets rather than fixed windows, because a camera uploads three to five
frames back to back when the radar fires and then goes quiet. A window would
reject the tail of a legitimate burst that straddled a boundary.
Authenticated endpoints key on the device, so one wedged camera cannot spend
another's allowance. /enroll keys on the caller address, since there is no
device yet and it is the one place a shared secret could be ground at.
This required a Caddyfile change, not a cosmetic one: the :8080 camera block
proxied without X-Real-IP, so every camera reached the app as 127.0.0.1 and
they would all have shared one enrollment bucket - one noisy device locking
the rest out. The header is trusted only because uvicorn binds loopback.
Limits are deliberately loose, each derived from what the firmware actually
does and noted in the code so the number can be re-derived rather than
guessed at. A throttled camera stops delivering photographs, which on a
private LAN is worse than the flooding the limit prevents.
Throttling answers 429, never 401: the firmware clears its token on a 401,
and being busy is not a credential problem. Retry-After gives it something
better than a guess.
The key table is LRU-bounded. It is keyed partly on caller address, and an
unbounded map keyed by something a caller influences is itself a way to
exhaust memory.
Off by default in tests, which fire far more requests than any camera would.
tests/test_ratelimit.py turns it back on and proves the buckets are wired to
the routes.
Also fixes the same teardown-in-test-body flaw in the new file, found by
re-running a deliberate mutation and noticing a leaked device row. Teardown
is in fixtures; the mutation now fails its one test and leaves nothing
behind.
Tests: 158 -> 175.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>