fix: NaN telemetry writes, docker-compose port exposure, /v1/events docs#530
Merged
Conversation
Postgres was published on 0.0.0.0:5432 with the committed default password, and docker-published ports bypass host firewalls (ufw), so any network-reachable host could read/write the DB. Nothing external needs it: the app reaches Postgres over the compose network and the backup/migrate scripts use docker exec. The API (9000) and SPA (8000) now bind to 127.0.0.1 — caddy is the public entry for both. Mosquitto stays fully published by design (WAN gateways publish uplinks to it) with a pointer to the broker-auth sample config. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
proto3's JSON mapping serializes non-finite floats as the strings "NaN"/"Infinity"/"-Infinity"; asyncpg can bind neither those strings nor real NaN/inf floats into numeric columns, so one bad sensor value made the whole node + telemetry-current write fail (seen daily in production from node 75e1c1bc since 2026-07-12). Map non-finite values to NULL at the typed-column boundary; everything else passes through. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fix(storage): don't fail node writes on non-finite telemetry values
proto3's JSON mapping serializes non-finite floats as the strings
"NaN"/"Infinity"/"-Infinity"; asyncpg can bind neither those strings norreal NaN/inf floats into numeric columns, so one bad sensor value made the
whole node + telemetry-current write fail. Observed in production: a node with
a faulty environment sensor lost all telemetry persistence, erroring daily.
Non-finite values are now mapped to NULL at the typed-column boundary in
_write_node_telemetry_current; everything else passes through unchanged.Includes regression tests (
TestFiniteOrNone).fix(compose): stop publishing postgres/API/SPA ports on all interfaces
docker-compose.ymlpublished postgres on0.0.0.0:5432with the committeddefault password — and docker-published ports bypass host firewalls (ufw), so
any network-reachable host could read/write the DB. Nothing external needs it:
the app reaches postgres over the compose network, and the backup/migrate
scripts use
docker exec.docker execpath andthe
127.0.0.1override option for host access)127.0.0.1— caddy is thepublic entry for both
uplinks to it), with a pointer to the broker-auth sample config
docs(api): document the /v1/events SSE endpoint
The SSE stream powering live map/chat/telemetry/coverage updates was absent
from API.md's endpoint tables.