Skip to content

chore(windows): make clippy -D warnings pass on a Windows host - #5762

Merged
senamakel merged 1 commit into
tinyhumansai:mainfrom
ntdatt812:chore/windows-clippy-clean
Sep 11, 2026
Merged

senamakel merged 1 commit into
tinyhumansai:mainfrom
ntdatt812:chore/windows-clippy-clean

Conversation

@ntdatt812

@ntdatt812 ntdatt812 commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

No commit can be pushed from a Windows checkout

.husky/pre-push runs cargo clippy -p openhuman -- -D warnings and then the same for app/src-tauri. On a Windows host both fail before reaching anything the developer changed — 11 errors in the core crate, 4 in the Tauri crate.

Linux CI never sees them: every one sits in a path guarded by #[cfg(windows)] / #[cfg(not(unix))], so the lint only fires where those arms are compiled. The practical effect is that the hook is unpassable on Windows, and the only way to push is --no-verify — which disables the TypeScript, format and lint checks too.

What changed

Imports only one platform uses, gated the way their neighbours already are:

file import used by
core/auth.rs, security/pairing.rs std::io::Write only the #[cfg(unix)] arm of the token writer — the #[cfg(not(unix))] arm calls std::fs::write
composio/trigger_history.rs fs2::FileExt only the #[cfg(not(windows))] lock/unlock path — Windows serializes through the process-local Mutex above it

In both files the gate matches the #[cfg(unix)] use std::os::unix::fs::OpenOptionsExt line sitting directly below.

Two imports were simply redundant:

inference/local/process_util.rs and inference/voice/local_speech.rs import std::os::windows::process::CommandExt to call creation_flags, but that is an inherent method on tokio::process::Command under Windows, so the trait import adds nothing.

Ordinary lints in Windows-only code:

  • sandbox/cwd_jail/windows.rs — drop the unused HANDLE import; drop mut from dacl_present (only ever read, via let _ =); pass &ea to SetEntriesInAclW, whose second parameter is *const EXPLICIT_ACCESS_W; add the Default impl clippy asks for beside AppContainerBackend::new().
  • security/keyring/encrypted_store.rs — the #[cfg(windows)] arm shadows msg rather than mutating it, so mut was unnecessary on both platforms; the #[cfg_attr(not(windows), allow(unused_mut))] escape hatch goes with it.
  • platform/doctor/core.rs, src-tauri/claude_code.rs — on Windows the sibling #[cfg] blocks are stripped, so the remaining block is the function tail and return is noise. The macOS/Linux arms of claude_code_login_launch already end in a bare expression; this makes the Windows arm match.
  • src-tauri/core_process.rs — parse_lsof_pid parses lsof output and is reachable only from the #[cfg(unix)] find_pid_on_port, so it is dead on Windows. Gated with #[cfg(unix)], along with its import and test.
  • src-tauri/deep_link_ipc_windows.rs — name the boxed callback (type LiveHandler) so the static and its accessor stop tripping clippy::type_complexity.

Verification

No behaviour changes — every edit is an import gate, a removed mut/return, a &mut → &, a type alias, or a Default impl.

cargo clippy -p openhuman -- -D warnings                        clean
cargo clippy --manifest-path app/src-tauri/Cargo.toml -- -D warnings   clean
cargo clippy --manifest-path app/src-tauri/Cargo.toml --all-targets    clean
cargo fmt -- --check                                            clean

Tests for every touched module:

openhuman::sandbox            76 passed
openhuman::security          819 passed
openhuman::platform::doctor   22 passed
composio::trigger_history      4 passed
core::auth                    19 passed

This branch was pushed with the pre-push hook running and passing on Windows — which is the point of the change.

Summary by CodeRabbit

  • Refactor

    • Improved platform-specific compilation across Unix and Windows environments.
    • Simplified internal control flow and type definitions without changing application behavior.
    • Added a default construction path for the Windows sandbox backend.
    • Removed unused imports and unnecessary mutability.
  • Chores

    • Updated platform-specific tests and build configuration to avoid compiling unsupported Unix-only components on other platforms.
    • No user-facing functionality or runtime behavior changed.

@coderabbitai

coderabbitai Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: ece3d67e-1c7d-4353-a26d-15b20b470501

📥 Commits

Reviewing files that changed from the base of the PR and between 8e65c40 and c616bff.

📒 Files selected for processing (12)
  • app/src-tauri/src/claude_code.rs
  • app/src-tauri/src/core_process.rs
  • app/src-tauri/src/core_process_tests.rs
  • app/src-tauri/src/deep_link_ipc_windows.rs
  • src/core/auth.rs
  • src/openhuman/inference/local/process_util.rs
  • src/openhuman/inference/voice/local_speech.rs
  • src/openhuman/integrations/composio/trigger_history.rs
  • src/openhuman/platform/doctor/core_part_01.rs
  • src/openhuman/sandbox/cwd_jail/windows.rs
  • src/openhuman/security/keyring/encrypted_store.rs
  • src/openhuman/security/pairing.rs
💤 Files with no reviewable changes (2)
  • src/openhuman/inference/local/process_util.rs
  • src/openhuman/inference/voice/local_speech.rs
🚧 Files skipped from review as they are similar to previous changes (9)
  • app/src-tauri/src/claude_code.rs
  • src/openhuman/security/pairing.rs
  • app/src-tauri/src/core_process.rs
  • app/src-tauri/src/core_process_tests.rs
  • src/openhuman/sandbox/cwd_jail/windows.rs
  • src/core/auth.rs
  • src/openhuman/security/keyring/encrypted_store.rs
  • src/openhuman/integrations/composio/trigger_history.rs
  • app/src-tauri/src/deep_link_ipc_windows.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Walkthrough

Walkthrough

The changes add platform-specific compilation guards, remove unused imports and mutability, add Default for AppContainerBackend, introduce a callback type alias, and simplify terminal expressions. Runtime behavior remains unchanged.

Changes

Platform and Rust Cleanup

Layer / File(s) Summary
Unix compilation guards
app/src-tauri/src/core_process.rs, app/src-tauri/src/core_process_tests.rs, src/core/auth.rs, src/openhuman/integrations/composio/trigger_history.rs, src/openhuman/security/pairing.rs
Unix-only parser code, tests, and imports now use conditional compilation.
Windows code cleanup
src/openhuman/inference/local/process_util.rs, src/openhuman/inference/voice/local_speech.rs, src/openhuman/sandbox/cwd_jail/windows.rs, src/openhuman/security/keyring/encrypted_store.rs
Unused Windows symbols and imports were removed. Mutability and ACL argument passing were simplified. AppContainerBackend now implements Default.
Type and expression cleanup
app/src-tauri/src/deep_link_ipc_windows.rs, app/src-tauri/src/claude_code.rs, src/openhuman/platform/doctor/core_part_01.rs
The deep-link callback uses a type alias. Terminal Windows expressions no longer use explicit return statements.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to c616b

This PR makes platform-specific lint and compile-cleanliness fixes without changing runtime behavior; the reported checks and targeted tests pass, so no actionable merge-blocking risk remains beyond normal review.

Suggested reviewers: senamakel

Poem

A rabbit checks each platform gate
And trims the syntax at the gate
A callback finds a shorter name
Windows code stays just the same
Unix tests hop into their lane

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 16 functions across 11 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main purpose of the changes: updating Windows-specific Rust code so cargo clippy -D warnings passes on Windows hosts.
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.
  • Fix all pre-merge checks with AI

Warning

Your free Security trial is over. An organization admin can upgrade to Advanced for continuous pull request security review or dismiss this notice.


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

@tinysweeper

tinysweeper Bot commented Aug 25, 2026 •

Copy link
Copy Markdown

How this change flows

4 changed behaviours across 20 relationships. 6 surrounding behaviours are shown (60 graph nodes walked). 31 further behaviours left out to keep the diagram readable.

flowchart LR
  n0["claude_code_login_launch<br/>changed"]:::changed
  n1["find_pid_on_port<br/>changed"]:::changed
  n2["synthesize_piper<br/>changed"]:::changed
  n3["check_workspace<br/>changed"]:::changed
  n4["format"]:::impacted
  n5["...ws_port_takeover_finds_and_kills_listener"]:::impacted
  n6["Command"]:::impacted
  n7["join"]:::impacted
  n8["spawn_in_container"]:::impacted
  n9["...cover_validation_and_mocked_runtime_paths"]:::impacted
  n0 -->|calls| n4
  n1 -->|calls| n4
  n1 -->|uses| n6
  n2 -->|calls| n4
  n2 -->|uses| n6
  n2 -->|calls| n7
  n3 -->|calls| n4
  n3 -->|calls| n7
  n5 -->|calls| n1
  n5 -->|tests| n1
  n5 -->|calls| n4
  n5 -->|tests| n4
  n5 -->|uses| n6
  n7 -->|calls| n4
  n8 -->|calls| n4
  n8 -->|uses| n6
  n9 -->|calls| n2
  n9 -->|tests| n2
  n9 -->|calls| n7
  n9 -->|tests| n7
  classDef changed fill:#0d4429,stroke:#238636,color:#e6edf3
  classDef impacted fill:#161b22,stroke:#6e7681,color:#c9d1d9
  classDef flagged fill:#5a1e02,stroke:#d93f0b,color:#ffffff
  classDef blocking fill:#67060c,stroke:#f85149,color:#ffffff
Loading

Green: changed behaviour. Grey: surrounding behaviour. Arrows name the call, use, implementation, or test relationship. Orange: has findings. Red: has a finding that blocks the merge.

tinysweeper 0.1.0

@tinysweeper tinysweeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

tinysweeper found nothing blocking. Approving.

$0.0000 · 0 in / 0 out

@tinysweeper tinysweeper Bot added the priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect. label Aug 25, 2026
coderabbitai[bot]
coderabbitai Bot previously approved these changes Aug 25, 2026
@ntdatt812

Copy link
Copy Markdown
Contributor Author

The red Rust Core Coverage job on this branch is not this diff. It is a latent test-isolation bug that this PR's changed-module filter exposed, and I have opened #5769 to fix it.

The two failures

openhuman::integrations::composio::ops::tests::composio_delete_connection_clear_memory_cascades_source_tree_and_content_file
openhuman::integrations::composio::ops::tests::composio_delete_connection_clear_memory_cascades_live_sealed_tree_and_file

called `Result::unwrap()` on an `Err` value: "[composio] delete_connection cannot
resolve the memory client: no EmbeddingHost installed — the host must call
memory::embedding_host::set_embedding_host during startup wiring, before any
memory work begins"

Those tests resolve the process-global memory client and never call install_for_tests(), so they pass only when an earlier test in the same binary installs the seams first. ops_tests.rs already warns about this hazard in a comment on notion_cleanup_targets_include_synced_page_sources; these are the tests that omit the call.

Why it fired here and not on main

Rust Core Coverage runs only the modules a PR changed, and the two filters differ:

filter result
main @ ac4e671eb (run) openhuman::agent … **openhuman::memory** … 5268 passed; 0 failed
this PR (run) core::auth openhuman::inference openhuman::integrations openhuman::platform openhuman::sandbox openhuman::security 2743 passed; 2 failed

With openhuman::memory in the filter you get one of the 104 install_for_tests() callers for free. Without it, nothing installs the seams and the composio tests go red.

Reproduced with no changes in the tree, clean main @ ac4e671eb:

cargo test -p openhuman --lib -- composio_delete_connection_clear_memory
test result: FAILED. 0 passed; 4 failed; 0 ignored; 0 measured; 11507 filtered out

All four — not just the two CI happened to schedule first. Which ones go red depends on ordering, so this would have bitten the next PR too.

Why it cannot be this diff. The only composio file here is trigger_history.rs, one line:

+#[cfg(not(windows))]
 use fs2::FileExt;

On Linux that predicate is true and the import is kept, so the Linux build of this branch is identical to main in that file. None of the other eleven files is in openhuman::integrations.

#5769 adds the missing install_for_tests() to all four tests. With it applied, this PR's exact filter set runs 2733 passed; 1 failed locally on Windows, the one failure being platform::connectivity::rpc::tests::port_excluded_error_rejects_addr_in_use_and_others (PermissionDenied binding a port), which fails identically on a clean tree on this box and is green on Linux CI.

Once #5769 lands I will re-run this branch.

@ntdatt812

Copy link
Copy Markdown
Contributor Author

#5769's own CI settles it: 19 checks green, and Rust Core Coverage passed with the filter

--lib -- openhuman::integrations

no openhuman::memory in it — exactly the selection that goes red on this branch. All four composio tests ran and passed under it:

composio_delete_connection_clear_memory_cascades_live_sealed_tree_and_file ... ok
composio_delete_connection_clear_memory_cascades_source_tree_and_content_file ... ok
composio_delete_connection_clear_memory_deletes_slack_source ... ok
composio_delete_connection_clear_memory_keeps_other_gmail_connections ... ok

test result: ok. 518 passed; 0 failed

So the two red tests here are not this diff, and #5769 fixes them without any change to production code. Once it lands I will re-run this branch.

@M3gA-Mind

Copy link
Copy Markdown
Collaborator

Maintainer review — no changes pushed, read-only assessment.

State: CONFLICTING, 1,599 commits behind main. The premise still holds — a Windows checkout still cannot pass .husky/pre-push, and every fix here is still applicable.

On the change: it is the right kind of PR. Every edit is an import gate, a removed mut/return, a &mut→&, a type alias, or a Default impl, and the reasoning in the table (gating each import to match the #[cfg] on the line below it) matches the surrounding style rather than reaching for #[allow]. That is the distinction that makes this worth landing.

Rebasing it — one conflict, and it is not what it looks like

Only src/openhuman/platform/doctor/core.rs conflicts, and the whole-file diff is misleading. openhuman#5856/#5857 split large sources into _part_NN.rs fragments pulled in by include!(). On main, platform/doctor/core.rs is now five lines:

#[cfg(test)]
#[path = "core_tests.rs"]
mod tests;
include!("core_part_01.rs");
include!("core_part_02.rs");

Your one-line change moved with the body. Take main's core.rs verbatim and apply the edit to src/openhuman/platform/doctor/core_part_01.rs:495-499, where available_disk_space_mb now lives:

    #[cfg(target_os = "windows")]
    {
-       return available_disk_space_mb_windows(path);
+       available_disk_space_mb_windows(path)
    }

I confirmed the other eleven files rebase clean — they auto-merge with no conflict.

Two things to check while you are in there, both consequences of the same split:

  • The layout gate (scripts/ci/check-openhuman-rust-layout.mjs) is a monotonic ratchet: files under src/openhuman are capped at 750 lines, with four pinned legacy exceptions that may not grow. Adding lines to any _part_NN.rs can trip it even when the change is trivial.
  • Inline #[cfg(test)] mod tests { ... } is now rejected outright; test modules must be sibling *_tests.rs files. Your core_process_tests.rs change is already in the right shape.

Current red checks are not diagnostic — with the branch this far behind, PR CI Gate and Rust Core Coverage are reporting against a stale merge base. Rebase first, then read CI.

Not approving; a maintainer reviews and merges.

`cargo clippy -p openhuman -- -D warnings` is what .husky/pre-push runs,
and on Windows it fails with 11 errors before it reaches anything the
developer changed. Linux CI never sees them: every one is in a code path
guarded by #[cfg(windows)] or #[cfg(not(unix))], so the lint only fires
where those arms are compiled. The practical effect is that no commit can
be pushed from a Windows checkout.

Imports that only one platform uses are now gated the way the imports
beside them already were:

- core/auth.rs, security/pairing.rs: `std::io::Write` is used solely by
  the #[cfg(unix)] arm of the token writer; the #[cfg(not(unix))] arm
  calls std::fs::write. Gated with #[cfg(unix)], matching the
  OpenOptionsExt import directly below it.
- composio/trigger_history.rs: `fs2::FileExt` backs the
  #[cfg(not(windows))] lock/unlock path only - Windows serializes through
  the process-local Mutex above it.

Two imports were redundant rather than platform-specific:

- inference/local/process_util.rs, inference/voice/local_speech.rs:
  `creation_flags` is an inherent method on tokio::process::Command under
  Windows, so importing std's CommandExt adds nothing.

The rest are ordinary lints in Windows-only code:

- sandbox/cwd_jail/windows.rs: drop the unused HANDLE import, drop `mut`
  from `dacl_present` (only ever read), pass `&ea` to SetEntriesInAclW
  which takes *const, and add the Default impl clippy asks for next to
  AppContainerBackend::new().
- security/keyring/encrypted_store.rs: the #[cfg(windows)] arm shadows
  `msg` rather than mutating it, so `mut` was unnecessary on both
  platforms and the #[cfg_attr(not(windows), allow(unused_mut))] escape
  hatch can go with it.
- platform/doctor/core.rs: on Windows the sibling #[cfg] block is stripped,
  so the remaining block is the function tail and the `return` is noise.

No behaviour changes. cargo fmt clean, and clippy -D warnings now passes
on Windows.
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

ntdatt812 added a commit to ntdatt812/openhuman that referenced this pull request Sep 2, 2026
The four composio_delete_connection_clear_memory_* tests take the
clear_memory=true path, which resolves the process-global memory client
through active_memory_client(). The embedding seam fails loudly when
unwired, and none of these four call install_for_tests() — so they pass
only while some earlier test in the same binary happened to install the
seams first.

ops_tests.rs already warns about exactly this, on
notion_cleanup_targets_include_synced_page_sources. These four are the
tests that omit it.

Run alone against a clean main, all four fail with

  [composio] delete_connection cannot resolve the memory client:
  no EmbeddingHost installed

CI has been green because Rust Core Coverage only runs the modules a PR
changed: a filter that includes openhuman::memory picks up one of the 104
install_for_tests() callers for free, and one that does not gets red
composio tests. That is what happened on tinyhumansai#5762, whose diff touches no
composio code that Linux compiles.
@senamakel
senamakel merged commit d238130 into tinyhumansai:main Sep 11, 2026
31 checks passed
senamakel added a commit to HDZTony/openhuman that referenced this pull request Sep 11, 2026
…ppy-clean\n\nchore(windows): make clippy -D warnings pass on a Windows host\n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: p3 Whenever. Cosmetic, a nicety, or a cleanup with no user visible effect.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants