[xvtr] Add XVTR diagnostic logging for waterfall mapping#1964
[xvtr] Add XVTR diagnostic logging for waterfall mapping#1964ten9876 merged 1 commit intoten9876:mainfrom
Conversation
There was a problem hiding this comment.
Good diagnostic logging layer on top of the #1960 policy extraction. The rate-limited waterfall decision log with state-change detection is well thought out, and including XVTR state in the troubleshooting snapshot will save real debugging time. A few observations:
static QHash in logXvtrWaterfallDecision — thread safety
MainWindow.cpp around line 241: logStateByStream is a static QHash inside a free function. Since waterfall tile callbacks arrive on the VITA-49 stream thread (not the GUI thread), this static is mutated from at least two contexts without synchronization. In practice today this is likely fine because the lambda capturing the call site runs on the main thread via QueuedConnection, but if the connection type ever changes or this function gets called from a background path, this becomes a data race. Worth a brief comment noting the single-thread assumption, or switching to a member variable on MainWindow to make the lifetime/thread ownership explicit.
xvtrPolicyBandsFrom allocates on every waterfall tile
The conversion xvtrPolicyBandsFrom(m_radioModel.xvtrList()) is called inside the waterfall tile lambda (line ~1721) and again in the band-switch path (line ~8271). In the waterfall path this runs per tile per panadapter match. For the typical case (0-3 XVTRs) this is negligible, but worth noting — if someone configures many XVTRs and has multiple waterfall streams, the QVector allocation per tile adds up. Not a blocker, just something to be aware of for future optimization if profiling shows it.
formatXvtrBullet — QString::arg with >9 positional args
SliceTroubleshootingDialog.cpp line ~108: The format string uses %10 which with Qt's QString::arg chaining will work correctly here because the args are applied sequentially. Just noting for future maintainers that this is at the edge of arg()'s positional numbering — adding an 11th field would need the multi-arg overload or split formatting.
hasIsValid field addition — good
The hasIsValid field on XvtrInfo (RadioModel.h:574) cleanly distinguishes "radio says is_valid=0" from "radio never sent is_valid". This is exactly the kind of diagnostic metadata that was missing. The sticky-true semantics (x.hasIsValid = true once seen) are correct for a session-scoped flag.
Scope check
All files are within the stated PR scope (XVTR diagnostic logging + snapshot). CMakeLists.txt changes are limited to adding the new source and test target. No out-of-scope modifications detected.
Tests
The test target follows the existing passive_spots_policy_test pattern (standalone, no CTest registration, Qt6::Core only). Consistent with the project approach.
Overall this is a clean logging-only addition with good rate limiting and structured diagnostic output. Thanks for the thorough PR description and validation steps, @jensenpat.
128c43b to
7080a2f
Compare
|
Hey @jensenpat — Claude here. Rebased your branch onto current main since #1960 just merged. Squashed the two commits into one (the regression-tests commit had a duplicate xvtrPolicyBandsFrom definition after dedup against the squash-merged #1960; the diagnostic-logging commit then removed the dup). Squashing avoided the broken intermediate state for bisect. Authorship + commit message preserved. Build verified locally before push. Once CI clears we'll review the diagnostic-logging delta and merge. 73, Jeremy KK7GWY & Claude (AI dev partner) |
Summary
This is stacked on #1960 and adds the logging/diagnostic layer for the XVTR waterfall work.
is_valid, whether the current status containedis_valid, and whether this session has ever seenis_valid.WaterfallXVTRdecision log for out-of-pan waterfall rows. It is rate-limited to one line per stream/pan/reason every 20 seconds, with immediate output when the decision state changes.band=key and available XVTR candidates.XvtrPolicyso diagnostics and tests share the same decision metadata.Why
The recent XVTR/waterfall debugging showed that raw protocol logs were not enough by themselves. We could see
xvtr ... is_valid=...when command logging was enabled, but we could not easily answer:is_valid, or was the key absent?This PR keeps the noisy waterfall decision logging behind the existing raw command/debug gate, while making low-volume XVTR status and support snapshot state easier to inspect.
Validation
cmake -S . -B build -G Ninjacmake --build build --parallel 10./build/xvtr_policy_testctest --test-dir build --output-on-failure -j10reports no registered tests in this build treeStack
Parent PR: #1960
Logging-only comparison: jensenpat/AetherSDR@aether/xvtr-policy-regression-tests...aether/xvtr-diagnostic-logging
👨🏼💻 Generated with OpenAI Codex (GPT-5.5 Pro 4/23) and tested by @jensenpat