Vamsi-klu commented on code in PR #73040:
URL: https://github.com/apache/airflow/pull/73040#discussion_r4002487225


##########
scripts/ci/prek/validate_operators_init.py:
##########
@@ -345,6 +352,55 @@ def mark(value: ast.expr | None, field: str) -> None:
     return sanctioned
 
 
+def _is_start_trigger_args_assignment(target: ast.expr, value: ast.Call) -> 
bool:
+    """
+    Check whether an assignment rebuilds ``self.start_trigger_args``.
+
+    Matches ``self.start_trigger_args = StartTriggerArgs(...)`` and
+    ``self.start_trigger_args = dataclasses.replace(self.start_trigger_args, 
...)``. Aliased
+    imports and positional ``StartTriggerArgs`` arguments are deliberately not 
matched.
+
+    :param target: The assignment target.
+    :param value: The assigned call.
+    :return: True if the assignment constructs or copies ``StartTriggerArgs``.
+    """
+    if not (isinstance(target, ast.Attribute) and _target_name(target) == 
"start_trigger_args"):
+        return False
+    name = _resolve_base_name(value.func)

Review Comment:
   _resolve_base_name returns base.attr. factory.StartTriggerArgs(...) is 
treated as the constructor. helper.replace(self.start_trigger_args, ...) is 
treated as dataclasses.replace. Line 399: helper.dict(...) is treated as 
builtin dict.
   
   Those callables can consume or transform an unrendered template value, which 
is the hole this hook exists to close. Match the precise forms: a Name 
StartTriggerArgs, dataclasses.replace / replace imported from dataclasses, 
builtin dict. Add rejection tests for the three spoofs.



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