upsert_node clears coordinates when subsequent nodeinfo packet contains no position data #143

Closed
opened 2026-10-04 23:02:20 +02:00 by adam · 0 comments
Owner

Description

When a node sends a NODEINFO_APP packet without position data after previously having coordinates stored, the upsert_node handler overwrites the latitude/longitude/altitude fields in the nodes table with NULL. This causes the node to disappear from the map even though valid position data exists in the positions table and was previously stored in nodes.
Steps to reproduce

Node sends a packet with position data — coordinates are stored in nodes table correctly
Node sends a subsequent NODEINFO_APP packet without position data (this is normal behavior — nodeinfo and position are separate packet types in Meshtastic)
upsert_node is called with a payload that has no position field
Coordinates in nodes table are overwritten with NULL
Node disappears from the map

Evidence from ingestor logs

First upsert with position (10:54 UTC):

payload contains: "position": {"altitude": 271, "latitude": 53.8673152, "longitude": 27.5283968, ...}

Second upsert without position (17:28 UTC) — normal nodeinfo packet:

payload contains no "position" field

After the second upsert, /api/nodes response for !f7e74be6 has no latitude/longitude fields — node disappears from map.
Meanwhile, /api/positions still has a valid recent entry for the same node.

Expected behavior
When upsert_node is called with a payload that does not include a position field, existing coordinates in the nodes table should be preserved, not overwritten with NULL.
The update SQL for coordinates should only execute when position data is actually present in the incoming payload.

Environment
potato-mesh v0.5.11
Ingestor connected via TCP to Heltec V4 node
Node role: CLIENT_MUTE, hw: HELTEC_MESH_POCKET

P.S. Big thx for amazing software 👽

**Description** When a node sends a NODEINFO_APP packet without position data after previously having coordinates stored, the upsert_node handler overwrites the latitude/longitude/altitude fields in the nodes table with NULL. This causes the node to disappear from the map even though valid position data exists in the positions table and was previously stored in nodes. Steps to reproduce Node sends a packet with position data — coordinates are stored in nodes table correctly Node sends a subsequent NODEINFO_APP packet without position data (this is normal behavior — nodeinfo and position are separate packet types in Meshtastic) upsert_node is called with a payload that has no position field Coordinates in nodes table are overwritten with NULL Node disappears from the map **Evidence from ingestor logs** First upsert with position (10:54 UTC): ```context=handlers.upsert_node node_id='!f7e74be6' payload contains: "position": {"altitude": 271, "latitude": 53.8673152, "longitude": 27.5283968, ...} ``` Second upsert without position (17:28 UTC) — normal nodeinfo packet: ```context=handlers.store_nodeinfo node_id='!f7e74be6' payload contains no "position" field ``` After the second upsert, /api/nodes response for !f7e74be6 has no latitude/longitude fields — node disappears from map. Meanwhile, /api/positions still has a valid recent entry for the same node. **Expected behavior** When upsert_node is called with a payload that does not include a position field, existing coordinates in the nodes table should be preserved, not overwritten with NULL. The update SQL for coordinates should only execute when position data is actually present in the incoming payload. **Environment** potato-mesh v0.5.11 Ingestor connected via TCP to Heltec V4 node Node role: CLIENT_MUTE, hw: HELTEC_MESH_POCKET P.S. Big thx for amazing software 👽 <!-- github-sync-id:4116790388 -->
adam closed this issue 2026-10-04 23:02:20 +02:00
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/potato-mesh#143