luc-pimentel opened a new pull request, #73818:
URL: https://github.com/apache/airflow/pull/73818
A `DagParam` passed through a mapped task's `partial()`, such as
`add.partial(offset=dag.param("offset", 10)).expand(value=[1, 2, 3])`, was
serialized as its default repr, `"<airflow.sdk.definitions.param.DagParam
object at 0x...>"`. The address changes on every parse, so the serialized Dag
hash changed too and every parse created a new Dag version.
`BaseSerialization.serialize` in
`airflow-core/src/airflow/serialization/serialized_objects.py` had no case for
`DagParam` and fell back to `str(var)`. This adds a `dag_param` type, handled
like `XComArg`: the value is written from `DagParam.serialize()`, with the
default serialized recursively so `NOTSET` round-trips, and read back as
`SerializedDagParam`, a small attrs data holder with no resolve logic, since
workers resolve Dag params from their own parse of the Dag file. Template
fields are unchanged; a `DagParam` there already serializes stably. This
follows the approach reviewed on #72242.
Reproduced with the script from the issue on 3.3.1, 3.3.2 and main:
`SerializedDagModel.hash` differs between two parses of an unchanged Dag, and
the only difference is the address. With this change the hash is identical
across parses.
The new tests in
`airflow-core/tests/unit/serialization/test_dag_serialization.py` fail without
the change. `airflow-core/tests/unit/serialization/` passes (1172 passed, 1
skipped), as do `test_serialized_dag.py` and `test_mappedoperator.py`, and the
prek pre-commit and manual stages pass.
closes: #68941
---
##### Was generative AI tooling used to co-author this PR?
- [X] Yes — Claude Code (Opus 5.5)
Generated-by: Claude Code (Opus 5.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]