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>
This commit is contained in:
Thomas KarnerandClaude Opus 5 committed 2026-09-21 00:30:52 +02:00
1 parent 8a51e3d95e
commit 5d16ded553
6 files changed
+99 -9

No files matched your search

+3 -2
View File
@@ -28,7 +28,7 @@ Anything here that contradicts SPEC means SPEC needs an edit, not a workaround.
| Firmware | Written, compiles, **never run on hardware**. Known gaps below. |
| Device↔server contract | Specified in full (`firmware/API.md`). Nothing implements the server half. |
| Data model | Designed (SPEC §3) + §0 additions. No migration written. |
| Server | Phase 1 skeleton in [`server/`](server/) — config, schema, health, job queue, scheduler, systemd units. **Not yet run against a real PostgreSQL.** |
| Server | Phase 1 skeleton in [`server/`](server/) — config, schema, health, job queue, scheduler, systemd units. Verified end to end on Python 3.14.7 against PostgreSQL 17: 12/12 tests, migrations applied, API serving, worker draining the queue. Not yet on the real host. |
| WebUI | **Nothing exists.** |
---
@@ -83,7 +83,8 @@ written vs. what still needs doing on the real host:
- [x] systemd units `poorbird-api.service` + `poorbird-worker.service`, `After=postgresql.service`, restart policies, sandboxing
- [x] Caddyfile with DNS-01 TLS, the `:8080` plain-HTTP camera listener and the auth-checked image handoff
- [x] `poorbird check` — validates config, paths and DB before anything starts
- [ ] **Run it against a real PostgreSQL** — nothing here has executed yet; `pytest` and `poorbird check` are the first two commands
- [x] **Run it against a real PostgreSQL** — done on the dev machine (uv-managed Python 3.14.7, Podman `postgres:17`): `poorbird check`, `migrate`, `serve`, `worker` and 12/12 tests all green
- [ ] Repeat the same four commands on the actual thin client, which is the run that counts
- [ ] Base install on the thin client: static IP (or DHCP reservation) and **hardcode that address in firmware** — more reliable than mDNS
- [ ] PostgreSQL 17 from the distro or PGDG repo; dedicated role + database; **loopback TCP with `scram-sha-256`, not a Unix socket** (see 1.2)
- [ ] Caddy DNS provider plugin build (`caddy add-package …`) and a real hostname