planner: address ref head issue, don't optimize where it's incorrect #7439
+72
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When planning rules like these:
we ended up with a broken CallDynamic statement. Since the first ref rule is planned as
g0.data.authz.allow
and builds an object return value, and the second rule is planned asg0.data.authz.allow.eat.veggies
with a boolean return value, we cannot dynamically dispatch their calls.With this change, the previously exising "unbalanced ruletrie" check now also hits before reaching the end of the ref. It'll catch this situation and avoid optimizing the dispatch. We'll end up with a longer, less efficient, but correct plan.
plans before and after
BEFORE:
Note: Only two funcs are planned: "g0.data.authz.p.unrelated.eat.veggies" and "g0.data.authz.resp", the "data.authz.allow[..]" rule is missing
AFTER:
Note: