Skip to content

Avoid reserializing the whole bundle in DAG.test - #72658

Closed
deepujain wants to merge 4 commits into
apache:mainfrom
deepujain:fix-72513-dag-test-serialization
Closed

deepujain wants to merge 4 commits into
apache:mainfrom
deepujain:fix-72513-dag-test-serialization

Conversation

@deepujain

@deepujain deepujain commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Running DAG.test() for one Dag can parse and reserialize unrelated Dags in the same bundle, adding work each time a developer tests or debugs a Dag. This change limits parsing to the owning source file when the stored file location points to a regular file inside that bundle.

For a bundle containing orders.py and reports.py, testing a Dag in orders.py previously parsed the whole bundle. It now parses orders.py, including sibling Dags defined in that file so same-file TriggerDagRunOperator targets remain available. Packaged or unavailable source files still use the complete bundle.

Validation:

  • The regression asserts that DAG.test() passes the parent source file to BundleDagBag rather than the whole bundle.
  • Earlier validation recorded in this PR: 10 focused Dag.test tests passed in Breeze, with Ruff lint and formatting checks and git diff --check passing.
  • Hosted checks on head 5fc4379d3076b6bcf0b971a9a8491c6656631474: 68 successful, 38 skipped, and CodeQL neutral; no failed or pending checks.
  • This maintenance pass did not rerun local tests or reproduce the reported VSCode debugging session. The added assertion covers the regular-file path; it does not independently test every packaged-file fallback.

Fixes #72513


Was generative AI tooling used to co-author this PR?
  • Yes (OpenAI Codex (GPT-6))

Generated-by: OpenAI Codex (GPT-6) following the guidelines


  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@deepujain
deepujain marked this pull request as ready for review September 9, 2026 03:53
@deepujain
deepujain force-pushed the fix-72513-dag-test-serialization branch 5 times, most recently from 3bd2d31 to 5125104 Compare September 17, 2026 22:39
@deepujain

Copy link
Copy Markdown
Contributor Author

The lowest-deps CI failure (test_form_parser_error_keeps_its_own_detail, 422 vs 400) traces to the starlette floor on this branch. With starlette>=1.0.1, the urlencoded form parser does not bound the field count, so the 2000-field test body parses cleanly and then fails pydantic validation (422) instead of raising starlette's own 400. Upstream addressed this in #73302 by raising the floor to starlette>=1.3.1, whose FormParser enforces max_fields and reports a 400.

I have cherry-picked #73302 onto this branch so the lowest-deps job resolves the bounded parser. No changes to the PR's own code; CI should go green on the rerun.


Drafted-by: Muse Spark (Meta) (no human review before posting)

@deepujain
deepujain force-pushed the fix-72513-dag-test-serialization branch from 5fba820 to ddc6b2b Compare September 22, 2026 16:16
@deepujain

deepujain commented Sep 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated this branch to current main and retained the source-file parsing change and its bundle fallback. The focused Dag.test tests pass in Breeze, and Ruff checks pass. The PR body now includes the explicit Gen-AI disclosure; hosted CI is running again.

@deepujain
deepujain force-pushed the fix-72513-dag-test-serialization branch from ddc6b2b to 5fc4379 Compare September 23, 2026 04:46
@deepujain

deepujain commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated the source-file parsing fix to main at b6538c3. The 10 focused Dag.test tests pass in Breeze; Ruff lint and formatting checks also pass. Fresh hosted CI is starting on the updated head.

@deepujain deepujain changed the title Avoid reserializing the whole bundle in DAG.test (#72513) Avoid reserializing the whole bundle in DAG.test Oct 5, 2026
@deepujain

Copy link
Copy Markdown
Contributor Author

@ashb @kaxil @amoghrajesh Checks are green on the latest commit. Could you review this when you have a chance?

@deepujain

Copy link
Copy Markdown
Contributor Author

Thanks for maintaining this project. I've kept this PR rebased and up to date, but it hasn't found a reviewer yet, so I'm closing it to keep your queue tidy. Happy to reopen and rebase anytime if it's still useful.

Effort: open since Sep 7, 2026, 4 updates posted, 4 commits, +20 −7 across 2 files, checks green on the latest commit, fixes #72513.

@deepujain deepujain closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

All DAGs are being reserialised during each run of dag.test()

1 participant