fix: make disable_plugins accept Plugin types instead of strings#6155
fix: make disable_plugins accept Plugin types instead of strings#6155
Conversation
Change `disable_plugins` from `list[str]` to `list[type[Plugin]]` so both `plugins` and `disable_plugins` use consistent Plugin-based types (#6150). Strings and instances are still accepted at runtime with a deprecation warning, and normalized to the Plugin class. Environment variable support via REFLEX_DISABLE_PLUGINS continues to work through a new `interpret_plugin_class_env` interpreter, which `interpret_plugin_env` now reuses for class resolution. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR migrates Key changes:
One minor issue found: an inline comment in the normalization logic incorrectly describes the conversion direction. Confidence Score: 4/5
Last reviewed commit: e1373b6 |
| for key, env_value in env_kwargs.items(): | ||
| setattr(self, key, env_value) | ||
|
|
||
| # Normalize disable_plugins: convert strings and Plugin subclasses to instances. |
There was a problem hiding this comment.
The comment says "convert strings and Plugin subclasses to instances", but the actual logic does the opposite: it converts Plugin instances (and strings) to Plugin classes. The word "subclasses" and "instances" are swapped.
| # Normalize disable_plugins: convert strings and Plugin subclasses to instances. | |
| # Normalize disable_plugins: convert strings and Plugin instances to Plugin subclasses. |
Change
disable_pluginsfromlist[str]tolist[type[Plugin]]so bothpluginsanddisable_pluginsuse consistent Plugin-based types (#6150).Strings and instances are still accepted at runtime with a deprecation warning, and normalized to the Plugin class. Environment variable support via REFLEX_DISABLE_PLUGINS continues to work through a new
interpret_plugin_class_envinterpreter, whichinterpret_plugin_envnow reuses for class resolution.Fix #6150