Conversation
There was a problem hiding this comment.
Pull request overview
This PR simplifies the CEL policy script AST visitor used during script compilation/type-checking analysis, with the goal of making requirements detection more direct and covering additional AST node contents.
Changes:
- Refactors
CelPolicyScriptVisitorto remove stack-based bookkeeping and instead use direct type-map lookups. - Extends visitor traversal to include list elements and struct entry values (improving requirements analysis coverage).
- Updates/extends unit tests to validate requirements analysis for field access inside lists and structs.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| apiserver/src/main/java/org/dependencytrack/policy/cel/CelPolicyScriptVisitor.java | Simplifies AST traversal, improves requirements analysis by visiting list/struct contents, and removes debug-stack logging. |
| apiserver/src/test/java/org/dependencytrack/policy/cel/CelPolicyScriptHostTest.java | Adds tests to ensure requirements analysis detects field accesses within list literals and struct literals. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e20bd6e to
b489544
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
* Removes unnecessary Deques and use direct type map lookups instead. * Visits struct and list elements. * Removes noisy debug logging. Signed-off-by: nscuro <nscuro@protonmail.com>
b489544 to
6cf6a81
Compare
Description
Simplifies CEL script visitor.
Addressed Issue
N/A
Additional Details
N/A
Checklist
This PR fixes a defect, and I have provided tests to verify that the fix is effectiveThis PR implements an enhancement, and I have provided tests to verify that it works as intendedThis PR introduces changes to the database model, and I have updated the migration changelog accordinglyThis PR introduces new or alters existing behavior, and I have updated the documentation accordingly