Skip to content

refactor(encryption): collapse redundant AES cfg split in detect_hardware_acceleration (LAB-6353) - #83

Merged
27Bslash6 merged 1 commit into
mainfrom
LAB-6353-collapse-aes-cfg-split
Sep 29, 2026
Merged

27Bslash6 merged 1 commit into
mainfrom
LAB-6353-collapse-aes-cfg-split

Conversation

@27Bslash6

@27Bslash6 27Bslash6 commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

This refactor simplifies the private helper ZeroKnowledgeEncryptor::detect_hardware_acceleration in src/encryption/core.rs. No public API signatures change, and the reported flag stays the same on every target.

Changes

  • x86 / x86_64 arm: The #[cfg(target_feature = "aes")] return true; short-circuit is removed, along with its #[cfg(not(target_feature = "aes"))] fallback. The arm now evaluates is_x86_feature_detected!("aes") directly.
  • AArch64 arm: The same compile-time/runtime split is removed. The arm now evaluates std::arch::is_aarch64_feature_detected!("aes") directly.
  • NEON comment: The existing comment is kept. It explains why a cfg!(target_feature = "neon") check would be meaningless for AES detection.
  • Other architectures: The software fallback path is unchanged.
  • Test comment: The comment on test_hardware_acceleration_matches_platform_probe now says the reported flag is exactly the platform AES probe. It no longer mentions the removed cfg short-circuit.

Rationale

  • The short-circuit was redundant. Both detection macros already resolve to a constant true when AES is enabled at compile time.
  • It broke strict builds. With -C target-feature=+aes -D warnings, the x86 arm never used the is_x86_feature_detected import, so the build failed with an unused import error. After this change, each arm has a single expression that is used in every configuration, so no #[allow] attribute is needed.

Impact

  • There is no behavioral change on any target, and no public interface changes.
  • Builds under -C target-feature=+aes -D warnings now compile.

…ware_acceleration (LAB-6353)

is_x86_feature_detected! and is_aarch64_feature_detected! already fold to a
constant true when AES is enabled at compile time, so the
#[cfg(target_feature = "aes")] short-circuit on each arm was redundant.

Removing it also makes the is_x86_feature_detected import used in every
build: under RUSTFLAGS="-C target-feature=+aes -D warnings" the import was
unused on x86/x86_64 and the build failed. The reported flag is unchanged
on every target.
@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: edfa2c32-98cc-4a2a-ac78-709c3d5fbdad

📥 Commits

Reviewing files that changed from the base of the PR and between dba66c7 and a97e2e1.

📒 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 hardware-acceleration check now uses runtime AES feature probes on x86, x86_64, and AArch64. The test comment now describes the reported flag as the platform AES probe.

Changes

AES feature detection

Layer / File(s) Summary
Runtime AES probing
src/encryption/core.rs
The detection function uses runtime AES probes on x86, x86_64, and AArch64. The hardware-acceleration test comment describes the reported flag as the platform AES probe.

Priority: ⬇️ Low

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

Change: Refactor

Merge Risk: ⚪ Minimal · up to a97e2

AES capability reporting retains its compile-time behavior and uses runtime detection otherwise, with the result still reaching metrics. No material merge-blocking risk is indicated.

Security Architecture Review

Security architecture risk: 🔵 Low · up to a97e2

The reported AES capability can change on AArch64, but the flag does not select the encryption implementation. No security regression was identified; the effect on external consumers of the public status remains unknown.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The observed change is limited to the reported capability and its existing metrics path; no change to encryption dispatch was found in the checked local consumers.

Trust Boundaries and Controls

  • observed — The changed detection method is private and called during construction; the public getter returns its stored boolean without accepting input.
🚥 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 accurately summarises the main change: removing the redundant AES configuration split in detect_hardware_acceleration. It is specific and concise.
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 2 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 60e9318 into main Sep 29, 2026
34 checks passed
@27Bslash6
27Bslash6 deleted the LAB-6353-collapse-aes-cfg-split branch September 29, 2026 17:01
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