kaxil commented on code in PR #75229:
URL: https://github.com/apache/airflow/pull/75229#discussion_r4336829330
##########
airflow-core/src/airflow/plugins_manager.py:
##########
@@ -351,7 +352,35 @@ def _is_applies_to_path_known_elsewhere(path: str) -> bool:
return any(_describe_applies_to_path_error(path, root) is None for root in
_applies_to_root_models())
-def _validate_applies_to(plugin_name: str | None, view: ExternalViewDict |
ReactAppDict, kind: str) -> bool:
+_ACTION_TYPES = frozenset({"link", "react"})
+_ACTION_DESTINATIONS = frozenset({"dag", "dag_run", "task_instance"})
+# The field each action kind cannot render without.
+_ACTION_REQUIRED_TARGET = {"link": "href", "react": "bundle_url"}
+
+
+def _describe_ui_action_error(action: Any) -> str | None:
Review Comment:
This only checks four fields, but `BasePluginActionResponse` has
`extra="forbid"` and types `icon` as `str | None`. An action with a key the
model doesn't know, say a `url_route` copied over from a `react_apps` entry,
gets through here and then fails `PluginResponse.model_validate` in
`routes/public/plugins.py`. That skips the whole plugin, including its views
and React apps, and the docstring above says that shouldn't happen.
Separately, `"destination": ["dag", "dag_run"]` raises `TypeError:
unhashable` at the `not in` below. That's inside `_get_ui_plugins`, so `GET
/plugins` returns 500 for every plugin. Could each action go through
`TypeAdapter(PluginActionResponse)` here instead of the hand-written checks?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]