namanjain24-sudo opened a new pull request, #75431:
URL: https://github.com/apache/airflow/pull/75431

   A `TriggerDagRunOperator` or `ExternalTaskSensor` inside an expanded task 
group takes its dag id from the
   group, so at serialization time the value is a `MappedArgument` that only 
resolves once the task expands.
   
   `_DependencyDetector.detect_task_dependencies` recorded a `DagDependency` 
for it anyway. That names an edge
   the static dependency graph cannot hold, and `MappedArgument` is unhashable, 
so `detect_dependencies` broke
   when it collected the results into a set and serializing the dag failed 
outright rather than leaving the
   dependency out:
   
   ```
   airflow.exceptions.SerializationError: Failed to serialize DAG 'x': 
unhashable type: 'MappedArgument'
   ```
   
   The dag now serializes and simply carries no dependency for a target that is 
not statically known. All four
   branches are covered: `TriggerDagRunOperator` and `ExternalTaskSensor`, each 
taken directly and through
   `partial_kwargs`. `ExternalTaskSensor` had the same flaw on 
`external_dag_id`, reachable the same way.
   
   closes: #75172
   
   ### Testing
   
   - Both new tests fail without the change, with the `unhashable type: 
'MappedArgument'` serialization error
     from the report, and pass with it.
   - `airflow-core/tests/unit/serialization/test_dag_serialization.py` — 258 
passed.
   - `test_dag_version_diff.py`, `test_serialized_dag.py` and 
`test_dot_renderer.py`, which also cover
     `dag_dependencies` — 666 passed.
   - `breeze run mypy 
airflow-core/src/airflow/serialization/serialized_objects.py` — clean.
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes (please specify the tool below)
   
   Generated-by: Claude Code (Opus 5) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   


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