Skip to content
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

planner: when planning a ref's extent, plan the keys as values #5257

Conversation

srenatus
Copy link
Contributor

The compiler ensures that all the keys we see there are scalars. For strings, nothing changes -- they're handled just like before -- but this now also allows numbers and booleans.

An example policy that exploded with a panic before is

package p
a[0] = true

when querying the full extent of data.p or data.p.a.

Fixes #5252.

The compiler ensures that all the keys we see there are scalars. For strings,
nothing changes -- they're handled just like before -- but this now also allows
numbers and booleans.

An example policy that exploded with a panic before is

    package p
    a[0] = true

when querying the full extent of `data.p` or `data.p.a`.

Fixes open-policy-agent#5252.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Copy link
Member

@anderseknert anderseknert left a comment

Choose a reason for hiding this comment

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

LGTM

- |
package test
p[0] = true
Copy link
Member

Choose a reason for hiding this comment

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

Not a fan of :=, are you? ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

lol I look at it like the compiler does. 😜

@srenatus srenatus merged commit 62353d0 into open-policy-agent:main Oct 17, 2022
@srenatus srenatus deleted the sr/ast+ir/full-extent-with-non-string-refs branch October 17, 2022 11:12
byronic pushed a commit to byronic/opa that referenced this pull request Oct 17, 2022
…policy-agent#5257)

The compiler ensures that all the keys we see there are scalars. For strings,
nothing changes -- they're handled just like before -- but this now also allows
numbers and booleans.

An example policy that exploded with a panic before is

    package p
    a[0] = true

when querying the full extent of `data.p` or `data.p.a`.

Fixes open-policy-agent#5252.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Signed-off-by: Byron Lagrone <byron.lagrone@seqster.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

planner: non-string ref keys break
2 participants