feat(meshcore): show hop count + relay route below received messages (#3742) — Phase 1#3750
Conversation
…3742) Phase 1 of #3742. The hop count and relay-hash path are already decoded in meshcoreManager for the auto-ack {ROUTE}/{HOPS} templates, but weren't persisted or shown. Now: - meshcore_messages gains hopCount + routePath columns (all 3 backends, migration 105, idempotent). Existing rows / room messages stay NULL. - The contact_message and channel_message handlers compute hop/route before building the message and store them; addMessage persists them and the boot DB-load maps them back. - MeshCoreMessageStream renders a route line under received messages: "📍 direct" for 0 hops, else "🛰 N hops · a3 → 7f → 02". Phase 2 (resolving the scope hash to a known scope name) is deferred per the reporter. Tests: migration count/last-name, meshcore insert+read round-trip of hopCount/routePath. Full suite 7549 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VBLhGGNh35oMwTL53va1Y5
|
Claude finished @Yeraze's task —— View job PR Review: feat(meshcore): show hop count + relay route below received messagesTasks:
Overall AssessmentThis is a clean, well-scoped implementation. The changes follow the codebase's established patterns for schema additions, the migration is properly idempotent on all three backends, and the frontend rendering is straightforward. A few items worth addressing before merge: Issues / Suggestions1. ID collision risk in
|
|
Thanks for the thorough review — triaged all 5: #2 (outPath fallback semantics) — fixed. You're right that #3 (0xFF → 0 "direct") — working as intended, declining. In this codebase #4 (route shown alongside "direct") — fixed. Added the #5 (NULL-row deserialization) — fixed. Added an explicit test inserting a message with the fields omitted and asserting #1 (ID Full suite re-run + tsc + build clean. |
… null test Review feedback on PR #3750: - Display route no longer falls back to the sender contact's outPath. outPath is the OUTBOUND path to the sender, not the inbound route the message took, so showing it as the received route is misleading. The stored/displayed routePath now uses only the observed LogRxData path_hops; the {ROUTE} auto-ack template keeps its outPath fallback (renamed ackRoute) so acks still cite a route when no LogRxData surfaced. - Stream guards the route-path suffix with hopCount !== 0 so a 0-hop "direct" message never renders a relay chain. - Added a repo test asserting an inserted message with hopCount/routePath omitted reads back as null (not undefined), tightening the pre-migration-row contract. (0xFF→0 "direct" left as-is: documented codebase semantics — 0xFF means "sent direct (no flood)" and feeds the {HOPS} template; not "unknown".) Full suite 7550 passed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01VBLhGGNh35oMwTL53va1Y5
|
Claude finished @Yeraze's task —— View job PR Review: feat(meshcore): show hop count + relay route below received messagesTasks:
Overall AssessmentThe follow-up fixes address all three accepted items (#2, #4, #5) cleanly. The code is in good shape. Only two minor observations remain: Post-Fix Verification#2 (outPath fallback removed) — confirmed correct. #4 (direct message route guard) — confirmed correct. #5 (NULL pre-migration row test) — confirmed correct. Minor Observations (Non-blocking)A.
|
Phase 1 of #3742 (the hop-count + routing-path display the repo owner scoped in the issue thread; the reporter confirmed Phase 1 as the starting point).
What
MeshCore already decodes a received message's hop count (
path_len) and relay-hash route (path_hops) for the auto-ack{ROUTE}/{HOPS}templates, but that data was never persisted or shown. Now each received channel/DM message displays its route, like the native MeshCore app.Changes
meshcore_messagesgainshopCount(int) +routePath(text), nullable, on all three backends. Migration 105 (idempotent). Existing rows and room messages (no path on the wire) stayNULL.meshcoreManager.ts): thecontact_messageandchannel_messagehandlers now compute hop/route before building the message and store them on it;addMessagepersists them, and the boot DB-load maps them back.MeshCoreMessageStreamrenders a route line under received messages —📍 directfor 0 hops, otherwise🛰 N hops · a3 → 7f → 02. NewMeshCoreMessagetype fields; messages pass through the API/socket raw so no mapping churn.Deferred
Phase 2 (scope display) — resolving the message's scope hash against the user's known scope list — is a follow-on per the reporter; this PR lays the per-message display slot it can reuse.
Tests
Migration registry count/last-name bumped to 105; a meshcore-repo insert+read round-trip asserts
hopCount/routePathpersist (incl.0 hops→ "direct" andNULL). Full suite 7549 passed, 0 failures; servertsc+ build clean.🤖 Generated with Claude Code