Skip to content

fix(logging): correct RST signal-strength bars for dB-report digital modes#250

Merged
patrickrb merged 1 commit into
mainfrom
optio/task-cde602e7-90b8-41f7-9565-69cef420cab6
Jul 24, 2026
Merged

fix(logging): correct RST signal-strength bars for dB-report digital modes#250
patrickrb merged 1 commit into
mainfrom
optio/task-cde602e7-90b8-41f7-9565-69cef420cab6

Conversation

@patrickrb

Copy link
Copy Markdown
Owner

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:

const isDigital = ['FT8', 'FT4', 'PSK31', 'RTTY', 'MFSK', 'OLIVIA', 'CONTESTIA'].includes(mode);

That list had drifted behind the canonical DB_REPORT_MODES set in src/lib/modes.ts (the source of truth defaultRstForMode uses). When an operator selects JS8, FST4, JT65, JT9, Q65, MSK144, or PSK63, the form pre-fills a -10 dB report — but because rstToBars didn'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/lib module.

Solution

  • Expose the dB-report classification as a canonical isDbReportMode(mode) from src/lib/modes.ts, backed by the existing DB_REPORT_MODES set. defaultRstForMode now calls it too, so the report the form fills and the meter that draws it can never disagree.
  • Route rstToBars in src/app/new-contact/page.tsx through isDbReportMode instead 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 an isDbReportMode suite (weak-signal family classified as dB, phone/CW/digital-voice/image classified as non-dB, case/whitespace tolerance) and an invariant that defaultRstForMode and isDbReportMode agree for every canonical mode. 16/16 mode tests pass.
  • npm run typecheck — clean
  • npm run lint — clean
  • npm run build — compiled successfully

Scope / 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. QuickLogCard doesn't render this meter, so no change was needed there.

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nodelog Ready Ready Preview, Comment Jul 24, 2026 3:09pm

Request Review

@patrickrb
patrickrb merged commit a293a04 into main Jul 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant