Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes dag_id and run_id from the Execution API DagRun schema and propagates that change through the Task SDK (generated models, runtime context building, and comms helpers), updating unit tests accordingly.
Changes:
- Drop
dag_id/run_idfromDagRunmodels in bothairflow-coreExecution API and Task SDK generated datamodels. - Update runtime/task context construction and asset-event source task instance handling to use identifiers from the task instance (or to carry them separately).
- Adjust server- and SDK-side tests to align with the new
DagRunshape; register a Cadwyn version change for2026-03-31.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| task-sdk/tests/task_sdk/execution_time/test_task_runner.py | Updates previous-dagrun assertions to match new DagRun shape. |
| task-sdk/tests/task_sdk/execution_time/test_supervisor.py | Updates expected serialized bodies for dag-run responses without identifiers. |
| task-sdk/tests/task_sdk/execution_time/test_sentry.py | Stops constructing DagRun with dag_id/run_id; sources identifiers from constants. |
| task-sdk/tests/task_sdk/execution_time/test_context.py | Updates AssetEventSourceTaskInstance expectations to pass dag_id/run_id explicitly. |
| task-sdk/tests/task_sdk/execution_time/test_comms.py | Updates startup-details payload fixture to omit dag-run identifiers. |
| task-sdk/tests/task_sdk/api/test_client.py | Updates client tests for previous-dagrun responses without identifiers. |
| task-sdk/tests/conftest.py | Updates TIRunContext fixtures to construct DagRun without identifiers. |
| task-sdk/src/airflow/sdk/execution_time/task_runner.py | Refactors template-context caching and switches task-instance key string to use self.run_id. |
| task-sdk/src/airflow/sdk/execution_time/comms.py | Makes AssetEventSourceTaskInstance carry dag_id/run_id as explicit fields. |
| task-sdk/src/airflow/sdk/api/datamodels/_generated.py | Regenerates/updates SDK datamodel to remove DagRun.dag_id/DagRun.run_id. |
| airflow-core/tests/unit/dag_processing/test_processor.py | Updates dagrun context test fixtures to omit identifiers. |
| airflow-core/tests/unit/callbacks/test_callback_requests.py | Updates callback request tests to avoid relying on removed dag-run identifiers. |
| airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_11_07/test_dag_runs.py | Adjusts versioned API tests to no longer assert identifiers in dagrun responses. |
| airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_09_23/test_task_instances.py | Adjusts versioned API tests to no longer assert identifiers in nested dag_run. |
| airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_04_28/test_task_instances.py | Adjusts versioned API tests to no longer assert dag_id in nested dag_run. |
| airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_task_instances.py | Updates head-version task-instance API tests for new DagRun shape. |
| airflow-core/tests/unit/api_fastapi/execution_api/versions/head/test_dag_runs.py | Updates head-version dag-run API tests for new DagRun shape. |
| airflow-core/src/airflow/models/dagrun.py | Updates callback execution path to build DagRun context datamodel without identifiers. |
| airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_03_31.py | Adds a Cadwyn VersionChange describing removal of DagRun identifiers. |
| airflow-core/src/airflow/api_fastapi/execution_api/versions/init.py | Registers RemoveDagRunIdentifiers in the 2026-03-31 version bundle. |
| airflow-core/src/airflow/api_fastapi/execution_api/datamodels/taskinstance.py | Removes dag_id/run_id from the Execution API DagRun schema. |
Comments suppressed due to low confidence (1)
airflow-core/tests/unit/api_fastapi/execution_api/versions/v2025_09_23/test_task_instances.py:153
- For API version
2025-09-23, consider re-adding assertions thatdag_runstill includesdag_id/run_id(if those identifiers are only removed starting in2026-03-31). Without this, the versioned test suite won’t catch accidental breaking changes for older clients.
# Verify other expected fields
You can also share your feedback on Copilot code review. Take the survey.
| assert result["dag_run"]["dag_id"] == "dag" | ||
| assert result["task_reschedule_count"] == 0 | ||
| assert result["max_tries"] == 0 | ||
| assert result["should_retry"] is False |
| assert len(events) == 1 | ||
|
|
||
| mock_dag_run = mock.Mock(dag_id="d1", run_id="r1") | ||
| mock_dag_run = mock.Mock() |
Comment on lines
44
to
53
| bundle = VersionBundle( | ||
| HeadVersion(), | ||
| Version( | ||
| "2026-03-31", | ||
| MakeDagRunStartDateNullable, | ||
| ModifyDeferredTaskKwargsToJsonValue, | ||
| RemoveUpstreamMapIndexesField, | ||
| AddNoteField, | ||
| RemoveDagRunIdentifiers, | ||
| ), |
Comment on lines
+83
to
+84
|
|
||
|
|
| assert result["dag_id"] == "test_dag_id" | ||
| assert result["run_id"] == "run2" # Most recent before 2025-01-10 | ||
| assert result["logical_date"] == "2025-01-05T00:00:00Z" # Most recent before 2025-01-10 | ||
| assert result["state"] == "failed" |
Comment on lines
95
to
97
| # Verify other expected fields are still present | ||
| assert dag_run["dag_id"] == ti.dag_id | ||
| assert dag_run["run_id"] == "test" | ||
| assert dag_run["state"] == "running" | ||
| assert dag_run["conf"] == {} |
|
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 5 days if no further activity occurs. Thank you for your contributions. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Was generative AI tooling used to co-author this PR?
{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.