fix(logging): correct RST signal-strength bars for dB-report digital modes#250
Merged
Merged
Conversation
The new-contact form's `rstToBars` visualization hard-coded a digital-mode list (FT8/FT4/PSK31/RTTY/MFSK/OLIVIA/CONTESTIA) that had drifted behind the canonical `DB_REPORT_MODES` in src/lib/modes.ts. Picking JS8, FST4, JT65, JT9, Q65, MSK144 or PSK63 pre-fills a "-10" dB report (via defaultRstForMode), but the meter didn't recognize those modes as dB-report, so it parsed "-10" as a voice RST and rendered a misleading 1-bar signal instead of the correct dB-scaled bars. Expose the classification as a canonical `isDbReportMode(mode)` from src/lib/modes.ts (now the single source `defaultRstForMode` also uses) and route the meter through it, so the report the form fills and the meter that draws it can no longer disagree. Guarded by unit tests in modes.spec.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Problem
The new-contact logging form renders a small five-bar "signal strength" meter next to the sent/received RST fields. The helper that drives it,
rstToBars, hard-coded its own list of digital modes:That list had drifted behind the canonical
DB_REPORT_MODESset insrc/lib/modes.ts(the source of truthdefaultRstForModeuses). When an operator selects JS8, FST4, JT65, JT9, Q65, MSK144, or PSK63, the form pre-fills a-10dB report — but becauserstToBarsdidn't recognize those as dB-report modes, it fell through to the voice/CW path and parsed the leading digit of-10("1") as an RST readability, drawing a misleading 1 bar instead of the correct dB-scaled meter (~2 bars for −10 dB).This is the same class of drift the repo has repeatedly fixed for band and mode dropdowns: a hand-maintained list that silently falls out of step with the canonical
src/libmodule.Solution
isDbReportMode(mode)fromsrc/lib/modes.ts, backed by the existingDB_REPORT_MODESset.defaultRstForModenow calls it too, so the report the form fills and the meter that draws it can never disagree.rstToBarsinsrc/app/new-contact/page.tsxthroughisDbReportModeinstead of its own hard-coded list.No behavior change for any mode that was already classified as digital (the new set is a strict superset); the fix only adds the WSJT-X/weak-signal and PSK63 modes that were missing.
Testing
tests/modes.spec.ts— added anisDbReportModesuite (weak-signal family classified as dB, phone/CW/digital-voice/image classified as non-dB, case/whitespace tolerance) and an invariant thatdefaultRstForModeandisDbReportModeagree for every canonical mode. 16/16 mode tests pass.npm run typecheck— cleannpm run lint— cleannpm run build— compiled successfullyScope / follow-up
Purely a client-side visualization fix plus the shared classifier; no schema, API, or stored-data changes, so it's fully backwards compatible.
QuickLogCarddoesn't render this meter, so no change was needed there.🤖 Generated with Claude Code