Skip to content

[BUG] Node position override saved to non-rendered source row (override not applied) #2902

Description

@Paccoco

🐛 Bug: Node position override not applied (saved to wrong source row)

Summary

When using Override Node Position, the UI accepts and saves the override, but the node does not move on the map.

Investigation shows the override is saved to a different database row (sourceId = 'default') than the one used for rendering (sourceId != 'default').


Environment

  • MeshMonitor: 4.2.0
  • Deployment: Docker
  • Database: PostgreSQL (external/shared instance)
  • Meshtastic connection: LAN node
  • Host OS: TrueNAS SCALE

Steps to Reproduce

  1. Open MeshMonitor UI
  2. Select a node (example: !38911199)
  3. Click Override Node Position
  4. Move the node and save
  5. Refresh the map

Expected Behavior

  • Node moves to the overridden position
  • Override persists across refresh/restart
  • Database reflects override on the active node record

Actual Behavior

  • UI accepts and saves override
  • No visible change on the map
  • Behavior persists after refresh and container restart

Database Evidence

The nodes table contains multiple rows per node, separated by sourceId.

Example query:

SELECT
  "nodeNum",
  "nodeId",
  "positionOverrideEnabled",
  "latitudeOverride",
  "longitudeOverride",
  "sourceId"
FROM nodes
WHERE "nodeId" = '!38911199'
ORDER BY "sourceId";

Result:

nodeNum   | nodeId     | overrideEnabled | latitudeOverride  | longitudeOverride  | sourceId
----------+------------+----------------+-------------------+--------------------+--------------------------------------
949031321 | !38911199  | false          | NULL              | NULL               | cafb61a3-cc99-484c-a4db-3e543a7584b3
949031321 | !38911199  | true           | 36.62958541301912 | -87.38718621039722 | default

Key Finding

  • Override is saved to:

    sourceId = 'default'
    
  • Map renders node from:

    sourceId = <live source>
    

➡️ The override is never applied to the row used for rendering, so it has no visible effect.


Workaround

Manually applying the override to the live-source row fixes the issue:

UPDATE nodes
SET
  "positionOverrideEnabled" = true,
  "latitudeOverride" = 36.62958541301912,
  "longitudeOverride" = -87.38718621039722,
  "positionOverrideIsPrivate" = false,
  "updatedAt" = FLOOR(EXTRACT(EPOCH FROM NOW()) * 1000)
WHERE "nodeId" = '!38911199'
  AND "sourceId" != 'default';

After restarting MeshMonitor, the node moves correctly.


Suspected Cause

  • Multiple rows exist per node (nodeId, nodeNum) across different sourceId values
  • Override logic writes only to sourceId = 'default'
  • Rendering logic uses a different row (live source)
  • No reconciliation between override data and active node source

Suggested Fix

One of the following:

  • Apply override to all rows matching nodeId
  • Apply override specifically to the active/live source row
  • Ensure rendering prioritizes rows where positionOverrideEnabled = true
  • Consolidate or deduplicate node records across sources

Impact

  • Overrides appear broken to users
  • Requires manual database intervention
  • Confusing UX (UI shows success but nothing changes)

Additional Notes

  • Issue reproducible across multiple nodes
  • Not related to storage, permissions, or container configuration
  • Likely affects PostgreSQL deployments due to multi-source row handling

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions