From 5250629b1dbccf0c8e6db6e367685ce21cf0beff Mon Sep 17 00:00:00 2001 From: Subham Sangwan Date: Mon, 9 Mar 2026 22:25:44 +0530 Subject: [PATCH] Fix grid view URL for dynamic task groups Dynamic task groups with isMapped=true were getting /mapped appended to their URL in the grid view, producing URLs like /tasks/group/{groupId}/mapped which has no matching route (404). The graph view correctly handles this by not appending /mapped for groups. This fix adds the same guard to buildTaskInstanceUrl. closes: #63197 --- airflow-core/newsfragments/63205.bugfix.rst | 1 + .../src/airflow/ui/src/utils/links.test.ts | 19 +++++++++++++++++-- .../src/airflow/ui/src/utils/links.ts | 2 +- 3 files changed, 19 insertions(+), 3 deletions(-) create mode 100644 airflow-core/newsfragments/63205.bugfix.rst diff --git a/airflow-core/newsfragments/63205.bugfix.rst b/airflow-core/newsfragments/63205.bugfix.rst new file mode 100644 index 0000000000000..7e1781bc8ed32 --- /dev/null +++ b/airflow-core/newsfragments/63205.bugfix.rst @@ -0,0 +1 @@ +Fix grid view URL for dynamic task groups producing 404 by not appending ``/mapped`` to group URLs. diff --git a/airflow-core/src/airflow/ui/src/utils/links.test.ts b/airflow-core/src/airflow/ui/src/utils/links.test.ts index 47dd032ebc519..75d175e22a599 100644 --- a/airflow-core/src/airflow/ui/src/utils/links.test.ts +++ b/airflow-core/src/airflow/ui/src/utils/links.test.ts @@ -243,7 +243,7 @@ describe("buildTaskInstanceUrl", () => { }), ).toBe("/dags/new_dag/runs/new_run/tasks/group/new_group"); - // Groups should never preserve tabs even for mapped groups + // Groups should never get /mapped appended — no such route exists for task groups expect( buildTaskInstanceUrl({ currentPathname: "/dags/old/runs/old/tasks/group/old_group/events", @@ -254,6 +254,21 @@ describe("buildTaskInstanceUrl", () => { runId: "new_run", taskId: "new_group", }), - ).toBe("/dags/new_dag/runs/new_run/tasks/group/new_group/mapped/3"); + ).toBe("/dags/new_dag/runs/new_run/tasks/group/new_group"); + }); + + it("should not append /mapped for dynamic task groups from grid view", () => { + // Regression test for https://github.com/apache/airflow/issues/63197 + // Dynamic task groups have isMapped=true but no route exists for group/:groupId/mapped + expect( + buildTaskInstanceUrl({ + currentPathname: "/dags/my_dag/runs/run_1/tasks/group/my_group", + dagId: "my_dag", + isGroup: true, + isMapped: true, + runId: "run_1", + taskId: "my_group", + }), + ).toBe("/dags/my_dag/runs/run_1/tasks/group/my_group"); }); }); diff --git a/airflow-core/src/airflow/ui/src/utils/links.ts b/airflow-core/src/airflow/ui/src/utils/links.ts index 3beafb06afea1..23c438721a5b8 100644 --- a/airflow-core/src/airflow/ui/src/utils/links.ts +++ b/airflow-core/src/airflow/ui/src/utils/links.ts @@ -89,7 +89,7 @@ export const buildTaskInstanceUrl = (params: { let basePath = `/dags/${dagId}/runs/${runId}/tasks/${groupPath}${taskId}`; - if (isMapped) { + if (isMapped && !isGroup) { basePath += `/mapped`; if (mapIndex !== undefined && mapIndex !== "-1") { basePath += `/${mapIndex}`;