feat(meshcore): manual telemetry poll buttons (#3674)#3681
Conversation
Adds on-demand telemetry polling for a MeshCore node, with one button per
telemetry type, alongside the existing scheduled retrieval config.
Backend:
- Extract the scheduler's per-node request → convert → insert body into a
shared MeshCoreRemoteTelemetryScheduler.requestTelemetryForNode(manager,
target, { includeStatus, includeLpp }) so the scheduler tick and the new
manual route use identical logic. Throttle/stamp bookkeeping stays with
the callers.
- New POST /api/sources/:id/meshcore/nodes/:publicKey/telemetry/poll route
(body { type: 'status' | 'lpp' }). Honours the same per-source 60s
mesh-TX gate as the scheduler (429 + Retry-After when too soon), gated on
nodes:read plus the HTTP meshcoreDeviceLimiter. Stamps recordMeshTx +
markTelemetryRequested before issuing so the gate and fair-rotation clock
advance regardless of result.
Frontend:
- Two buttons (Poll Status / Poll Environment (LPP)) in
MeshCoreNodeTelemetryConfig with pending state, written-row-count result,
and backend-error surfacing. Gated on nodes:read.
Tests: 8 route tests (auth, validation, status/lpp dispatch, unknown-node
companion fallback, not-connected 409, throttle 429) + 5 component tests.
Full suite: 7349 passed, 0 failed.
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): manual telemetry poll buttonsTasks
SummaryThis is a well-designed, well-tested feature. The architecture is solid: shared logic is correctly extracted into Code Quality & Best Practices
The route uses const sinceLastTx = Date.now() - lastTx;Minor: the scheduler's
Potential Bugs / Issues
The
Both buttons are disabled when either is polling (
The route correctly checks
If PerformanceNo concerns. The route is gated by Security
One minor concern: the route gates on Test CoverageBackend tests (
One gap: no test for the 503 case (scheduler is null / unavailable). This is a minor edge case but the branch is there. Frontend tests (
One gap: no test for the "Request sent — no telemetry returned" path (when Scheduler refactor: PR states 32 existing scheduler tests pass unchanged — good. Minor Nits
VerdictApprove with minor suggestions. The implementation is correct, the throttling strategy is sound, the extracted shared method is clean, and test coverage is strong. The two test gaps (503 case and |
Summary
Closes #3674 — adds on-demand MeshCore telemetry polling with two buttons, one per telemetry type, so users no longer have to wait for the scheduled interval.
MeshCore remote telemetry has two independent request paths:
requestNodeStatus) — the operational stats blob (battery, uptime, counters); repeater/room-server oriented.requestRemoteTelemetry) — Cayenne-LPP sensor data; the primary path for companion nodes.Both already existed but were driven only by the background scheduler. This exposes them as manual triggers.
Backend
request → convert → insertbody into a sharedMeshCoreRemoteTelemetryScheduler.requestTelemetryForNode(manager, target, { includeStatus, includeLpp }). The scheduler tick and the new route now use identical logic; throttle/stamp bookkeeping stays with each caller. No behavior change to the scheduler (its 32 tests pass unchanged).POST /api/sources/:id/meshcore/nodes/:publicKey/telemetry/poll, body{ type: 'status' | 'lpp' }.429+Retry-Afterwhen too soon, so the buttons can't flood the air or collide with a scheduled request in flight.recordMeshTx+markTelemetryRequestedbefore issuing so the gate and fair-rotation clock advance regardless of result.nodes:read(a user-initiated read that transmits) plus the HTTPmeshcoreDeviceLimiter. Returns409if the source isn't connected.Frontend
MeshCoreNodeTelemetryConfig, with pending state, a written-row-count result message, and backend-error surfacing (including the 429 throttle message). Gated onnodes:read.Testing
409, throttle429+Retry-After.type, surfaces a 429, disables withoutnodes:read.🤖 Generated with Claude Code