Skip to content

Update policy expression docs#2107

Merged
nscuro merged 1 commit intomainfrom
update-policy-expression-docs
Mar 20, 2026
Merged

Update policy expression docs#2107
nscuro merged 1 commit intomainfrom
update-policy-expression-docs

Conversation

@nscuro
Copy link
Copy Markdown
Member

@nscuro nscuro commented Mar 20, 2026

Description

Updates policy expression docs.

Addressed Issue

N/A

Additional Details

N/A

Checklist

  • I have read and understand the contributing guidelines
  • This PR fixes a defect, and I have provided tests to verify that the fix is effective
  • This PR implements an enhancement, and I have provided tests to verify that it works as intended
  • This PR introduces changes to the database model, and I have updated the migration changelog accordingly
  • This PR introduces new or alters existing behavior, and I have updated the documentation accordingly

Signed-off-by: nscuro <nscuro@protonmail.com>
@nscuro nscuro added this to the 0.7.0 milestone Mar 20, 2026
@nscuro nscuro added the documentation Improvements or additions to documentation label Mar 20, 2026
Copilot AI review requested due to automatic review settings March 20, 2026 13:40
@nscuro nscuro merged commit ce47646 into main Mar 20, 2026
5 of 7 checks passed
@nscuro nscuro deleted the update-policy-expression-docs branch March 20, 2026 13:40
@owasp-dt-bot
Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 now variable and guidance on checking optional fields with has().
  • 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})
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
component.version_distance(">=", v1.VersionDistance{major: 1})
component.version_distance(">=", v1.VersionDistance{major: "1"})

Copilot uses AI. Check for mistakes.
**Returns:** `true` if the version distance satisfies the comparison.

```js linenums="1"
component.version_distance(">=", v1.VersionDistance{major: 1})
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
component.version_distance(">=", v1.VersionDistance{major: 1})
component.version_distance(">=", v1.VersionDistance{major: "1"})

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants