refactor(policy): extract shared L7 endpoint validation - #3
refactor(policy): extract shared L7 endpoint validation#3gracesmith6504 wants to merge 1 commit into
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
📝 WalkthroughWalkthroughAdds shared L7 endpoint semantic validation for protocol, access, rules, and deny-rules constraints. Provider profile linting and runtime policy validation now use the shared validator, with expanded tests and updated endpoint fixtures. ChangesL7 Endpoint Validation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant ProfileLint
participant SharedL7Validator
participant RuntimePolicyValidator
participant Diagnostics
ProfileLint->>SharedL7Validator: validate endpoint fields
SharedL7Validator-->>ProfileLint: return semantic errors
ProfileLint->>Diagnostics: emit endpoint diagnostics
RuntimePolicyValidator->>SharedL7Validator: validate endpoint fields
SharedL7Validator-->>RuntimePolicyValidator: return semantic errors
Possibly related PRs
Suggested reviewers: ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Move 9 L7 endpoint semantic checks into a shared validate_l7_endpoint_semantics() function in openshell-policy. Both profile lint (openshell-providers) and the runtime validator (openshell-supervisor-network) now call the shared function via a lightweight L7EndpointFields field bag, eliminating duplication and preventing the two implementations from drifting apart. Update server test fixtures that used protocol without rules or access, which the shared validator now correctly rejects. Fixes NVIDIA#1714 Signed-off-by: Grace Smith <grasmith@redhat.com>
333e0c8 to
d9510ee
Compare
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai full review |
✅ Action performedFull review finished. |
✅ Action performedFull review finished. |
Summary
validate_l7_endpoint_semantics()function inopenshell-policyopenshell-providers) and the runtime validator (openshell-supervisor-network) now call the shared function via a lightweightL7EndpointFieldsfield bag, eliminating duplicationprotocolwithoutrulesoraccess, which the shared validator now correctly rejectsRelated Issue
Fixes NVIDIA#1714
Changes
crates/openshell-policy/src/l7_validate.rsL7Protocolenum,L7EndpointFieldsstruct,validate_l7_endpoint_semantics()function, and 14 unit testscrates/openshell-policy/src/lib.rscrates/openshell-providers/Cargo.tomlopenshell-policydependencycrates/openshell-providers/src/profiles.rscrates/openshell-supervisor-network/src/l7/mod.rscrates/openshell-server/src/grpc/policy.rsaccess: "full"to endpoint with protocolcrates/openshell-server/src/grpc/provider.rsaccess: "full"to endpoints with protocolTesting
mise run cipasses (full lint + clippy + tests)Checklist
Summary by CodeRabbit
New Features
Bug Fixes
Tests