Skip to content

refactor(encryption): return the AES-NI probe directly (LAB-6339) - #81

Merged
27Bslash6 merged 1 commit into
mainfrom
lab-6339-beta-clippy-needless-bool
Sep 29, 2026
Merged

27Bslash6 merged 1 commit into
mainfrom
lab-6339-beta-clippy-needless-bool

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

This PR simplifies the x86 runtime-detection fallback in ZeroKnowledgeEncryptor::detect_hardware_acceleration (src/encryption/core.rs). The code previously used an if is_x86_feature_detected!("aes") { return true; } false guard. It now returns is_x86_feature_detected!("aes") directly as the block's tail expression.

Scope and impact

  • The change touches one file and a single block.
  • No public API changes. The method's signature, visibility and return values are unchanged on every target.
  • The change is limited to the #[cfg(not(target_feature = "aes"))] path on x86. When AES is enabled at compile time, the static-detection branch is unaffected. The aarch64 branch is also unaffected.
  • There is no behavioral difference. The function reports hardware AES acceleration exactly as before.

Motivation

  • The previous form triggers clippy's needless_bool lint under the current beta toolchain (clippy 1.100).
  • CI treats warnings as errors (-D warnings), so the lint was failing the beta / ubuntu-latest job on all open PRs.
  • The rewritten expression also matches the style of the neighboring aarch64 branch.

Test coverage

  • The existing test_hardware_acceleration_matches_platform_probe test continues to assert that the reported flag equals is_x86_feature_detected!("aes") on x86. This confirms the refactor preserves the original semantics.

Summary by CodeRabbit

  • Refactor
    • Simplified how hardware AES acceleration support is detected on x86 and x86_64.

clippy 1.100 (beta) extends needless_bool to an `if c { return true; }`
guard followed by `false`, and CI's beta job runs clippy with -D warnings,
so every open PR shows a red beta check. The x86 fallback now returns
is_x86_feature_detected!("aes") as its tail expression, the same shape as
the aarch64 branch below it. Behaviour is unchanged.

Fixing it on main rather than in each PR also covers the required stable
checks once 1.100 reaches stable.
@kodus-27b

kodus-27b Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

Code Review Completed! 🔥

The code review was successfully completed based on your current configurations.

Kody Guide: Usage and Configuration
Interacting with Kody
  • Request a Review: Ask Kody to review your PR manually by adding a comment with the `@kody start-review` command at the root of your PR.

  • Provide Feedback: Help Kody learn and improve by reacting to its comments with a 👍 for helpful suggestions or a 👎 if improvements are needed.

Providing Context (Files & MCPs)

Add these hints in your PR description (or a comment) to unlock deeper checks:

  • Ticket / Acceptance Criteria: `Refs: ABC-123` (Linear/Jira/Asana/ClickUp/Trello) or a direct ticket link.
  • Bugfix Validation: a Sentry/Datadog/Bugsnag event link (or paste the stack trace/error message).
  • Endpoint Risk: mention the route (e.g., `POST /api/payments`) or controller/action name.
  • Attach a repo file as context: use an explicit marker like `@file:docs/guide.mdx#L10-L50` (replace with your real path).
  • API Contract Docs: include `@file:openapi.yaml` or `@file:swagger.json` when changing routes/schemas.
  • Definition of Done / Standards: include `@file:DOD.md` or `@file:CONTRIBUTING.md` if your repo has them.
  • Design System Source of Truth: include `@file:ui/index.ts` (replace with your DS entrypoint path).
  • Feature Flags: include the flag key/name and `@file:flags.ts` / `@file:config.json` (and optionally the PostHog flag name).
  • Edge/CDN Rules: link the Cloudflare rule/zone or describe the intended redirect/header behavior.
  • Attach an MCP tool output: use `@mcp<provider|tool>` (replace with an installed MCP provider + tool, e.g., `@mcp<sentry|events.search>`).
Current Kody Configuration
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ✅

Access your configuration settings here.

@coderabbitai

coderabbitai Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: cachekit-io/cachekit-core/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 0642b181-43eb-46e3-bd08-6b2813713736

📥 Commits

Reviewing files that changed from the base of the PR and between 0a7cc15 and dd93d2e.

📒 Files selected for processing (1)
  • src/encryption/core.rs

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.


Walkthrough

The x86 and x86_64 AES feature check now returns the runtime probe result directly instead of using an explicit conditional.

Changes

AES feature detection

Layer / File(s) Summary
Return the AES probe result
src/encryption/core.rs
The x86 and x86_64 runtime AES feature check returns the probe result directly. The explicit true and false branches are removed.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to dd93d

This preserves x86 and x86_64 AES capability reporting, with no material user impact or merge risk identified.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 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: returning the AES-NI probe directly in the encryption hardware-acceleration check.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

@27Bslash6
27Bslash6 merged commit 9bd0f80 into main Sep 29, 2026
34 checks passed
@27Bslash6
27Bslash6 deleted the lab-6339-beta-clippy-needless-bool branch September 29, 2026 12:54
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