-
Notifications
You must be signed in to change notification settings - Fork 180
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
Constantly running into "unhandled partial" error #1705
Comments
Hey @IohannesArnold. Apologies for the slow response here, and for the issues you've encountered.
It's kind of a bit of both. It's currently a pretty big limitation/sharp edge of Polar that we'd like to remove. You're right that Polar is looking for an existential assertion, and currently the problem is the rule: has_relation(parent: Group, "managing_group", child: Group) if
child.managed_by.id = parent.id; Which creates a partially-constrained variable Which then goes through to the To address it, you would need to write the rule as: has_relation(parent: Group, "managing_group", child: Group) if
child.managed_by = parent; which should work fine. We'd like to improve this in future versions |
I'm running into the same issue, and the above solution by @samscott89 only works if both However, if one of the two dictionaries has a single property with a different value (let's say a metadata field with a timestamp, or anything else outside of the primary key), the two dictionaries won't be considered equal, and the assertion will fail. This behaviour seems a bit limiting, considering there are many cases where you might have slightly different dictionaries (maybe one of them is a partial copy of the other, maybe it's been slightly altered before an update operation). Also, in most cases, you might not have a Isn't there a more foolproof way of explaining to Polar how it's supposed to consider that two dictionaries are equal? |
This might be a bug in the oso library or it might be a problem with the way I am writing authorization rules, but if the latter then I claim that this is because the examples in the oso docs are misleading and have led me to this bad habit. I am constantly running into "unhandled partial" errors that are not the result of the body of a rule but the way multiple rules interact. Here's an minimal example:
I have problems with the following test:
This yields the following error:
It took me a while to get a sense of why oso is doing this, but I've realized it has to do with the fact that in the
has_relation
rule, the first (left-most) term is a free variable, not a bound one. So it resolves out to a query result which I think should be fully determinate, but oso expects me to have provided, somewhere, an existential assertion ("There is a group such that...") which I have not (and don't know where I would).Is this a bug in oso or my failure to write a proper ruleset? If the latter, I think that the documentation could be clearer, but to prevent this issue from getting too long, I'll not include my argument now.
The text was updated successfully, but these errors were encountered: