46f54dbe811cdba54937a07052a34728e7f449c3
/heartbeat hands commands out and marks them delivered; this is where the device reports what became of one. The two halves stay separate because the ack may never arrive: reboot and sleep_now are acked and then the device is gone, and a device that dies mid-command never acks at all. delivered_at means "handed over", acked_at means "it ran", and the gap between them is the operational signal worth having. Three decisions: - Scoped to the calling device, and a command belonging to someone else is 404 rather than 403. Command ids are sequential, so a distinct status code would confirm that an id exists - and without the scope filter a device could close every other device's queue. Pinned by a test that also asserts the intruder did not manage to set acked_at. - Re-acking is allowed and the last word wins. The device cannot tell a lost response from a lost request, so it retries; refusing the second attempt would strand a command that actually ran. - An empty detail is stored as NULL. The firmware always sends the key, empty when it has nothing to say. Liveness deliberately stays with /heartbeat, so the device list keeps one source of truth for when a device was last heard from. Tests: 109 -> 122, including the full queued -> delivered -> acked round trip. Verified by removing the device scope from the lookup: the intruder test fails, as intended. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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%