Conversation
Signed-off-by: nscuro <nscuro@protonmail.com>
✅ 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.
Pull request overview
Updates the policy expression documentation to reflect a richer evaluation context and provide a more detailed function reference for CEL-based policy conditions.
Changes:
- Expanded “Evaluation Context” with a
nowvariable and guidance on checking optional fields withhas(). - Reworked examples and moved function details into a new “Function Reference” section (including dependency graph functions and
matches_range). - Updated type links to point at the generated policy schema reference.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| The following expression matches components that are more than one major version behind: | ||
|
|
||
| ```js linenums="1" | ||
| component.version_distance(">=", v1.VersionDistance{major: 1}) |
There was a problem hiding this comment.
VersionDistance fields are defined as strings in the policy schema (epoch/major/minor/patch). Using v1.VersionDistance{major: 1} will fail type-checking; use a string value (e.g. major: "1") and adjust any other numeric literals accordingly.
| component.version_distance(">=", v1.VersionDistance{major: 1}) | |
| component.version_distance(">=", v1.VersionDistance{major: "1"}) |
| **Returns:** `true` if the version distance satisfies the comparison. | ||
|
|
||
| ```js linenums="1" | ||
| component.version_distance(">=", v1.VersionDistance{major: 1}) |
There was a problem hiding this comment.
The example uses v1.VersionDistance{major: 1}, but the schema defines VersionDistance.major as a string. This example should use a string literal (e.g. major: "1") to avoid misleading users with a non-type-checking expression.
| component.version_distance(">=", v1.VersionDistance{major: 1}) | |
| component.version_distance(">=", v1.VersionDistance{major: "1"}) |
Description
Updates policy expression docs.
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