feat(meshcore): display device channels in MeshCoreChannelsView (phase 2/3, relanded)#3038
Conversation
…e 2/3) (#3036) Reads the channel list synced by phase 1 and renders one tab per channel. Replaces the hardcoded "Public" entry that was the only channel surface in the UI before. Display - MeshCoreChannelsView fetches /api/channels/all?sourceId=<src> (the /all endpoint bypasses the legacy 0..7 Meshtastic filter so MeshCore rows with higher indices show up). Synthesises a single "Public" entry as a fallback while a freshly-connected source is still mid-sync. - Per-channel filter: a message belongs to channel X when its fromPublicKey is `channel-${X}` (received) or its toPublicKey is `channel-${X}` (locally-sent, phase-2 tagging). A legacy back-compat clause keeps pre-phase-2 outbound channel-0 messages visible in the Public tab without a migration. Send path (small extension required for multi-channel UX) - meshcoreNativeBackend.send_message now accepts `channel_idx` and routes the broadcast through sendChannelTextMessage(idx, text) when no DM recipient is given. Channel 0 stays the default for backward-compatible callers. - MeshCoreManager.sendMessage(text, toPublicKey?, channelIdx?) — third arg passes through to the backend and stamps the locally- stored copy with toPublicKey = `channel-${idx}` so the filter works symmetrically. - /api/meshcore/messages/send accepts channelIdx in the body with range validation (0..255). - useMeshCore.sendMessage and the MeshCoreActions type expose the third arg; MeshCoreChannelsView passes the active channel idx. Tests (+6 frontend) - MeshCoreChannelsView.test.tsx: rendering each channel as a tab, fallback when the list is empty, blank-name -> "Channel N", per-channel filter (channel 0 incl. legacy local, channel 1 incl. local toPublicKey), and that Send passes the active idx. Phase 2 of 3 (see docs/meshcore-channels-plan.md). Phase 3 will add the Configuration UI for create/edit/delete. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Claude finished @Yeraze's task —— View job Code Review CompleteI've thoroughly reviewed this PR implementing MeshCore channels display functionality (phase 2/3). Here's my comprehensive feedback: Code Quality Assessment ✅Strengths:
Code Style:
Security Analysis ✅No security concerns identified:
Performance Considerations ✅Well optimized:
Test Coverage Assessment ✅Comprehensive test suite (266 lines):
Technical Implementation Review ✅Backend Changes (meshcoreManager.ts:972-1019):
API Changes (meshcoreRoutes.ts):
Native Backend (meshcoreNativeBackend.ts):
Potential Issues & Recommendations
|
System Test ResultsMeshMonitor System Test ResultsTest Run: 2026-05-15 20:31:00 EDT Test Summary
✅ Overall Result: PASSEDAll deployment configurations are working correctly! Test DetailsConfiguration Import:
Quick Start Test:
Security Test:
V1 API Test:
Reverse Proxy Test:
Reverse Proxy + OIDC Test:
Virtual Node CLI Test:
Backup & Restore Test:
Database Migration Test:
DB Backing Consistency Test:
|
Re-land of PR #3036, which was inadvertently merged into the phase-1 branch (now orphaned) instead of main. The retarget-base step before merging didn't take.
This is the same commit, cherry-picked onto a fresh branch off main. Full vitest suite passes locally (4949/0).
Summary (from #3036)
Reads the channel list synced by phase 1 and renders one tab per channel. Replaces the hardcoded "Public" entry that was the only channel surface in the UI before. Extends the send path so messages sent on a non-channel-0 tab actually go to the right channel.
Display
MeshCoreChannelsView.tsxfetches/api/channels/all?sourceId=<src>and renders one tab per row.fromPublicKey === 'channel-${idx}') and locally-sent (toPublicKey === 'channel-${idx}') messages, with a back-compat clause for pre-phase-2 channel-0 local messages.Send path extension
meshcoreNativeBackend.send_messagenow acceptschannel_idx.MeshCoreManager.sendMessage(text, toPublicKey?, channelIdx?)— third arg passes through and stamps the locally-stored copy withtoPublicKey = 'channel-${idx}'./api/meshcore/messages/sendacceptschannelIdxin the body with range validation (0..255).useMeshCore.sendMessageand the view pass the active channel idx.Test plan
npx vitest run— 4949 PASS / 0 FAIL🤖 Generated with Claude Code