jgoedeke opened a new issue, #63334:
URL: https://github.com/apache/airflow/issues/63334

   ### Apache Airflow version
   
   3.1.7
   
   ### If "Other Airflow 3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   Airflow 3 DAG versioning appears to create new DAG versions when unchanged 
DAG code includes a parse-time callable with an unstable serialized 
representation.
   
   On each parse, the lambda is a new function object.
   
   Its serialized representation is unstable across parses, so unchanged DAG 
code produces different serialized DAG content and new DAG versions are created.
   
   ### What you think should happen instead?
   
   Unchanged DAG code should not continuously create new DAG versions, if the 
semantics have not changed.
   
   ### How to reproduce
   
   Use this minimal example:
   
   ```python
   from airflow.sdk import dag, task
   
   @task
   def consume(values: list[int], sort_key=None) -> list[int]:
       return sorted(values, key=sort_key)
   
   @dag(schedule=None)
   def unstable_dag():
       consume(values=[3, 1, 2], sort_key=lambda x: x)
   
   unstable_dag()
   ```
   
   Repeated parses of this code will result in new DAG versions, even though 
nothing was changed.
   
   ### Operating System
   
   Dockerfile
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Docker-Compose
   
   ### Deployment details
   
   _No response_
   
   ### Anything else?
   
   Problem occurred every time with this pattern. Related discussion: 
https://github.com/apache/airflow/discussions/54348
   
   ### Are you willing to submit PR?
   
   - [ ] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
   


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