-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
Allow deleting rules in plugins to override behavior #21318
base: main
Are you sure you want to change the base?
Conversation
Thanks for starting this conversation. From a quick read, I wonder if this won't interact well with our future-state of call-by-name (e.g. #21065). That is, where a backend calls the underlying rule as a function, rather than using the solver to magically choose it. One way to explore this might be adding an extra layer of rules to the integration test: @dataclass(frozen=True)
class WrapperUsingCallByNameRequest:
pass
@rule
def wrapper_using_call_by_name(request: WrapperUsingCallByNameRequest) -> int:
return await original_rule(IntRequest()) And then call that in the test instead. (If we go forward with this, I think it'd be good to have the integration test use a wrapper like this anyway, to validate that we're swapping out rule calls even within other rules, not just at the top level, since that's the purpose of this feature.) If that doesn't work there's a chance that using patching, e.g. Can you experiment? |
We've just branched for 2.23, so merging this pull request now will come out in 2.24, please move the release notes updates to |
687853c
to
97405ff
Compare
(In case it's not clear, please let us know when this is ready for re-review with a comment. 😄 ) |
Yeah, thanks, it's not working yet |
Sometimes you might want to change the behavior of some existing backend in a way that is not supported by the backend.
DeleteRule
allows you to remove a single rule from the backend, then you can implement your own version of the same rule.For example, you might want to change the behavior of the
list
goal, here is how you do it: