Skip to content

🧹 Refactor capabilities function for readability - #36

Closed
undivisible wants to merge 5 commits into
mainfrom
code-health/refactor-capabilities-15435964603073314652
Closed

🧹 Refactor capabilities function for readability#36
undivisible wants to merge 5 commits into
mainfrom
code-health/refactor-capabilities-15435964603073314652

Conversation

@undivisible

@undivisible undivisible commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

🎯 What: Extracted the OS-specific blocks from capabilities() in src/lib.rs into linux_capabilities() and non_linux_capabilities().
💡 Why: This fixes an overly long (150+ lines) monolithic function, making the Executor for NativeExecutor block significantly more readable and maintainable.
Verification: Ran cargo clippy and cargo test which confirmed no regressions in functionality.
Result: A more readable, idiomatic Rust struct implementation leveraging conditionally compiled helpers.


PR created automatically by Jules for task 15435964603073314652 started by @undivisible


Note

Low Risk
Mechanical extract-method refactor with no intended behavior change; only test formatting aside from the move.

Overview
NativeExecutor::capabilities() is slimmed down by moving the large #[cfg] branches into linux_capabilities() and non_linux_capabilities() on NativeExecutor. The trait implementation now only picks the Linux vs non-Linux helper; capability logic (ATSPI permissions, supported actions, delivery routes, display geometry hashing) is unchanged in behavior.

tests/cli.rs fixes indentation in the CLI test helper’s stdin write_all block.

Reviewed by Cursor Bugbot for commit b66d8ed. Configure here.

Extracted the OS-specific blocks from `capabilities()` in `src/lib.rs` into `linux_capabilities()` and `non_linux_capabilities()` to fix the overly long function code health issue.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

google-labs-jules Bot and others added 4 commits August 27, 2026 04:42
- Added `#[allow(clippy::chunks_exact_to_as_chunks)]` in `src/cdp.rs` to fix build failures caused by a new clippy lint triggered on stable toolchains (rustc 1.98.0 in CI).
- Updated `event-listener` to v5.4.2 to resolve `RUSTSEC-2026-0221` flagged by `cargo audit` in CI.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
…capabilities-15435964603073314652

# Conflicts:
#	src/cdp.rs
Updated the `chacha20` crate from v0.10.1 (which was recently yanked) to v0.10.2 via `cargo update -p chacha20`. This fixes a CI pipeline breakage during `cargo audit --deny warnings`.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
Version 0.10.1 of chacha20 was yanked, causing `cargo audit` to fail in CI. Upgraded to 0.10.2. Also includes the `capabilities` refactor and clippy fix from earlier.

Co-authored-by: undivisible <136312656+undivisible@users.noreply.github.com>
@undivisible

Copy link
Copy Markdown
Contributor Author

Closing: CONFLICTING after sibling merges (#47/#50/#49/#44/#30); Jules extract/split superseded — prefer close over rebase fight.

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.

1 participant