You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "henry3260 (via GitHub)" <gi...@apache.org> on 2026/03/13 14:12:11 UTC

[PR] Remove duplicate dag_id and run_id from DagRun [airflow]

henry3260 opened a new pull request, #63524:
URL: https://github.com/apache/airflow/pull/63524

   
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, please
   change below checkbox to `[X]` followed by the name of the tool, uncomment the "Generated-by".
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name] following [the guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)
   -->
   
   ---
   
   * Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#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](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvement+Proposals)) is needed.
   * When adding dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   * For significant user-facing changes create newsfragment: `{pr_number}.significant.rst`, in [airflow-core/newsfragments](https://github.com/apache/airflow/tree/main/airflow-core/newsfragments). You can add this file in a follow-up commit after the PR is created so you know the PR number.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Remove duplicate dag_id and run_id from DagRun [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed pull request #63524: Remove duplicate dag_id and run_id from DagRun
URL: https://github.com/apache/airflow/pull/63524


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Remove duplicate dag_id and run_id from DagRun [airflow]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #63524:
URL: https://github.com/apache/airflow/pull/63524#discussion_r2931492536


##########
airflow-core/src/airflow/api_fastapi/execution_api/versions/v2026_03_31.py:
##########
@@ -95,3 +95,14 @@ def ensure_start_date_in_dag_run(response: ResponseInfo) -> None:  # type: ignor
         """Ensure start_date is never None in direct DagRun responses for previous API versions."""
         if response.body.get("start_date") is None:
             response.body["start_date"] = response.body.get("run_after")
+
+
+class RemoveDagIdAndRunIdFromDagRun(VersionChange):
+    """Remove `dag_id` and `run_id` from DagRun model."""
+
+    description = __doc__
+
+    instructions_to_migrate_to_previous_version = (
+        schema(DagRun).field("dag_id").existed_as(type=str),
+        schema(DagRun).field("run_id").existed_as(type=str),
+    )

Review Comment:
   `RemoveDagIdAndRunIdFromDagRun` declares that `DagRun.dag_id`/`run_id` existed in previous API versions, but there is no `@convert_response_to_previous_version_for(...)` handler to actually add those fields back when downgrading responses. This likely breaks clients pinned to pre-2026-03-31 schemas, since responses will no longer contain required `dag_id`/`run_id` keys. Consider adding response conversion(s) (e.g. for `TIRunContext` and direct `DagRun` responses) to populate these fields from request/path context or other available data when converting to older versions.
   



##########
task-sdk/src/airflow/sdk/execution_time/comms.py:
##########
@@ -351,13 +351,9 @@ class AssetEventSourceTaskInstance:
     task_id: str
     map_index: int
 
-    @property
-    def dag_id(self) -> str:
-        return self.dag_run.dag_id
+    dag_id: str
 
-    @property
-    def run_id(self) -> str:
-        return self.dag_run.run_id
+    run_id: str
 

Review Comment:
   `AssetEventSourceTaskInstance` now requires explicit `dag_id`/`run_id` fields. There are still tests constructing `AssetEventSourceTaskInstance(dag_run=..., task_id=..., map_index=...)` without these args (e.g. `task-sdk/tests/task_sdk/execution_time/test_context.py`), which will start failing due to missing required attributes. Update those call sites/tests to pass `dag_id`/`run_id` (likely from the asset event reference’s `source_dag_id`/`source_run_id`).



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Remove duplicate dag_id and run_id from DagRun [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk commented on PR #63524:
URL: https://github.com/apache/airflow/pull/63524#issuecomment-4194974842

   This draft pull request has had no activity from the author for over 3 weeks.
   
   **@henry3260**, you are welcome to reopen this PR when you are ready to continue working on it. Thank you for your contribution!
   
   <!-- Pull Request quality criteria -->


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org