kadubhumika opened a new pull request, #74051: URL: https://github.com/apache/airflow/pull/74051
<!-- Thank you for contributing! Please provide above a brief description of the changes made in this pull request. Write a good git commit message following this guide: https://chris.beams.io/posts/git-commit/ --> ### What was the problem? When the Airflow DAG Processor runs stability analysis to check for version inflation, it treats every file path as a single source unit. When a zipped DAG bundle (`.zip`) is passed, the stability checker reads the raw binary zip data directly and tries to parse it using `ast.parse()`. This causes an unhandled parsing exception which is caught silently by a broad exception block, completely skipping stability and runtime-varying value validation for all workflows packaged inside the archive wrapper. ### Why are these changes needed? Zipped DAG deployments should not bypass code stability analysis. The checker needs to actively look inside the archive files to find, parse, and analyze actual workflow definitions so it can surface warnings for dynamic constructs (like `datetime.now()`) that trigger unexpected DAG version inflation across parses. ### How were the changes implemented? * **Added Zip Processing Logic:** Updated `check_dag_file_stability` to detect if the target file path is a zip archive using `zipfile.is_zipfile()`. * **Integrated Native Heuristic Filtering:** Opened the archive and looped through internal files using Airflow's built-in `might_contain_dag()` helper to safely discard non-script asset artifacts. * **Isolated AST Evaluation:** Spun up a brand-new `AirflowRuntimeVaryingValueChecker` instance space for every separate python script inside the archive block to prevent state pollution. * **Protected Variable Collision Maps:** Implemented a `setdefault()` mapping merge loop when collecting dynamic keys. This guarantees that if multiple different internal scripts declare the exact same variable token name (e.g., `current_time`), all warning messages are preserved up to the final output text summary block without dropping structural entries or polluting user-facing diagnostics with archive path prefix names. * **Added Comprehensive Tests:** Added an explicit twin-file variable collision verification test case inside `test_dag_version_inflation_checker.py`. It confirms that both warnings are retained while variable keys merge cleanly. * **Validated Module Health:** The changes successfully pass the entire test validation footprint, with all 67 test conditions green. closes: #73739 --- ##### Was generative AI tooling used to co-author this PR? - [X] Yes (please specify the tool below) Generated-by: Gemini following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions) <img width="700" height="700" alt="Screenshot (1294)" src="https://github.com/user-attachments/assets/f90b6da9-c81b-4353-b01d-dfa10c20006e" /> -- 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]
