perf(jans-cedarling): reduce clones through Arc sharing#14173
Conversation
Signed-off-by: dagregi <dagmawi.m@proton.me>
📝 WalkthroughWalkthroughThis PR optimizes the Cedar authorization and entity-building pipeline by restructuring data ownership patterns: default entities move to Arc-wrapped storage, pushed-data transfers ownership rather than being borrowed, and entity builders use stack-allocated arrays and slices for fixed-arity inputs. ChangesAllocation Optimizations
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
jans-cedarling/cedarling/src/common/default_entities_limits.rs (1)
1-1:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd the required Apache 2.0 file header.
This Rust file is missing the required Apache 2.0 license header with copyright notice.
As per coding guidelines: "Each Rust file must contain the Apache 2.0 license header with copyright notice".Suggested fix
+// This software is available under the Apache-2.0 license. +// See https://www.apache.org/licenses/LICENSE-2.0.txt for full text. +// +// Copyright (c) 2024, Gluu, Inc. + use cedar_policy::entities_errors::EntitiesError;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@jans-cedarling/cedarling/src/common/default_entities_limits.rs` at line 1, Add the required Apache 2.0 license header and copyright notice to the top of the file that currently contains the line "use cedar_policy::entities_errors::EntitiesError;"; insert the standard Apache 2.0 file header (including copyright holder and license text/URL) as the very first lines of cedarling/src/common/default_entities_limits.rs so the header precedes the existing use statement and any code.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@jans-cedarling/cedarling/src/common/default_entities_limits.rs`:
- Line 1: Add the required Apache 2.0 license header and copyright notice to the
top of the file that currently contains the line "use
cedar_policy::entities_errors::EntitiesError;"; insert the standard Apache 2.0
file header (including copyright holder and license text/URL) as the very first
lines of cedarling/src/common/default_entities_limits.rs so the header precedes
the existing use statement and any code.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 56ed7df6-7616-46a3-bc98-934c79d380da
📒 Files selected for processing (7)
jans-cedarling/cedarling/src/authz/build_ctx.rsjans-cedarling/cedarling/src/authz/mod.rsjans-cedarling/cedarling/src/common/default_entities.rsjans-cedarling/cedarling/src/common/default_entities_limits.rsjans-cedarling/cedarling/src/entity_builder/build_multi_issuer_entity.rsjans-cedarling/cedarling/src/entity_builder/build_principal_entity.rsjans-cedarling/cedarling/src/entity_builder/build_principal_entity/unsigned.rs
Prepare
Description
Target issue
closes #14030
Implementation Details
I avoided adding
ryu::Buffer,SmallVec, andphfsince benchmarks showed no measurable difference so pulling in new dependencies wasn't warranted.Test and Document the changes
Please check the below before submitting your PR. The PR will not be merged if there are no commits that start with
docs:to indicate documentation changes or if the below checklist is not selected.Summary by CodeRabbit