-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix: correct flow operator detection in _module.py (closes #2280) #3162
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,11 +12,16 @@ | |
|
|
||
|
|
||
| def _is_flow_operator(cls): | ||
| return ( | ||
| issubclass(cls, BaseOperator) | ||
| and hasattr(cls, "metadata") | ||
| and isinstance(cls.metadata, ViewMetadata) | ||
| ) | ||
| try: | ||
| metadata = getattr(cls, "metadata", None) | ||
| if metadata is None: | ||
| return False | ||
| # For class-level properties or descriptors, get the actual metadata object | ||
| if callable(metadata): | ||
| metadata = metadata() | ||
| return issubclass(cls, BaseOperator) and isinstance(metadata, ViewMetadata) | ||
|
Comment on lines
+20
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Reuse the resolved metadata downstream. For callable |
||
| except Exception: | ||
| return False | ||
|
Comment on lines
+15
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win Add regression tests for metadata resolution. Cover normal As per path instructions, “公共行为变更必须提供邻近的回归测试,并覆盖相关的正常、错误、空输入、并发、取消或流式场景。” 🧰 Tools🪛 Ruff (0.15.21)[warning] 23-23: Do not catch blind exception: (BLE001) Source: Path instructions |
||
|
|
||
|
|
||
| def _is_flow_resource(cls): | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
Check
BaseOperatorbefore invoking metadata._scan_awel_flowusesbase_class=object, so this predicate runs for every discovered class. Lines [20]-[21] invoke any callablemetadatabefore confirming thatclsis aBaseOperator; an unrelated class with a no-argumentmetadatamethod can therefore execute during startup. Move the subclass check ahead of metadata resolution.