fix(rb-12): hotkey device filter consults configured HotkeyCombo

try_attach_device was rejecting any device that did not report KEY_A or
KEY_R — a leftover heuristic from the whisper-overlay seed. A user whose
binding was anything else (Ctrl+Shift+D is a common default) would see
no hotkey events from that device even though it supports the key.

Replace the hard-coded check with device_supports_combo(supported,
combo), a pure helper that reads the configured trigger key code from
the HotkeyCombo snapshot. Snapshot is taken from hotkey_rx.borrow()
before opening the device; an unconfigured or shutting-down listener
short-circuits to a non-attach.

Four regression tests in linux::tests cover: supported+D → attach,
unsupported → reject, no reported keys → reject, and the explicit
non-A/non-R case that demonstrates the bug.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 10:18:54 +01:00
parent 1250a70ba2
commit 528facfab0
3 changed files with 98 additions and 11 deletions

View File

@@ -19,7 +19,7 @@ should be mirrored as real GitHub issues on `jakejars/kon`.
| RB-02 | [c3-migrations-atomicity.md](c3-migrations-atomicity.md) | `crates/storage/migrations.rs` | medium |
| RB-03 | [c4-transcript-profile-fk.md](c4-transcript-profile-fk.md) | `crates/storage/migrations.rs` + `database.rs` | large |
## MAJOR (9)
## MAJOR (8 open, 1 resolved)
| # | File | Area | Fix scope |
|---|---|---|---|
@@ -31,7 +31,12 @@ should be mirrored as real GitHub issues on `jakejars/kon`.
| RB-09 | [decoder-partial-audio-on-error.md](decoder-partial-audio-on-error.md) | `crates/audio/decode.rs` | medium |
| RB-10 | [llm-prompt-preflight.md](llm-prompt-preflight.md) | `crates/llm/lib.rs` | medium |
| RB-11 | [keystore-thread-safety.md](keystore-thread-safety.md) | `crates/cloud-providers/keystore.rs` | medium |
| RB-12 | [hotkey-linux-device-filter.md](hotkey-linux-device-filter.md) | `crates/hotkey/linux.rs` | small |
## Resolved
| # | File | Area | Resolution |
|---|---|---|---|
| RB-12 | [hotkey-linux-device-filter.md](hotkey-linux-device-filter.md) | `crates/hotkey/linux.rs` | Extracted `device_supports_combo` helper; `try_attach_device` now reads the configured `HotkeyCombo` from the watch channel and checks support for that trigger key. Four regression tests land in `linux::tests`. |
## Dependencies

View File

@@ -4,6 +4,24 @@
**Path:** `crates/hotkey/src/linux.rs:236-241`
**Source:** [2026-04-22 code review](../code-review-2026-04-22.md)
**Labels:** release-blocker, major, hotkey, correctness
**Status:** RESOLVED (2026-04-22)
## Resolution
Extracted `device_supports_combo(supported, combo) -> bool` as a pure helper.
`try_attach_device` now snapshots the current `HotkeyCombo` from `hotkey_rx`
(returning early with `false` if the listener is unconfigured) and uses the
helper to filter devices by the configured trigger key.
Tests in `crates/hotkey/src/linux.rs` (`linux::tests`):
- `attaches_when_device_supports_configured_trigger`
- `rejects_when_device_lacks_configured_trigger`
- `rejects_when_device_reports_no_keys`
- `attaches_for_non_a_non_r_trigger` (direct regression)
Manual verification of the Ctrl+Shift+D binding in Settings remains on the
ship-gate checklist — code path is correct; runtime GUI check is deferred.
## Problem