[refactor](trx-rs): resolve all improvement areas (P0-P3)

Addresses every item in docs/Improvement-Areas.md:

P0 - Plugin signing: new src/trx-app/src/plugins.rs with SHA-256 checksum
     manifest, filename allowlisting, API version compatibility checks,
     and cross-platform file permission validation.

P1 - Session store mutex poisoning: all .unwrap() calls on RwLock/Mutex in
     auth.rs replaced with .unwrap_or_else(|e| e.into_inner()) + warning logs.
   - TCP listener rate limiting: added ConnectionTracker with per-IP connection
     cap (10 concurrent connections per IP).
   - RigState refactoring: decoder fields grouped into DecoderConfig and
     DecoderResetSeqs sub-structs with #[serde(flatten)] for wire compat.
   - spawn_blocking timeout: satellite pass computation wrapped in 30s timeout.

P2 - Command handler macro: rig_command! macro generates 7 unit-struct command
     implementations, reducing ~200 lines of boilerplate.
   - Protocol versioning: added protocol_version field to ClientEnvelope and
     ClientResponse; improved unknown command error handling in parse_envelope.
   - Unsafe string: replaced from_utf8_unchecked with safe from_utf8().expect().
   - Dead code: removed 2 unnecessary annotations, documented remaining 4.

P3 - Tests: added 4 unit tests for history_store.rs (round-trip, expiry, etc).
   - FT-817 VFO: improved inference for ambiguous same-frequency case.
   - Configurator: implemented serial port detection via tokio_serial.
   - Plugin versioning: integrated into plugin manifest (api_version field).
   - Naming: documented as intentional semantic distinctions, not inconsistencies.

https://claude.ai/code/session_01Gj1vEkP6GKVcVaMqzFW885
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-29 11:06:23 +00:00
committed by Stan Grams
parent 8e3162d7e6
commit a69c5143e6
23 changed files with 1129 additions and 603 deletions
@@ -105,6 +105,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: None,
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -119,6 +120,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: None,
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -138,6 +140,7 @@ async fn handle_client(
let resp = ClientResponse {
success: true,
rig_id: Some("client".to_string()),
protocol_version: None,
state: None,
rigs: Some(snapshot_remote_rigs(context.as_ref())),
sat_passes: None,
@@ -170,6 +173,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: active_rig_id.clone(),
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -182,6 +186,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: active_rig_id.clone(),
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -197,6 +202,7 @@ async fn handle_client(
let resp = ClientResponse {
success: true,
rig_id: active_rig_id.clone(),
protocol_version: None,
state: Some(snapshot),
rigs: None,
sat_passes: None,
@@ -208,6 +214,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: active_rig_id.clone(),
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -220,6 +227,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: active_rig_id.clone(),
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -231,6 +239,7 @@ async fn handle_client(
let resp = ClientResponse {
success: false,
rig_id: active_rig_id.clone(),
protocol_version: None,
state: None,
rigs: None,
sat_passes: None,
@@ -415,14 +424,7 @@ mod tests {
server_longitude: None,
pskreporter_status: Some("Disabled".to_string()),
aprs_is_status: Some("Disabled".to_string()),
aprs_decode_enabled: false,
hf_aprs_decode_enabled: false,
cw_decode_enabled: false,
ft8_decode_enabled: false,
ft4_decode_enabled: false,
ft2_decode_enabled: false,
wspr_decode_enabled: false,
lrpt_decode_enabled: false,
decoders: trx_core::DecoderConfig::default(),
cw_auto: true,
cw_wpm: 15,
cw_tone_hz: 700,