Sdnsoumy commented on code in PR #70859:
URL: https://github.com/apache/airflow/pull/70859#discussion_r3692279781


##########
providers/google/src/airflow/providers/google/cloud/sensors/cloud_composer.py:
##########
@@ -632,6 +595,42 @@ def _handle_skipped_states(self, skipped_status: bool) -> 
None:
             )
 
     def execute(self, context: Context) -> None:
+        # Validate and normalize the target only after its template fields 
have been rendered.
+        if self.composer_external_task_id is not None and 
self.composer_external_task_ids is not None:
+            raise ValueError(
+                "Only one of `composer_external_task_id` or 
`composer_external_task_ids` may "
+                "be provided to CloudComposerExternalTaskSensor; "
+                "use `composer_external_task_id` or 
`composer_external_task_ids` or `composer_external_task_group_id`."
+            )
+        if self.composer_external_task_group_id is not None and (
+            self.composer_external_task_id is not None or 
self.composer_external_task_ids is not None
+        ):
+            raise ValueError(
+                "Only one of `composer_external_task_group_id` or 
`composer_external_task_ids` may "
+                "be provided to CloudComposerExternalTaskSensor; "
+                "use `composer_external_task_id` or 
`composer_external_task_ids` or `composer_external_task_group_id`."
+            )
+
+        if not self.composer_external_task_ids:
+            self.composer_external_task_ids = None
+        if self.composer_external_task_id is not None:
+            self.composer_external_task_ids = [self.composer_external_task_id]

Review Comment:
   Good catch — thanks. Moved the empty-list → `None` normalization of 
`composer_external_task_ids` **before** the mutual-exclusivity checks so that 
passing `composer_external_task_ids=[]` together with 
`composer_external_task_group_id` (or `composer_external_task_id`) no longer 
raises. This matches the original `__init__` ordering. Also added a regression 
test (`test_empty_task_ids_list_normalizes_before_exclusivity_check`) for the 
empty-list case. Fixed in 327bde7c8c.



-- 
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]

Reply via email to