Skip to content

feat: unify hierarchical test table grouping - #2030

Open
mentonin wants to merge 1 commit into
kernelci:mainfrom
profusion:georg/unify-groups-and-items
Open

feat: unify hierarchical test table grouping#2030
mentonin wants to merge 1 commit into
kernelci:mainfrom
profusion:georg/unify-groups-and-items

Conversation

@mentonin

Copy link
Copy Markdown
Contributor

Summary

  • Replace the nested individual-tests subtable with a single TanStack hierarchy of group and leaf rows, so expanded tests share one header and column layout.
  • Omit single-item path groups (hoisting path segments) and add Expand all / Collapse all / Disable grouping controls.
  • Keep the table virtualized and use O(1) leaf-index lookups for log-sheet navigation.

Test plan

  • On Tree / Hardware / Issue / Build test tabs, expand and collapse path groups; confirm leaf columns (status, date, duration, details) render correctly.
  • Use Expand all / Collapse all / Disable grouping / Enable grouping; confirm flat mode shows full paths and grouping restores.
  • Open a leaf log sheet and walk next/previous across leaves spanning multiple groups.
  • Smoke-test a large result set (expand all or ungrouped) for scroll performance and sticky header behavior.
  • Run collapseTestsTree / unified-tree unit tests.

Related issues

Omit single-item path groups, expand leaves in the same table with one header, and add expand/collapse/disable grouping controls.

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Luiz Georg <luiz.georg@profusion.mobi>
@mentonin

Copy link
Copy Markdown
Contributor Author

@bhcopeland this should fix some issues we talked about on yesterday's call, and can be applied to the A/B comparison or any other table as well:

  • Grouped or ungrouped table views are available at a click
  • No groups with a single test under them
  • No nested tables
  • Sortable by any column in either grouped or ungrouped modes

I would like your opinion on how groups should sort by and display columns other than path and status. I considered displaying "N variants" and sorting by the first or last values within the grouped leaf tests, but I worry that might be too complex or confusing, and maybe slow on the frontend. As is, this sorts groups as nulls on those columns.

@alanpeixinho

alanpeixinho commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Using only the last segment on path makes it cleaner, but at the same time, leaves us with "empty path" rows.
new-collapsible-test

And also on this topic, if we scroll on lists of many tests, we would loose the grouped path, so it might be harder to know the exact full path we are looking right now.

key: string;
labelId: MessagesKey;
onClick: () => void;
isSelected: boolean;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

this is always false. Do we need it?

* Groups wrapping a single item are omitted: a node with one leaf child
* (after recursion) is hoisted to the parent with the path segment prepended.
*/
export function buildUnifiedTestsTree(nodes: TPathTests[]): UnifiedTestRow[] {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have not profiled this properly, but the operation of grouping and ungrouping seems to be a little bit slow for huge tables.
Maybe we could just use a toggle/expand all only?

* Adapts leaf/individual-test column defs for the unified group+leaf table:
* path/status get group-aware cells; other columns are blank on group rows.
*/
export function adaptColumnsForUnifiedTable(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I dont know if we need a full adapter for a table used in a single place.
Also, if we go for the adapter route, we might need to remove the columns property.

}: ITableGroupingControls): JSX.Element {
const isGrouped = mode === 'grouped';

const buttons = useMemo((): GroupingButton[] => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: Don't know if we need memoization here. We are just creating a simple array of objects here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants