refactor(encryption): collapse redundant AES cfg split in detect_hardware_acceleration (LAB-6353) - #83
Conversation
…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.
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Providing Context (Files & MCPs)Add these hints in your PR description (or a comment) to unlock deeper checks:
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
|
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 configurationConfiguration used: Repository: cachekit-io/cachekit-core/.coderabbit.yaml Review profile: ASSERTIVE Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. WalkthroughThe 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. ChangesAES feature detection
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to 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 ReviewSecurity architecture risk: 🔵 Low · up to 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 Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
This refactor simplifies the private helper
ZeroKnowledgeEncryptor::detect_hardware_accelerationinsrc/encryption/core.rs. No public API signatures change, and the reported flag stays the same on every target.Changes
#[cfg(target_feature = "aes")] return true;short-circuit is removed, along with its#[cfg(not(target_feature = "aes"))]fallback. The arm now evaluatesis_x86_feature_detected!("aes")directly.std::arch::is_aarch64_feature_detected!("aes")directly.cfg!(target_feature = "neon")check would be meaningless for AES detection.test_hardware_acceleration_matches_platform_probenow says the reported flag is exactly the platform AES probe. It no longer mentions the removed cfg short-circuit.Rationale
truewhen AES is enabled at compile time.-C target-feature=+aes -D warnings, the x86 arm never used theis_x86_feature_detectedimport, so the build failed with anunused importerror. After this change, each arm has a single expression that is used in every configuration, so no#[allow]attribute is needed.Impact
-C target-feature=+aes -D warningsnow compile.