Back to examples

Real example 03 · Unit test · merged PR #110

A valid viewer setting was silently ignored

The viewer advertised refresh_mode and already knew how to apply it internally, but startup configuration never connected the setting to the existing GUI setter.

Real upstream PR PR #110 by cbenjamin23 Merged July 25, 2026 · failing 174bd734 · corrected 4896b545

The upstream problem

A plausible solution was incomplete

The problem

pMarineViewer's example configuration documented refresh_mode=events, and the GUI, repository, and request loops all supported the mode. The startup parser simply omitted the route from the configuration parameter to that existing implementation.

The incomplete solution

Most of the feature was already present, so manual inspection at either end looked reassuring: the option was advertised and the runtime consumers were implemented. With no startup branch calling setRadioCastAttrib(), however, a valid configuration line was rejected and had no effect.

Open the source at the failing revision

Missing startup route added by the corrected commit

bool PMV_MOOSApp::handleStartUp(...)
 {
   ...
+  else if(param == "refresh_mode")
+    handled = m_gui->setRadioCastAttrib(param, value);
   ...
 }

The test

Run the focused check

Command

MOOS_IVP_SOURCE=/path/to/moos-ivp   python3 -m unittest -v   tests.test_pmarineviewer_refresh_mode_contract

At the incomplete revision

The focused check fails

test_advertised_refresh_mode_reaches_existing_gui_setter ... FAIL
test_existing_gui_setter_updates_both_refresh_state_consumers ... ok
test_request_loops_consume_the_states_updated_by_the_setter ... ok

Ran 3 tests
FAILED (failures=1)

The correction

What changed before the final upstream result

What the test proved

The restored source-contract test traces the entire advertised path: documentation to startup parsing, startup parsing to the GUI setter, the setter to both refresh-state consumers, and the request loops that read those states.

Open the protecting test

Corrected solution

PR #110 added the missing startup branch and delegated validation to the existing GUI setter. That kept one source of truth for accepted values while finally connecting configuration to behavior.

Open the corrected source

Upstream result

The same three checks pass at corrected commit 4896b545, which merged in PR #110.

Open PR #110

Next example

Restoring PROJ broke safe geodesy copies

Continue