Skip to content

Fix swapped path responsiveness metrics - #96

Open
tmierzwa wants to merge 1 commit into
attermann:masterfrom
tmierzwa:fix-swapped-path-responsiveness-metrics
Open

tmierzwa wants to merge 1 commit into
attermann:masterfrom
tmierzwa:fix-swapped-path-responsiveness-metrics

Conversation

@tmierzwa

Copy link
Copy Markdown

Problem

In the built-in Info provisioning namespace, the two path responsiveness metrics read each other's counter (src/microReticulum/Provisioning/BuiltinNamespaces.cpp, current master 40fa628):

.metric_int("Paths Unresponsive", Ns::Info::Metrics::Field::PathsUnresponsive, []() { return RNS::Transport::paths_responsive(); })
.metric_int("Paths Responsive", Ns::Info::Metrics::Field::PathsResponsive, []() { return RNS::Transport::paths_unresponsive(); })

Transport::mark_path_unresponsive() increments _paths_unresponsive and mark_path_responsive() increments _paths_responsive, so anyone reading these metrics over remote management (field ids 10 and 11) sees the number of unresponsive paths reported as responsive and vice versa.

Change

Each field now returns its own counter. Two lines, no change to field ids, names or wire format.

Testing

Target Result
native (Ubuntu 24.04, GCC 13.3, PlatformIO 6.2.0) pio test -e native: 182/182 passed
ttgo-t-beam (ESP32) builds
wiscore_rak4631 (nRF52840) builds

There is no existing test for the built-in metrics. A unit test for this would need a populated path table to drive mark_path_responsive(), which seemed out of proportion for a two-line fix; happy to add one if you prefer.

Found while reading the code for #95.

🤖 Generated with Claude Code

The "Paths Unresponsive" metric (field PathsUnresponsive) returned
Transport::paths_responsive() and "Paths Responsive" returned
Transport::paths_unresponsive(), so remote management showed each
counter under the other's name. Return the matching counter for each
field.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant