fix(tx): setSbMonitor caches m_sbMonitor optimistically (#3719). Principle II.#3734
Merged
Merged
Conversation
…ciple II. TransmitModel::setSbMonitor sent "transmit set mon=" but never updated its local m_sbMonitor, so transmitModel().sbMonitor() read stale until the radio echoed sb_monitor (measured non-convergent over a 410 ms window on a FLEX-8400M). Same defect class as #3712 (setAmCarrierLevel). Mirror the sibling pattern: write m_sbMonitor optimistically on change and emit micStateChanged() — the signal the MON button's model->widget sync (PhoneCwApplet::syncPhoneFromModel, connected to micStateChanged) actually binds to, matching setMonGainSb. NOT phoneStateChanged() (that drives syncCwFromModel, which never touches the MON button). No feedback loop: the sync wraps its body in m_updatingFromModel and the toggled handler early- returns on that flag, so the optimistic setChecked cannot re-emit the command. Principle II: the command path stays client->radio; the radio's sb_monitor status echo (parsed at TransmitModel.cpp:104-106) supersedes the optimistic value, with no feedback loop. Command/status split per Principle I (FlexLib: command "mon", status key "sb_monitor", Radio.cs:10615). Blast radius: risk_score=0.411, 23 high-risk affected (top: MainWindow::MainWindow, MainWindow::wireRadioModel, RadioModel:: troubleshootingSnapshot). All structural noise from class-level granularity; the change only adds an existing signal emit already wired and feedback- guarded, no signature/symbol/dependency change. Test-target link surface unchanged (no new external symbol or include). Note: cmake unavailable in this environment, so a full build was not run; the edit uses only pre-declared members/signals isomorphic to verified sibling setters in the same TU. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
There was a problem hiding this comment.
Looks good — clean, correct, and minimal. Thanks for the fix! 🙏
I traced the change against the surrounding code and it holds up:
Correctness
setSbMonitorpreviously emitted onlycommandReady, leavingm_sbMonitorstale until the radio echoedsb_monitor. Any unrelatedmicStateChangedin that window would runPhoneCwApplet::syncPhoneFromModel()→m_monBtn->setChecked(m_model->sbMonitor())(PhoneCwApplet.cpp:741) and snap the MON button back. The optimistic update fixes exactly that — same Principle II class as thesetMonGainSbsibling and the recentsetAmCarrierLevel(#3711) /setDaxfixes.- No feedback loop: the resulting
setCheckedruns insidesyncPhoneFromModel(), which setsm_updatingFromModel = true(PhoneCwApplet.cpp:713), and the MON toggle handler is gated on!m_updatingFromModel(PhoneCwApplet.cpp:349). So the optimisticsetCheckedcan't re-emit the command. The comment's explanation is accurate. - Echo still supersedes: the radio's incremental status genuinely echoes
sb_monitor(TransmitModel.cpp:104-106), so a divergent radio state will correct the optimistic value — good, this isn't masking a missing echo. - The
if (m_sbMonitor != on)guard correctly suppresses a redundantmicStateChangedwhile always forwarding the command, which is the right behavior.
All six CI checks are green. No concerns.
🤖 aethersdr-agent · cost: $3.3604 · model: claude-opus-4-8
jensenpat
approved these changes
Jun 23, 2026
jensenpat
left a comment
Collaborator
There was a problem hiding this comment.
Optimistic meter update on state change before radio sends update. Found via agent automation testing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3719
What was changed
fix(tx): setSbMonitor caches m_sbMonitor optimistically (#3719). Principle II.
Files modified
src/models/TransmitModel.cppGenerated by AetherClaude (automated agent for AetherSDR)
🤖 aethersdr-agent · cost: $2.9189 · model: claude-opus-4-8