Skip to content

Share Contact silently fails for MeshCore TCP (Companion) sources #3480

Description

@Yeraze

Description

The Share Contact action does nothing when used with a MeshCore Companion source connected via TCP (tested with pymc and official firmware v1.15, MeshMonitor v4.10.2 Docker). No advert packet appears in the Packet Monitor or MQTT observer. The user gets no actionable error — the UI shows a generic failure string or nothing at all.

Root Cause

Three layers combine to produce a silent failure:

1. Native backend (src/server/meshcoreNativeBackend.ts:887–896)
c.shareContact(publicKey) calls meshcore.js over the TCP connection. If the firmware doesn't ACK CMD_SHARE_CONTACT (opcode 16) or the socket is degraded, the call throws. The error propagates up to sendBridgeCommand, which returns { success: false }.

2. Manager swallows the error (src/server/meshcoreManager.ts:2067–2087)
The shareContact() method logs a WARN and returns false, which causes the HTTP route to respond with 409 — but the descriptive error text from the backend is available and not forwarded.

3. UI ignores the server error text (src/components/MeshCore/MeshCoreContactDetailPanel.tsx:344)
The 409 response body contains the real error, but the component discards it and displays a hardcoded generic i18n string, giving the user zero actionable information.

Why "advert broadcasted" appears in other cases

That green notification fires from the source's own firmware-join advert — a different code path. It is unrelated to the Share Contact button.

Reproduction Steps

  1. Connect a MeshCore Companion source via TCP (pymc or official firmware v1.15).
  2. Open a contact → Actions → Share Contact → OK.
  3. No advert packet appears in Packet Monitor or MQTT observer.
  4. Check Docker logs: docker logs meshmonitor | grep "share_contact" — a WARN log with the real failure reason is present but never surfaced to the user.

Relevant Files

File Lines Role
src/server/meshcoreNativeBackend.ts 887–896, 1326–1342 dispatch handler + resolvePublicKey
src/server/meshcoreManager.ts 2067–2087 shareContact(), device type gate
src/server/routes/meshcoreRoutes.ts 716–722 HTTP route, 409 response
src/components/MeshCore/MeshCoreContactDetailPanel.tsx 213–214, 344 UI gate + error display
src/components/MeshCore/hooks/useMeshCore.ts 847–863 React hook

Suggested Fix

  1. Propagate server error text to UI — in MeshCoreContactDetailPanel.tsx:344, use the error field from the 409 response body instead of the hardcoded i18n string.
  2. Add TCP-specific diagnostics — in meshcoreNativeBackend.ts:894, log the rejection/result from c.shareContact() before it propagates so the WARN log identifies whether it's a socket issue or firmware non-response.

Authored by NodeZero 0️⃣

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions