Desktop: send the answerer's courtesy 73 (fix dead-write in QSO complete())#570
Merged
Merged
Conversation
The QSO auto-sequencer's answerer path (we reply to a CQ, send our grid, then R+report) is meant to send a final courtesy "73" (WSJT-X Tx5) once the DX sends RR73. The `RReport` arm in `process_rx` set `tx_message = "<dx> <me> 73"` and `stage = Bye73` for exactly that, then called `complete()` — but `complete()` unconditionally ran the return-to-CQ / stop cleanup, overwriting both. So the queued 73 was a dead write: the answerer never transmitted it and jumped straight back to calling CQ (and `TxStage::Bye73` was unreachable). This diverged from the iOS port (`FT8Engine/QsoEngine.swift`), whose `complete()` guards the reset with `if stage != .bye73` and whose `processRx` wraps up on the next slot via an early `Bye73` handler — and from WSJT-X, which sends the courtesy 73. Fix (a faithful port of the iOS structure): - Extract the return-to-CQ / stop cleanup into `finish_qso()`. - `complete()` now only calls `finish_qso()` when `stage != Bye73`, so a queued courtesy 73 survives to be transmitted next slot. - `process_rx` wraps the QSO up (via `finish_qso()`) on the following slot once the Bye73 message has had its TX slot. Only the answerer's RReport->RR73 path changes; the CQ-initiator path (Rr73->73) still completes immediately with no courtesy 73, and every other `complete()` caller is unaffected (their stage is never Bye73). The existing `answerer_full_sequence_logs_qso` test was a partial port of the iOS test that dropped the tx_message/stage/next-slot assertions; it is now extended to assert the courtesy 73 is queued (`"K1ABC K0XYZ 73"`, stage `Bye73`) and that the next slot returns to CQ. Verified failing on the pre-fix source and passing after via a `#[path]`-include harness (`cargo test`, 7/7 green). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dev #570 +/- ##
============================================
+ Coverage 27.60% 27.92% +0.31%
Complexity 165 165
============================================
Files 175 175
Lines 23333 23434 +101
Branches 3192 3192
============================================
+ Hits 6442 6544 +102
+ Misses 16698 16697 -1
Partials 193 193
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR fixes the desktop FT8 QSO auto-sequencer’s answerer flow so that when the DX sends RR73, the engine correctly queues and transmits the courtesy 73 (Tx5) before returning to CQ/idle, aligning desktop behavior with WSJT-X and the iOS implementation.
Changes:
- Refactors QSO wrap-up logic into a new
finish_qso()helper. - Updates
complete()/process_rx()sequencing so a queued courtesy73isn’t immediately overwritten by return-to-CQ cleanup. - Extends the answerer sequence unit test to assert the
Bye73stage/queued message and the following slot’s return to CQ.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
process_rx() wrapped the QSO up (returned to CQ / stopped) whenever stage == Bye73, on the assumption that the intervening TX slot always sent the queued 73. But maybe_transmit() can bail — missed TX window (now % CYCLE_MS > TX_LATEST_MS), wrong parity, rig already transmitting, or an encode/playback failure — leaving the 73 queued but unsent. The next process_rx() then clobbered it, so the answerer's courtesy 73 (and a manual Tx5 73) could still be skipped in exactly those late-slot cases. Gate finish_qso() on a new bye73_sent flag instead of on stage==Bye73 alone. The scheduler now calls QsoEngine::notify_transmitted() only when start_transmit() actually keys up (it now returns bool), which latches bye73_sent for the pending 73. Until then process_rx() keeps the 73 queued so maybe_transmit() retransmits it next eligible slot, matching how every other stage retries. notify_transmitted() is a no-op off Bye73, so in-progress sequences are unaffected. Tests: existing answerer sequence now signals the transmit; added bye73_not_finished_until_actually_transmitted (late-slot stays armed, no double-log, finishes after notify) and notify_transmitted_is_noop_off_bye73. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Root cause
The desktop QSO auto-sequencer's answerer flow (we reply to a CQ → send our grid → send R+report) is supposed to send a final courtesy "73" (WSJT-X Tx5) once the DX sends
RR73. TheRReportarm ofprocess_rxdid exactly that:…but
complete()then unconditionally ran the return-to-CQ / stop cleanup, overwriting bothtx_messageandstage. So the queued "73" was a dead write: the answerer never transmitted it and instead jumped straight back to calling CQ, andTxStage::Bye73was unreachable.This diverged from:
ios/FT8AFKit/Sources/FT8Engine/QsoEngine.swift) — itscomplete()guards the cleanup withif stage != .bye73, andprocessRxwraps up on the next slot via an earlyBye73handler. Its unit test explicitly asserts the "73" is sent then CQ resumes.The desktop
qso.rswas the reference port; iOS mirrored it and fixed this, but desktop still shipped the bug.Fix
A faithful port of the iOS structure (no protocol/DSP change, pure state-machine sequencing):
finish_qso().complete()now callsfinish_qso()only whenstage != Bye73, so a queued courtesy 73 survives to be transmitted on the answerer's next TX slot.process_rxwraps the QSO up (viafinish_qso()) on the following slot, once theBye73message has had its TX slot.Scope: only the answerer's
RReport → RR73path changes. The CQ-initiator path (Rr73 → 73) still completes immediately with no courtesy 73, and every othercomplete()caller is unaffected (their stage is neverBye73). The QSO is still logged exactly once, on the same slot as before — no change to the emittedQsoRecord.engine.rskeepsqso.activetrue through the 73 (stageBye73), somaybe_transmitsends it, then the next cycle returns to CQ.Testing
answerer_full_sequence_logs_qso(which was a partial port of the iOS test that had dropped thetx_message/stage/next-slot assertions) to assert the courtesy 73 is queued ("K1ABC K0XYZ 73", stageBye73) and that the next slot returns to CQ ("CQ K0XYZ EN37", stageCq).qso.rs#[cfg(test)]suite in-sandbox via a#[path]-include harness (the full Tauri crate can't link webkit/dbus headless). 7/7 pass with the fix; the extended test fails on the pre-fix source (left: Some("CQ K0XYZ EN37"),right: Some("K1ABC K0XYZ 73")), confirming it catches the regression.Risk
Low. Pure Rust logic, no platform
cfg, no DSP/interop/encoder change — it makes the answerer emit the standard FT8 courtesy 73 that WSJT-X and the iOS port already send. Behavior is unchanged for the CQ-initiator role and for a non-auto_return_to_cqoperator (the 73 is still sent, then the engine stops).🤖 Generated with Claude Code