Decouple DecoratorManager from eval.py TRIGGER_KWARGS allowlist - #870
Decouple DecoratorManager from eval.py TRIGGER_KWARGS allowlist#870dmamelin wants to merge 4 commits into
Conversation
|
I have a few spare tokens, and there can be no such thing as an unneeded review, so here's what Opus said: Reviewed at The change itself reads correctly, and the motivation is sound: a signature check generalizes to arbitrary argument names, and a fixed name list does not. Five points below, roughly in order of value. 1. The documentation now contradicts the code
This PR removes that exception, but the file is unchanged. A user who reads the reference will still expect an error that no longer happens. This is the cheapest item to fix and the one most likely to confuse people. 2. The decoupling is partial:
|
|
For context: this PR is one step in migrating off the legacy Thanks for the thorough review — pushed 3 commits addressing this. 1. Docs mismatch — fixed in 8e28116: 2. 3. Positional-only params — good catch, and confirmed not a regression: before this PR, Fixed in 4. Missing test coverage — added in e874fb9 / af9e27e:
5. Caching/duplication — Also, Minor: "fixed set" wording — fixed, the comment no longer implies the kwarg set is static (it varies per trigger/service type, including arbitrary event/service data fields). Stricter validation for |
Motivation
DecoratorManager's function calls relied on
eval.py's globalTRIGGER_KWARGSallowlist to decide which unconsumed dispatch kwargs to silently ignore — a fixed, decorator-agnostic list that doesn't generalize to decorators with arbitrary argument names. This is a prerequisite for #869, which needs exactly that and was blocked by this dependency. Removing the legacytrigger.pysubsystem entirely (andTRIGGER_KWARGSwith it) is planned as a separate follow-up PR.Behavior change
Previously, extra
kwargspassed via@state_trigger(..., kwargs=...)(and other trigger decorators) had to match a parameter in the decorated function's signature, or the call raisedTypeError. Now this isn't checked — the function simply receives whichever parameters it declares, and everything else is silently ignored, same as built-in trigger context kwargs (value,context, etc.) already behaved.