Skip to content

Fix rig name showing obfuscated single letter on operator card#297

Merged
patrickrb merged 1 commit into
devfrom
fix/rig-name-obfuscation
Jun 18, 2026
Merged

Fix rig name showing obfuscated single letter on operator card#297
patrickrb merged 1 commit into
devfrom
fix/rig-name-obfuscation

Conversation

@patrickrb

Copy link
Copy Markdown
Owner

Problem

A user connected to a Lab599 Discovery TX-500 reported the RIG field on the Settings operator card showing just c. Selecting a different radio and a full reboot didn't change it.

Root cause

The operator card sourced the rig label from:

mainViewModel.baseRig?.javaClass?.simpleName

Release builds run R8 with minifyEnabled true, and proguard-rules.pro has no keep rule for com.k1af.ft8af.rigs.*. So DiscoveryTX500Rig (and every other rig class) is obfuscated to a single-letter name like c, and simpleName returns that. Picking another radio doesn't help — those classes are obfuscated the same way — and it survives reboots because it isn't stale state, it's the live (obfuscated) class name.

Fix

Use GeneralVariables.myRigName instead — the user-selected model name from RigNameList that MainViewModel.connectRig() already computes for exactly this reason (its comment notes the Java class name is unreliable; it's also used for the PSKReporter software string).

The resolution logic is extracted into a testable top-level internal fun resolveRigDisplayName(connected, modelName, notConnectedLabel) and the card calls that.

Tests

Added RigDisplayNameTest covering connected/disconnected, trimming, and blank/empty fallback to --. testDebugUnitTest passes.

🤖 Generated with Claude Code

The Settings operator card displayed the rig as a single letter (e.g. c)
in release builds. It was reading baseRig.javaClass.simpleName, but R8
obfuscates the com.k1af.ft8af.rigs package (no keep rule), so the class
name collapses to a meaningless short token. Selecting a different radio
or rebooting did not help because every rig class is obfuscated the same way.

Switch the card to GeneralVariables.myRigName, the user-selected model name
from RigNameList that MainViewModel.connectRig already computes for exactly
this reason (PSKReporter + display). Extract the resolution into a testable
internal resolveRigDisplayName() helper and cover it with unit tests.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.85714% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 11.18%. Comparing base (58e1526) to head (9104a8e).
⚠️ Report is 1 commits behind head on dev.

Files with missing lines Patch % Lines
...n/radio/ks3ckc/ft8af/ui/settings/SettingsScreen.kt 42.85% 4 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                dev     #297      +/-   ##
============================================
+ Coverage     11.15%   11.18%   +0.02%     
  Complexity      105      105              
============================================
  Files            81       81              
  Lines         11426    11430       +4     
  Branches       2051     2052       +1     
============================================
+ Hits           1275     1278       +3     
- Misses        10023    10024       +1     
  Partials        128      128              
Files with missing lines Coverage Δ
...n/radio/ks3ckc/ft8af/ui/settings/SettingsScreen.kt 1.28% <42.85%> (+1.28%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes the operator-card RIG display in release builds where R8 obfuscation caused baseRig.javaClass.simpleName to collapse to single-letter names (e.g., "c"). It switches the UI to display the user-selected rig model name already computed in MainViewModel.connectRig() and adds unit tests for the new resolution logic.

Changes:

  • Added internal fun resolveRigDisplayName(connected, modelName, notConnectedLabel) to compute the operator-card rig label from the persisted/user-selected model name, avoiding obfuscated class names.
  • Updated SettingsLanding to use GeneralVariables.myRigName (trimmed, with "--" fallback) instead of baseRig class name.
  • Added JVM unit tests covering connected/disconnected behavior, trimming, and blank/empty fallback.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
ft8af/app/src/main/kotlin/radio/ks3ckc/ft8af/ui/settings/SettingsScreen.kt Replaces rig label derivation with a deterministic model-name-based resolver to avoid R8-obfuscated class names.
ft8af/app/src/test/kotlin/radio/ks3ckc/ft8af/ui/settings/RigDisplayNameTest.kt Adds unit coverage for the rig display-name resolution logic (connected/disconnected + trimming/fallback).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@patrickrb patrickrb merged commit 2ddc2e4 into dev Jun 18, 2026
8 checks passed
@patrickrb patrickrb deleted the fix/rig-name-obfuscation branch June 18, 2026 20:33
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.

2 participants