fix(syntonia): unify baofeng RadioIdent + non-exhaustive RadioVariant arm#268
Merged
Conversation
… 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
enabled auto-merge (squash)
July 16, 2026 22:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
RadioIdentstructs incrates/syntonia/src/baofeng/(ident.rsvsvariant.rs) onto the canonicalident.rstype, which does correct 8/12-byte wire-response normalization and firmware-prefix extraction.identify_variantnow matches known firmware prefixes against the full 8-byte normalized ident rather than the (necessarily) 6-char-truncatedfirmware_prefixdisplay field —BF_F8HP_PREFIXESincludes 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.variant_from_configinserial_hardware.rsfor the#[non_exhaustive]RadioVariantenum 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-featuressucceeds (was: 2 errors on main)variant.rsunit tests updated to constructRadioIdentvia the canonicalfrom_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 outcomesident.rs(previously zero tests) for the 12-byte collapse path, non-graphic byte substitution, and length rejection, sinceRadioIdent::from_rawis now the single source of truth for variant matchingvgate 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,linttrailer on HEADGate-debt notes (not code changes)
RadioIdentconstructions invariant.rstests toRadioIdent::from_raw(...)introduced 7 new.unwrap()sites. PerRUST.md#error-handling("tests are real code; the standards apply"), those tests now returnResult<(), &'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.tomlentries that reference it (akroasis#261 debt, unrelated to this diff); re-lined them and dropped the onebare-assertentry that belonged to theradio_ident_firmware_prefix_handles_utf8test this PR already removes.kanon gate --stampcurrently fails on every akroasis branch (confirmed identical onorigin/mainvia a throwaway worktree) due to 12WORKFLOW/unwired-dead-code-untracked+ 1VOCAB/crate-name-collisionfindings in files this PR does not touch — the same class akroasis#267 is fixing directly, and akroasis#267 is itself blocked ongate-attestationfor 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 honestGate-Passedtrailer. No source outsidecrates/syntonia/src/baofeng/{ident,variant}.rsandcrates/akroasis/src/radio/serial_hardware.rswas modified.