Skip to content

fix(rust): clear stable Clippy baseline warnings - #1914

Open
lawrencecchen wants to merge 1 commit into
mainfrom
chore/rust-clippy-baseline
Open

fix(rust): clear stable Clippy baseline warnings#1914
lawrencecchen wants to merge 1 commit into
mainfrom
chore/rust-clippy-baseline

Conversation

@lawrencecchen

@lawrencecchen lawrencecchen commented Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Clear the stable Rust 1.98 Clippy failures in cmux-proxy, global-proxy, native-core, and sandbox.
  • Box HTTP response errors in private proxy helpers to satisfy result_large_err without changing behavior.
  • Apply equivalent mechanical fixes for guarded matches, map iteration, byte strings, and cache sorting.
  • Keep -D warnings unchanged. This PR does not modify workflows or CI policy.

Verification

  • rustup run 1.98.0 cargo fmt --all -- --check passes in all four crates.
  • rustup run 1.98.0 cargo clippy --all-targets --all-features -- -D warnings passes in all four crates.
  • rustup run 1.98.0 cargo test --all-features --locked passes in all four crates.

The failures were reproduced on fresh main at 9ab841fc0a8aae5f69f0e4328af36ed0f70c5e39; the CI hardening PR remains separate at #1910.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Summary by cubic

Clears stable Rust 1.98 Clippy warnings in cmux-proxy, global-proxy, native-core, and sandbox without changing behavior.

  • Boxes HTTP response errors in private proxy helpers to satisfy result_large_err.
  • Applies mechanical fixes for guarded matches, map iteration, byte strings, and cache sorting.
  • Keeps -D warnings unchanged; CI policy is untouched.

Written for commit 02c838e. Summary will update on new commits.

Review in cubic

Summary by CodeRabbit

  • Refactor

    • Improved proxy error handling for more consistent response processing.
    • Simplified rename detection and cache sorting logic without changing results.
    • Streamlined sandbox navigation, pruning, signal forwarding, and terminal protocol handling while preserving existing behavior.
    • Simplified list rendering conditions with no visible output changes.
  • Tests

    • Updated test handling for expected connection errors; runtime behavior remains unchanged.

@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
cmux-client Error Error Sep 2, 2026 9:06pm UTC
cmux-www Ready Ready Preview Sep 2, 2026 9:06pm UTC

@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Team

Run ID: 820d6b0e-b9a5-4af4-9e45-f586e9e501e2

📥 Commits

Reviewing files that changed from the base of the PR and between 9ab841f and 02c838e.

📒 Files selected for processing (10)
  • apps/global-proxy/src/lib.rs
  • apps/global-proxy/tests/proxy_tests.rs
  • apps/server/native/core/src/diff/refs.rs
  • apps/server/native/core/src/repo/cache.rs
  • crates/cmux-proxy/src/lib.rs
  • packages/sandbox/src/acp_client/markdown.rs
  • packages/sandbox/src/bin/cli.rs
  • packages/sandbox/src/bubblewrap.rs
  • packages/sandbox/src/mux/runner.rs
  • packages/sandbox/src/mux/terminal.rs

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


📝 Walkthrough

Walkthrough

The proxy modules now box HTTP response errors through shared result aliases and unwrap them at response boundaries. Other changes simplify equivalent Rust match, sorting, iteration, and byte-comparison expressions. Tests add targeted lint expectations.

Changes

Proxy error boxing

Layer / File(s) Summary
Box cmux proxy response errors
crates/cmux-proxy/src/lib.rs
Proxy handlers use boxed response errors through shared aliases and response_error. HTTP, upgrade, CONNECT, and header validation paths use the new result type.
Box global WebSocket errors
apps/global-proxy/src/lib.rs, apps/global-proxy/tests/proxy_tests.rs
Upstream WebSocket errors are boxed, and the handler dereferences them before returning. Test callbacks add targeted lint expectations.

Rust expression cleanup

Layer / File(s) Summary
Simplify server matching and sorting
apps/server/native/core/src/diff/refs.rs, apps/server/native/core/src/repo/cache.rs
Rename detection uses a match guard. Cache sorting uses sort_by_key with Reverse and preserves descending access order.
Simplify sandbox control flow and iteration
packages/sandbox/src/acp_client/markdown.rs, packages/sandbox/src/bin/cli.rs, packages/sandbox/src/bubblewrap.rs, packages/sandbox/src/mux/runner.rs
Equivalent match guards, key/value iteration, and key-based sorting replace nested conditionals and comparator closures.
Normalize terminal byte guards
packages/sandbox/src/mux/terminal.rs
Terminal intermediate-byte comparisons use dereferenced byte strings with unchanged semantics.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 02c83

This PR applies localized Rust and proxy error-representation cleanup while preserving existing behavior and deployment configuration. Formatting, Clippy, and tests pass, so no actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.69% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 10 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 and concisely describes the main change: resolving stable Rust Clippy warnings across the affected crates without changing CI policy.
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
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/rust-clippy-baseline

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.

@greptile-apps

greptile-apps Bot commented Sep 2, 2026

Copy link
Copy Markdown

Greptile Summary

The PR applies behavior-preserving Rust 1.98 Clippy fixes across proxy, native-core, and sandbox code while retaining strict warning enforcement.

  • Boxes private proxy response errors and unboxes them at service response boundaries.
  • Rewrites guarded matches, map iteration, stable sorting, and single-byte comparisons into Clippy-preferred forms.
  • Adds narrowly scoped lint expectations for dependency-fixed WebSocket callback error types in tests.

Confidence Score: 5/5

The PR appears safe to merge, with no actionable behavioral or security regressions identified.

The changed error paths preserve their response values at service boundaries, and the remaining Clippy-oriented rewrites retain the prior matching, iteration, sorting, and terminal parsing semantics.

Important Files Changed

Filename Overview
apps/global-proxy/src/lib.rs Boxes private WebSocket response errors while preserving statuses, bodies, and unboxing at the caller boundary.
crates/cmux-proxy/src/lib.rs Consolidates proxy helper result aliases around boxed response errors with consistent conversion at the service boundary.
apps/server/native/core/src/diff/refs.rs Moves rename-record validation into a match guard without changing accepted records or fallback behavior.
apps/server/native/core/src/repo/cache.rs Replaces descending timestamp comparators with equivalent stable Reverse-key sorting.
packages/sandbox/src/bin/cli.rs Replaces the prune comparator with equivalent stable ascending key sorting.
packages/sandbox/src/bubblewrap.rs Uses map key and value iterators where the discarded tuple member was unused.
packages/sandbox/src/mux/terminal.rs Rewrites single-byte intermediate comparisons to equivalent byte-string expressions.

Reviews (1): Last reviewed commit: "fix(rust): clear stable clippy baseline ..." | Re-trigger Greptile

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