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

   Sorting of tasks and nested TaskGroups in the graph/grid is governed by 
`[api] grid_view_sorting_order` (`topological` | `hierarchical_alphabetical`), 
applied recursively by the UI service on the **serialized** task group. But 
only `topological_sort` was ported to `SerializedTaskGroup` — 
`hierarchical_alphabetical_sort` exists solely on the task-SDK `TaskGroup`. So 
selecting `hierarchical_alphabetical` calls a method that doesn't exist on the 
class the UI renders:
   
   ```
   AttributeError: 'SerializedTaskGroup' object has no attribute 
'hierarchical_alphabetical_sort'
   ```
   
   i.e. the config value that gives *exactly* the alphabetical ordering of 
nested groups/tasks requested in #72114 doesn't sort — it `500`s the whole 
graph/grid.
   
   ### Fix
   Implement `hierarchical_alphabetical_sort` on `SerializedTaskGroup`, 
mirroring the task-SDK version (groups first, then tasks, each alphabetical by 
`node_id`). The UI service already recurses into nested groups and re-applies 
the sorter per level, so nested TaskGroups are ordered too.
   
   With this, `[api] grid_view_sorting_order = hierarchical_alphabetical` 
orders tasks and nested TaskGroups alphabetically in both the graph and grid.
   
   ### Reproduced
   On `main`, `hasattr(SerializedTaskGroup, "hierarchical_alphabetical_sort")` 
is `False`; calling the UI getter under that config raises the `AttributeError` 
above. The added test fails without the fix (same `AttributeError`) and asserts 
the alphabetical order with it.
   
   closes: #72114
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   - [X] Yes — Claude Code (Opus 4.8)
   
   Generated-by: Claude Code (Opus 4.8) following [the 
guidelines](https://github.com/apache/airflow/blob/main/contributing-docs/05_pull_requests.rst#gen-ai-assisted-contributions)


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to