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

P1 — High:
- Merge duplicate APRS/HF-APRS decoder tasks into parameterised inner fn
- Merge duplicate FT8/FT4 decoder tasks into shared ftx inner fn
- Add multi-rig state isolation and command routing tests (listener.rs)
- Add background decode evaluate_bookmark unit tests

P2 — Medium:
- Fix decode-log silent flush errors and rotation failure fallback
- Split api.rs (2,831 LOC) into 7 logical modules (decoder, rig, vchan,
  sse, bookmarks, assets, mod)
- Extract background decode decision cascade into pure evaluate_bookmark()
  function with ChannelAction enum
- Relax actix-web pin from =4.4.1 to 4.4
- Replace VDES magic numbers with named constants

P3 — Low:
- Add doc comments to AisDecoder, VdesDecoder, RdsDecoder
- Add debug_assert on turbo decoder interleaver/deinterleaver lengths
- Add tracing info_span! to all 10 decoder block_in_place calls
- Optimize hot-path string cloning in remote_client spectrum loop

https://claude.ai/code/session_01Y3G65hrfsRRjwyBF2qbBmc
Signed-off-by: Claude <noreply@anthropic.com>
This commit is contained in:
Claude
2026-03-29 14:40:03 +00:00
committed by Stan Grams
parent 44e09449dc
commit c041ac83f3
21 changed files with 4566 additions and 3359 deletions
+1 -21
View File
@@ -128,24 +128,4 @@ Improvement plan: `docs/Improvement-Areas.md`
### Areas for Improvement
All previous P0 items resolved or dropped. See `docs/Improvement-Areas.md` for
resolved item details.
**P1 — High:**
- **Decoder task duplication**: 9 decoder tasks in `audio.rs` (3,826 LOC) share ~1,000 lines of near-identical boilerplate. Extract a generic `DecoderTask<D>`.
- **Missing tests**: `audio.rs` (3,826 LOC), `api.rs` (2,831 LOC), `main.rs` (679 LOC) have 0 tests.
- **No multi-rig integration tests**: State isolation and command routing between rigs untested.
**P2 — Medium:**
- **Decode log silent failures**: `let _ = flush()` discards errors; rotation failure has no fallback writer.
- **`api.rs` size**: 2,831 LOC with ~25 endpoint handlers and no logical separation.
- **Background decode state complexity**: 8+ nested conditionals in `run()` inner loop (~95 lines).
- **Actix-web pinned**: `=4.4.1` prevents patch-level security updates.
- **VDES magic numbers**: Plausibility thresholds (`-35`, `15`) are undocumented inline constants.
**P3 — Low:**
- **FT-817 VFO inference fragile**: Defaults to VFO A when both share the same frequency.
- **String cloning in remote client**: ~105 `.clone()` calls, some in hot poll loops.
- **Missing decoder doc comments**: `AisDecoder`, `VdesDecoder`, `RdsDecoder` lack public API docs.
- **Turbo decoder precondition**: `turbo_decode_soft()` lacks debug assertions on interleaver length.
- **No decoder tracing spans**: No `info_span!` for measuring per-decoder latency.
All P0P3 items resolved or dropped. See `docs/Improvement-Areas.md` for details.