mirror of
https://github.com/praktimarc/kst4contest.git
synced 2026-10-18 21:34:03 +02:00
* test: restore the frequency-context and Band.fromPrefix tests (#105) The test file MessageBusManagementThreadFrequencyContextTest sat under src/main, fully commented out, and was deleted with #62 without ever having run. Its two concerns come back as real tests: the bare three-digit context rule of hasExplicitBareFrequencyContext in the controller test package, and Band.fromPrefix as BandFromPrefixTest in the model package. The original expectations still match the current behaviour; a few boundary cases (context window, invalid indices, non-exact prefixes) are added. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * test: characterise the autoanswer path of MessageBusManagementThread (#105) Runs real CH frames through a started thread (receive queue plus poison pill, real transmit queue, mocked controller collaborators, a real ChatPreferences in a temporary directory) and pins the current behaviour of the private-message branch before it is refactored: - a QRG question addressed to the login callsign yields exactly one reply with the fixed marker and the QRG of the incoming category; - a second question from the same station and category within the cooldown yields none, while another station or category is answered; - a frame carrying the autoanswer marker, a public frame, a frame to another station and a disabled setting yield none; - an empty QRG and a blank generic text are rejected before the cooldown is recorded, so a later valid reply still goes out; - //VER, the generic reply and its precedence below the QRG reply. One oddity is pinned, not fixed: a lower-case login callsign defeats the "directed to me" comparison because the receiver callsign is upper-cased by ChatMember.setCallSign but compared with equals. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor: extract the autoanswer decisions into pure functions (#105) The QRG-question texts become a constant set; matchesQrgQuestion, isAutoMessage and buildAutoAnswerMessageText are static package-private functions with explicit parameters instead of reaching into the preferences, and the cooldown reads an injectable millisecond clock (default System::currentTimeMillis) through a new constructor overload. Behaviour is unchanged: the characterisation test from the previous commit passes untouched, the new decision and cooldown tests cover the extracted functions without mocks. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> * refactor: extract frequency detection into a pure function (#105) smartFrequencyExtraction now copies the sender's band timestamps, reads the fallback prefix and the injectable clock, and hands the text to the static package-private detectFrequencies, which returns the detections in message order as DetectedChatFrequency records. The thread still stores each one through applyDetectedFrequencyToActiveMembers and logs it as before. Behaviour is unchanged. In production the stored detection lands in the same map the next match of the message reads, so detectFrequencies feeds every detection back as context with the current time; a test pins that "10368.100 then .150" yields 10368.150. The unreachable NumberFormatException catches around parseExplicitFrequency are gone, since that parser already returns null instead of throwing. Also pinned: a plain decimal between 50 and 54 (e.g. "qrb 52,3 km") is read as a 6 m frequency. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: extract the directional-opportunity and spot decisions (#105) classifyDirectionalOpportunity returns MISSING_LOCATOR, IN_ANGLE_AND_RANGE or OUT_OF_ANGLE_OR_RANGE from the locators, the maximum QRB and the beam width, and replaces the identical locator check plus isInAngleAndRange call in both the live (CH) and the history (CR) branch. shouldPlayDirectionalTick, decideDxClusterSpot (NO_FREQUENCY, ALREADY_WORKED, SPOT) and buildDxClusterSpotEntry take over the tick condition and the automatic DX Cluster spot of the CH branch. All are static package-private and covered without mocks. Behaviour is unchanged. Pinned: the spot decision only checks that the frequency text is non-blank, so a value outside every supported band is spotted even for a station flagged as worked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: remove dead code from MessageBusManagementThread (#105) processRXMessage23000 belonged to the long-retired raw port-23000 interface and had no caller. With it go the two helpers only it reached, checkIfItsUserListEntry and checkIfMessageInhibitsFrequency, plus the caller-less checkIfItsUserListEntry23001 and checkListForChatMemberIndexByCallSign, the patterns PTRN_USERLISTENTRY, PTRN_QRG_CAT2 and PTRN_QRG_CAT3, the unused chatMemberTable field and the serverReady flag with its never-called accessors. A grep across core and app-desktop finds no remaining reference. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: keep the sender-category fallback in the QRG auto-answer warning (#105) Review follow-up. The extracted buildAutoAnswerMessageText logged only the message category, while the old warning used autoAnswerCooldownKey, which falls back to the sender's category. The caller now passes the same fallback, so the log line is unchanged from main. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>