FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
0115 — ValuesDisplay accepts an unknown Corner without visualization
ID 0115
Class BUG
Severity 2
Status blocked

Models: Trawl/ValuesDisplay

Found: 2026-10-19

Decision needed: should a headless build validate Corner (and the other parameters) the same way a visualization build does, so that a bad input file fails in both? The header currently documents the opposite ("a headless build ignores its inputs").

Evidence

src/trawl/ValuesDisplay.cpp:21-27 reads and validates Corner only inside #ifdef FH_VISUALIZATION:

#ifdef FH_VISUALIZATION
...
creator->GetEnumParam("Corner", &m_corner, fhsim::HudCorner::TopRight,
{{"TopLeft", ...}, {"TopRight", ...}, {"BottomLeft", ...}, {"BottomRight", ...}});

A build without visualization never calls GetEnumParam, so Corner = "Centre" is accepted silently. src/trawl/ValuesDisplay.h:36-39 documents this on purpose ("a headless build ignores its inputs").

tests/ValuesDisplay_Test.cpp:110-115, test SimObject_GUI.ValuesDisplay_RejectsAnUnknownCorner, expects EXPECT_ANY_THROW for Corner = "Centre". Since "Tests: labels, buckets and tiers (T1)" it is compiled only under #ifdef FH_VISUALIZATION. Before T1 it was compiled in headless builds too but always filtered out (_NEEDS_GUI), so the gap was hidden.

Effect

The same bad input file stops the run in a visualization build and runs without any message in a headless build. A typo in Corner is found only on a machine with visualization.

Possible fix

Read and validate Corner outside the #ifdef (store the enum, use it only when drawing). Or keep the current rule and document that headless builds skip all parameter checks. This is the owner's choice. The same question applies to the other parameters read only under FH_VISUALIZATION (FilterFrames, Signal<N> details).

Test that would prove it

Move ValuesDisplay_RejectsAnUnknownCorner out of the #ifdef FH_VISUALIZATION block (it then runs in every build). To reproduce now: build without visualization, compile the test without the #ifdef, run it; it fails with no throw. Or run a model with Corner = "Centre" headless.

Risk

Existing headless inputs with an invalid Corner start to fail. Low: the parameter has no effect there.