-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AST: rules with variables in ref missing attached annotations #7050
Labels
Comments
The metadata is available to the rule at runtime, so this is likely a serialization issue. package play
import rego.v1
# METADATA
# description: bug
bug[x] if x := rego.metadata.rule() ->
|
Available "to" the rule, but not available on the rule :) |
anderseknert
added a commit
to anderseknert/opa
that referenced
this issue
Sep 23, 2024
Previously, annotations were missing on rules that had variable components in the ref head. Now we annotate the rule using the path up to the first var. Fixes open-policy-agent#7050 Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
changed the title
Rules with variables in ref missing attached annotations
AST: rules with variables in ref missing attached annotations
Sep 23, 2024
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 23, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 23, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 23, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 23, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 23, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 23, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. - Add pprof option to language-server command, and pprof handlers to web server Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 24, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. - Add pprof option to language-server command, and pprof handlers to web server Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert
added a commit
to StyraInc/regal
that referenced
this issue
Sep 24, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. - Add pprof option to language-server command, and pprof handlers to web server Signed-off-by: Anders Eknert <anders@styra.com>
srenatus
pushed a commit
to srenatus/regal
that referenced
this issue
Oct 1, 2024
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. - Add pprof option to language-server command, and pprof handlers to web server Signed-off-by: Anders Eknert <anders@styra.com>
charlieegan3
pushed a commit
to charlieegan3/regal
that referenced
this issue
Jan 6, 2025
This rule is not for everyone, and hence in the `custom` category. For a public projects, libraries and reusable policies, this should however be considered. This uncovered a [bug in OPA](open-policy-agent/opa#7050), which has now been addressed. In order to make progress on this we're now depending on OPA `main`. This should be changed as soon as OPA v0.69.0 is released. Some unrelated fixes in this PR, fixing annoyances as I worked on it: - add Regal specific attributes (`input.regal.*`) to the input created by the `eval:use-as-input` directive - Add another metadata snippet to allow creating a `# METADATA` block with only description and no title. Tbh, I'm still not sure what to use `title` for, while `description` is pretty much mandatory. - Set `ignore-if-sub-attribute: true` on default config for `prefer-some-in-iteration` rule. This was documented to be the case already, but seemed to have gone missing at some point. - Add pprof option to language-server command, and pprof handlers to web server Signed-off-by: Anders Eknert <anders@styra.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Since a few releases back, rule-level annotations are now attached to the rules they annotate in the AST. However, this doesn't seem to be the case for any rule where a variable component is in the rule ref.
Given a rule like this:
The annotation can be found under
annotations
:But not under the rule:
The text was updated successfully, but these errors were encountered: