Skip to content

fix(voice): import hotkey items in non-macOS dictation listener#4728

Open
YOMXXX wants to merge 1 commit into
tinyhumansai:mainfrom
YOMXXX:fix/dictation-listener-activationmode-import
Open

fix(voice): import hotkey items in non-macOS dictation listener#4728
YOMXXX wants to merge 1 commit into
tinyhumansai:mainfrom
YOMXXX:fix/dictation-listener-activationmode-import

Conversation

@YOMXXX

@YOMXXX YOMXXX commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a cfg-gated use crate::openhuman::voice::hotkey::{self, ActivationMode, HotkeyEvent}; to dictation_listener.rs so the non-macOS rdev hotkey listener compiles.
  • Fixes Linux-only build/clippy errors on main (cannot find module hotkey / cannot find type ActivationMode / cannot find type HotkeyEvent) that break cargo clippy -p openhuman — and therefore every branch merged up to main.

Problem

  • start_rdev_listener (#[cfg(not(target_os = "macos"))]) uses the hotkey module (parse_hotkey, start_listener) plus the ActivationMode and HotkeyEvent enums, but none of those items were imported into the module.
  • On Linux (CI Rust Quality (fmt, clippy)) this fails with three E0433 errors. macOS is unaffected because start_rdev_listener is cfg'd out there — so the gap is invisible when building locally on macOS.

Solution

  • Import the module + both enums in one use, gated with a matching #[cfg(not(target_os = "macos"))] so it exists exactly on the cfg that references them and does not become an unused-import warning on macOS.

Submission Checklist

  • Tests added or updated — N/A: restores compilation of existing cfg-gated code; no new behavior. The proof is that the crate builds/clippies on non-macOS.
  • Diff coverage ≥ 80% — N/A: a single use import line, no executable lines to cover.
  • Coverage matrix updated — N/A: behaviour-only change (compilation fix, no feature added/removed/renamed).
  • Affected feature IDs listed — N/A: no feature rows affected.
  • No new external network dependencies — N/A: no dependencies changed.
  • Manual smoke checklist updated — N/A: no release-cut surface touched.
  • Linked issue closed via Closes #NNN — N/A: no tracked issue; found via CI failure on Linux.

Impact

  • Non-macOS (Linux/Windows) desktop/CLI builds compile again; unblocks Rust Quality (fmt, clippy) on main. No runtime behavior change. macOS unchanged.

Related

  • Closes: N/A
  • Follow-up PR(s)/TODOs: N/A

AI Authored PR Metadata (required for Codex/Linear PRs)

  • N/A — human-only PR.

Summary by CodeRabbit

  • Chores
    • Improved platform-specific handling so hotkey/dictation code builds more cleanly on macOS, reducing unnecessary compiler warnings.

@YOMXXX YOMXXX requested a review from a team July 9, 2026 08:42
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The dictation listener now conditionally imports hotkey symbols only on non-macOS targets, so macOS builds exclude unused hotkey imports.

Changes

Platform-specific import guard

Layer / File(s) Summary
Conditional hotkey import
src/openhuman/voice/dictation_listener.rs
A #[cfg(not(target_os = "macos"))] guard now wraps the hotkey import, including hotkey, ActivationMode, and HotkeyEvent on non-macOS builds.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Poem

A tiny cfg, a whiskered guard,
Keeps macOS builds from warning hard,
Hotkey symbols stay out of sight,
On other builds they compile just right. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: gated hotkey imports for the non-macOS dictation listener.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

start_rdev_listener (cfg not(target_os = "macos")) uses the hotkey
module's parse_hotkey/start_listener plus the ActivationMode and
HotkeyEvent enums, but none were imported — so cargo clippy/build fails
on Linux with "cannot find module hotkey" / "cannot find type
ActivationMode" / "cannot find type HotkeyEvent". macOS is unaffected
because start_rdev_listener is cfg'd out there. Add a cfg-gated use
matching the only cfg that references these items (no unused-import
warning on macOS).
@YOMXXX YOMXXX force-pushed the fix/dictation-listener-activationmode-import branch from 3d28eca to 9b378c2 Compare July 9, 2026 08:46
@YOMXXX YOMXXX changed the title fix(voice): import ActivationMode in non-macOS dictation listener fix(voice): import hotkey items in non-macOS dictation listener Jul 9, 2026

@M3gA-Mind M3gA-Mind left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR #4728 — fix(voice): import hotkey items in non-macOS dictation listener

Walkthrough

This PR adds a single #[cfg(not(target_os = "macos"))]-gated use bringing hotkey, ActivationMode, and HotkeyEvent into dictation_listener.rs. start_rdev_listener (itself non-macOS) references those symbols, but the import was never wired in when voice/hotkey.rs was added in #4722 (088102386), so Linux/Windows fail to compile with E0433 while macOS — where the whole path is cfg'd out — stays green. I verified against upstream/main that the import is genuinely missing and that every reference (lines 140–182) sits inside the non-macOS start_rdev_listener, so the gate matches the usage exactly. The fix is correct, minimal, and warning-clean on macOS. Assessment: correct and ready — the only substantive issue is that it duplicates PR #4736.

Changes

File Summary
src/openhuman/voice/dictation_listener.rs Adds a non-macOS-gated use crate::openhuman::voice::hotkey::{self, ActivationMode, HotkeyEvent}; so the rdev listener compiles on Linux/Windows.

Actionable comments (0)

No blocking or major issues. The change does exactly what the title claims and the cfg gate is placed correctly.

Duplicate PR — needs maintainer decision (1)

  • src/openhuman/voice/dictation_listener.rs:19-20 — duplicate of #4736. PR #4736 (fix/voice-dictation-imports) makes the functionally identical fix, differing only in import spelling: this PR uses use crate::openhuman::voice::hotkey::{...} while #4736 uses use super::hotkey::{...}. Both resolve to the same module (dictation_listener.rs lives in src/openhuman/voice/, so super == crate::openhuman::voice) and both carry the same #[cfg(not(target_os = "macos"))] gate. Only one should merge; the other should be closed to avoid a conflicting no-op. Note this PR was opened first (08:42Z vs 11:42Z), and its crate::… spelling matches the adjacent use crate::openhuman::config::Config; on line 15 — a slight consistency point in this PR's favor. This is a maintainer call, not a code defect.

Nitpicks (0)

  • None. The explanatory comment on lines 16–18 is accurate and appropriately scoped ("why", not "what").

Questions for the author (0)

  • None.

Verified / looks good

  • Bug is real: upstream/main (7659c75dc) is missing this import; start_rdev_listener references hotkey::parse_hotkey, hotkey::start_listener, ActivationMode::{Push,Tap}, and HotkeyEvent::{Pressed,Released} with no useE0433 on non-macOS. Introduced by #4722.
  • cfg gate is exact: every reference to the imported symbols (lines 140–182) is inside start_rdev_listener, which is #[cfg(not(target_os = "macos"))] (line 136). No macOS unused_imports warning; no missing-symbol error on Linux/Windows.
  • Symbols exist: hotkey.rs exports pub enum ActivationMode (:25), pub enum HotkeyEvent (:35), pub fn parse_hotkey (:154), pub fn start_listener (:191); voice/mod.rs declares pub mod hotkey;.
  • Testing N/A is justified: import-only change with no executable lines; CI Rust Quality (Linux clippy) is the authoritative signal.
  • CodeRabbit posted an APPROVED review with a trivial-effort walkthrough and no actionable inline threads; there are no maintainer threads to resolve.

Leaving this as a comment per instruction — approve/merge is the maintainer's decision, especially given the #4736 duplication.

// `ActivationMode`, `HotkeyEvent`, and `parse_hotkey`/`start_listener` fns — so
// gate the import to the same cfg to avoid unused-import warnings on macOS.
#[cfg(not(target_os = "macos"))]
use crate::openhuman::voice::hotkey::{self, ActivationMode, HotkeyEvent};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate of #4736 — one should be closed. This import is functionally identical to the one added by PR #4736; the only difference is spelling: here it's use crate::openhuman::voice::hotkey::{self, ActivationMode, HotkeyEvent};, in #4736 it's use super::hotkey::{...}. Both resolve to the same module and both carry the same #[cfg(not(target_os = "macos"))] gate, so exactly one of these PRs should land and the other be closed. Two points favor this PR as the canonical one: it was opened first (08:42Z vs 11:42Z), and the crate::… spelling matches the adjacent use crate::openhuman::config::Config; on line 15. Otherwise the fix is correct — every reference to these symbols (lines 140–182) lives inside the non-macOS start_rdev_listener, so the cfg gate matches usage exactly. Maintainer call.

@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Confirming this is the canonical PR for the missing non-macOS dictation_listener import fix. The duplicate #4736 (same fix, super::hotkey spelling) has been closed in favor of this one — it was opened earlier and its use crate::openhuman::voice::hotkey spelling matches the adjacent imports in the file. Thanks @YOMXXX; this correctly unblocks the not(target_os = "macos") build (E0433) introduced by #4722. Leaving the merge decision to a maintainer.

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.

2 participants