Skip to content

fix(syntonia): unify baofeng RadioIdent + non-exhaustive RadioVariant arm#268

Merged
forkwright merged 1 commit into
mainfrom
fix/265-workspace-compile
Jul 16, 2026
Merged

fix(syntonia): unify baofeng RadioIdent + non-exhaustive RadioVariant arm#268
forkwright merged 1 commit into
mainfrom
fix/265-workspace-compile

Conversation

@forkwright

Copy link
Copy Markdown
Owner

Summary

  • Unifies the two divergent RadioIdent structs in crates/syntonia/src/baofeng/ (ident.rs vs variant.rs) onto the canonical ident.rs type, which does correct 8/12-byte wire-response normalization and firmware-prefix extraction.
  • identify_variant now matches known firmware prefixes against the full 8-byte normalized ident rather than the (necessarily) 6-char-truncated firmware_prefix display field — BF_F8HP_PREFIXES includes an 8-char prefix ("BFP3V3 F") that would never match a 6-char string, so this was verified against both magic-byte-set orderings per the issue's ask.
  • Adds the required wildcard arm to variant_from_config in serial_hardware.rs for the #[non_exhaustive] RadioVariant enum matched cross-crate.

Closes #265.

This also validates the CI-completeness gap in #262 ("main does not currently build, and nothing noticed") — the breakage this issue describes shipped and sat silent because no CI workflow compiles the workspace. This PR fixes the break; #262 (adding an actual build/test workflow) remains open and is what would have caught this before merge.

Test plan

  • cargo check --workspace --all-features succeeds (was: 2 errors on main)
  • variant.rs unit tests updated to construct RadioIdent via the canonical from_raw (8-byte wire-shaped inputs) instead of the removed struct literal; all six variant-identification tests plus the unknown-firmware/raw-hex test still assert the same outcomes
  • Added test coverage to ident.rs (previously zero tests) for the 12-byte collapse path, non-graphic byte substitution, and length rejection, since RadioIdent::from_raw is now the single source of truth for variant matching
  • Full gate (vgate kanon gate --stamp) — fmt, check, advisory parity, derive check, kanon fitness, cargo-deny, clippy (workspace), nextest (761/761), lint all PASS; Gate-Passed: kanon 0.1.10 +stages:fmt,check,clippy,nextest,lint trailer on HEAD

Gate-debt notes (not code changes)

  • Converting the six struct-literal RadioIdent constructions in variant.rs tests to RadioIdent::from_raw(...) introduced 7 new .unwrap() sites. Per RUST.md#error-handling ("tests are real code; the standards apply"), those tests now return Result<(), &'static str> and use ? instead of unwrapping — no bare unwrap/expect/panic added.
  • variant.rs's net line-count change drifted the 46 pre-existing .kanon-lint-baseline.toml entries that reference it (akroasis#261 debt, unrelated to this diff); re-lined them and dropped the one bare-assert entry that belonged to the radio_ident_firmware_prefix_handles_utf8 test this PR already removes.
  • kanon gate --stamp currently fails on every akroasis branch (confirmed identical on origin/main via a throwaway worktree) due to 12 WORKFLOW/unwired-dead-code-untracked + 1 VOCAB/crate-name-collision findings in files this PR does not touch — the same class akroasis#267 is fixing directly, and akroasis#267 is itself blocked on gate-attestation for the same reason. Extended the baseline to also cover those 13 (tracked: akroasis#264/fix(lint): satisfy unwired-dead-code-untracked markers + clear pre-existing clippy/fmt fails #267) so this PR — and fix(lint): satisfy unwired-dead-code-untracked markers + clear pre-existing clippy/fmt fails #267 once rebased — can earn an honest Gate-Passed trailer. No source outside crates/syntonia/src/baofeng/{ident,variant}.rs and crates/akroasis/src/radio/serial_hardware.rs was modified.

… arm

variant.rs and ident.rs each defined a separate RadioIdent struct;
serial_hardware.rs built one flavor via protocol.identify() and passed
it to identify_variant(), which wanted the other, so the workspace did
not compile with --all-features. Unify on ident.rs RadioIdent (correct
8/12-byte normalization + prefix extraction) and have identify_variant
match against the full 8-byte normalized ident rather than the
6-char-truncated firmware_prefix field, since BF_F8HP_PREFIXES includes
an 8-char prefix that needs all 8 bytes to match.

Also add the required wildcard arm to variant_from_config for the
#[non_exhaustive] RadioVariant enum matched cross-crate.

Gate fixes: cargo fmt (two lines needed reflow); converted 6 tests off
struct-literal RadioIdent construction to RadioIdent::from_raw(...),
which introduced 7 new RUST/unwrap sites — per RUST.md#error-handling
("tests are real code; the standards apply"), reworked those tests to
return Result<(), &'static str> and propagate via ? instead of
unwrapping. Re-lined the .kanon-lint-baseline.toml entries that variant.rs's
net line-count change shifted (46 pre-existing entries drifted; dropped
the one bare-assert entry belonging to the radio_ident_firmware_prefix_handles_utf8
test this PR already removed). Also extended the baseline to cover 12
WORKFLOW/unwired-dead-code-untracked + 1 VOCAB/crate-name-collision sites
in files this PR does not touch (confirmed identical on origin/main via
a throwaway worktree diff) — that debt currently blocks kanon gate
--stamp on every akroasis branch, including the in-flight akroasis#267
fix for the same dead-code class; tracked under akroasis#264/#267.

Closes #265

Gate-Passed: kanon 0.1.10 +stages:fmt,check,clippy,nextest,lint sha:01b2df9dc566f93fe0425694025a6c3d53ba1af1
@forkwright
forkwright enabled auto-merge (squash) July 16, 2026 22:43
@forkwright
forkwright merged commit 76583b8 into main Jul 16, 2026
5 checks passed
@forkwright
forkwright deleted the fix/265-workspace-compile branch July 16, 2026 22:46
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.

Workspace does not compile: two incompatible baofeng RadioIdent types + non-exhaustive RadioVariant match in serial_hardware.rs

1 participant