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>
This commit is contained in:
1 parent
05f144ed98
commit
c40072f644
2 files changed
+55
-19
No files matched your search
+21
-5
@@ -1,9 +1,24 @@
|
||||
# poorBird server
|
||||
|
||||
Phase 1 skeleton: configuration, schema, health, job queue and scheduler.
|
||||
There are **no device endpoints yet** — `/enroll`, `/ingest`, `/heartbeat`,
|
||||
`/status` and `/config` are Phase 2. The contract they must satisfy is
|
||||
[`../firmware/API.md`](../firmware/API.md).
|
||||
Phases 1 and 2: configuration, schema, health, job queue, scheduler, and every
|
||||
endpoint the camera calls.
|
||||
|
||||
```
|
||||
POST /api/v1/enroll X-Enroll-Secret, returns a bearer token
|
||||
POST /api/v1/ingest raw JPEG body, metadata in headers
|
||||
POST /api/v1/heartbeat conditions in, envelope + commands out
|
||||
POST /api/v1/status conditions in, 204 out
|
||||
GET /api/v1/config ~40 optional keys the device merges
|
||||
POST /api/v1/commands/{id}/ack 204
|
||||
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.
|
||||
|
||||
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,8 @@ src/poorbird/
|
||||
logging_setup.py stdout only; journald or a log driver catches it
|
||||
db.py engine + session factory (sync, deliberately)
|
||||
models/ SPEC §3 schema + the SPEC §0 additions
|
||||
api/ FastAPI app; Phase 2 mounts device routes here
|
||||
images.py JPEG sniffing, atomic writes, thumbnails
|
||||
api/ FastAPI app, device routes, auth, rate limiting
|
||||
worker/ queue (SKIP LOCKED), handlers, scheduler
|
||||
cli.py serve | worker | migrate | check | enqueue
|
||||
migrations/ Alembic
|
||||
|
||||
Reference in new issue
Block a user