Skip to content

remove dag_id and run_id#13

Open
henry3260 wants to merge 1 commit intomainfrom
remove-dag-id
Open

remove dag_id and run_id#13
henry3260 wants to merge 1 commit intomainfrom
remove-dag-id

Conversation

@henry3260
Copy link
Copy Markdown
Owner


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

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

Copilot AI review requested due to automatic review settings March 14, 2026 19:40
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id from DagRun models in both airflow-core Execution 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 DagRun shape; register a Cadwyn version change for 2026-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 that dag_run still includes dag_id/run_id (if those identifiers are only removed starting in 2026-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"] == {}
@github-actions
Copy link
Copy Markdown

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.

@github-actions github-actions Bot added the Stale label Apr 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants