Message history with delivery tracking (GET /api/messages) #8

Merged
kamilkrzywda merged 1 commits from feat/message-history into main 2026-09-24 16:19:32 +02:00
Owner

What

New GET /api/messages — in-memory history of the last 100 messages: inbound text (rx) and our sends (tx), newest first, with per-send delivery status.

Record shape:

{ "id": 123456789, "dir": "tx", "to": 67731772, "text": "hello",
  "channel": 2, "at": 1790254822000, "status": "delivered" }

Details

  • RX: inbound TEXT_MESSAGE_APP packets captured with from, text, channel, timestamp (existing log line kept)
  • TX delivery tracking: sends start pending; a ROUTING_APP packet whose Data.requestId matches our packet id resolves it — errorReason NONE (0) → delivered, any other value → failed + human-readable ackError (all Routing_Error values from the installed @meshtastic/protobufs mapped to names)
  • Broadcasts stay pending: firmware strips want_ack pre-TX, so no routing response ever arrives — documented in Swagger
  • History is bounded at 100 (oldest dropped), in-memory only, reset on reconnect — noted in endpoint docs
  • codec.ts: decodeRouting() + describeRoutingError(); verified oneof Routing.variant case "errorReason", values NONE=0/NO_ROUTE=1/GOT_NAK=2/TIMEOUT=3 against the installed package

Verification

  • npm run build ✓
  • npm test — 22/22 passed (was 18, +4: rx capture, ACK→delivered, NACK TIMEOUT→failed, cap at 100)
  • v0.3.0, CHANGELOG entry added
## What New `GET /api/messages` — in-memory history of the last 100 messages: inbound text (rx) and our sends (tx), newest first, with per-send delivery status. Record shape: ```json { "id": 123456789, "dir": "tx", "to": 67731772, "text": "hello", "channel": 2, "at": 1790254822000, "status": "delivered" } ``` ## Details - RX: inbound TEXT_MESSAGE_APP packets captured with `from`, text, channel, timestamp (existing log line kept) - TX delivery tracking: sends start `pending`; a ROUTING_APP packet whose `Data.requestId` matches our packet id resolves it — `errorReason NONE (0)` → `delivered`, any other value → `failed` + human-readable `ackError` (all Routing_Error values from the installed @meshtastic/protobufs mapped to names) - Broadcasts stay `pending`: firmware strips want_ack pre-TX, so no routing response ever arrives — documented in Swagger - History is bounded at 100 (oldest dropped), in-memory only, reset on reconnect — noted in endpoint docs - `codec.ts`: `decodeRouting()` + `describeRoutingError()`; verified oneof `Routing.variant` case `"errorReason"`, values NONE=0/NO_ROUTE=1/GOT_NAK=2/TIMEOUT=3 against the installed package ## Verification - `npm run build` ✓ - `npm test` — 22/22 passed (was 18, +4: rx capture, ACK→delivered, NACK TIMEOUT→failed, cap at 100) - v0.3.0, CHANGELOG entry added
kamilkrzywda added 1 commit 2026-09-24 16:18:31 +02:00
Message history with delivery tracking
CI / build + unit (pull_request) Successful in 56s
044e630358
kamilkrzywda merged commit 57ad27d66f into main 2026-09-24 16:19:32 +02:00
kamilkrzywda deleted branch feat/message-history 2026-09-24 16:19:32 +02:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: OpenCode/MeshBot#8