This is an automated email from the ASF dual-hosted git repository.
guan404ming pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new ffde96203e7 Reject unsupported require_approval in LLM branch and
schema compare operators (#70069)
ffde96203e7 is described below
commit ffde96203e76c0c27ccf1ae6eeaad270653248bf
Author: Guan-Ming Chiu <[email protected]>
AuthorDate: Sat Jul 18 20:04:04 2026 +0900
Reject unsupported require_approval in LLM branch and schema compare
operators (#70069)
---
.../ai/src/airflow/providers/common/ai/operators/llm_branch.py | 2 ++
.../airflow/providers/common/ai/operators/llm_schema_compare.py | 2 ++
.../common/ai/tests/unit/common/ai/operators/test_llm_branch.py | 9 +++++++++
.../ai/tests/unit/common/ai/operators/test_llm_schema_compare.py | 5 +++++
4 files changed, 18 insertions(+)
diff --git
a/providers/common/ai/src/airflow/providers/common/ai/operators/llm_branch.py
b/providers/common/ai/src/airflow/providers/common/ai/operators/llm_branch.py
index 0395040852f..b6a25a7811e 100644
---
a/providers/common/ai/src/airflow/providers/common/ai/operators/llm_branch.py
+++
b/providers/common/ai/src/airflow/providers/common/ai/operators/llm_branch.py
@@ -60,6 +60,8 @@ class LLMBranchOperator(LLMOperator, BranchMixIn):
**kwargs: Any,
) -> None:
kwargs.pop("output_type", None)
+ if kwargs.get("require_approval"):
+ raise ValueError("require_approval=True is not supported by
LLMBranchOperator.")
super().__init__(**kwargs)
self.allow_multiple_branches = allow_multiple_branches
diff --git
a/providers/common/ai/src/airflow/providers/common/ai/operators/llm_schema_compare.py
b/providers/common/ai/src/airflow/providers/common/ai/operators/llm_schema_compare.py
index b51ea7c1f7c..d65ca521876 100644
---
a/providers/common/ai/src/airflow/providers/common/ai/operators/llm_schema_compare.py
+++
b/providers/common/ai/src/airflow/providers/common/ai/operators/llm_schema_compare.py
@@ -127,6 +127,8 @@ class LLMSchemaCompareOperator(LLMOperator):
**kwargs: Any,
) -> None:
kwargs.pop("output_type", None)
+ if kwargs.get("require_approval"):
+ raise ValueError("require_approval=True is not supported by
LLMSchemaCompareOperator.")
super().__init__(**kwargs)
self.data_sources = data_sources or []
self.db_conn_ids = db_conn_ids or []
diff --git
a/providers/common/ai/tests/unit/common/ai/operators/test_llm_branch.py
b/providers/common/ai/tests/unit/common/ai/operators/test_llm_branch.py
index 390137e9fc9..fccf5e2f837 100644
--- a/providers/common/ai/tests/unit/common/ai/operators/test_llm_branch.py
+++ b/providers/common/ai/tests/unit/common/ai/operators/test_llm_branch.py
@@ -54,6 +54,15 @@ class TestLLMBranchOperator:
# the real output_type is built dynamically from downstream_task_ids
assert op.output_type is str
+ def test_require_approval_rejected(self):
+ with pytest.raises(ValueError, match="require_approval=True is not
supported"):
+ LLMBranchOperator(
+ task_id="test",
+ prompt="pick a branch",
+ llm_conn_id="my_llm",
+ require_approval=True,
+ )
+
@patch.object(LLMBranchOperator, "do_branch")
@patch("airflow.providers.common.ai.operators.llm.PydanticAIHook",
autospec=True)
def test_execute_single_branch(self, mock_hook_cls, mock_do_branch):
diff --git
a/providers/common/ai/tests/unit/common/ai/operators/test_llm_schema_compare.py
b/providers/common/ai/tests/unit/common/ai/operators/test_llm_schema_compare.py
index c7a23de5838..01fee1950d1 100644
---
a/providers/common/ai/tests/unit/common/ai/operators/test_llm_schema_compare.py
+++
b/providers/common/ai/tests/unit/common/ai/operators/test_llm_schema_compare.py
@@ -97,6 +97,11 @@ class TestLLMSchemaCompareOperator:
"at-least two combinations",
id="one_datasource_only",
),
+ pytest.param(
+ {"require_approval": True},
+ "require_approval=True is not supported",
+ id="require_approval",
+ ),
],
)
def test_init_validation(self, kwargs, expected_error):