Skip to content

feat(automations): restore column sorting on the list - #18885

Merged
nwparker merged 1 commit into
mainfrom
nwparker/automations-sort-rewire
Sep 5, 2026
Merged

nwparker merged 1 commit into
mainfrom
nwparker/automations-sort-rewire

Conversation

@nwparker

@nwparker nwparker commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 12 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​262 $\color{#cf222e}{\Huge{\mathbf{−}}}$​157 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​105
Prod 13 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​978 $\color{#cf222e}{\Huge{\mathbf{−}}}$​828 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​150

Re-wires the automations list sort UI that #16532 dropped, making the collation work merged in #18823 reachable by users for the first time.

Why

#14158 added sorting to the automations page. #16532 ("Show all automations in flat table") rewrote the page and dropped the sort wiring, leaving AutomationListSortHeader, nextAutomationListSort, sortAutomationListViewItems and the whole AutomationListViewItem layer with no production caller. #18823 then optimized that sorter's collation setup — a real 10-26x win on a path no user could reach.

AutomationListSortHeader.tsx is restored verbatim from 05dc845; its i18n keys were never removed (en.json:15976).

What changed

Sorting spans both row kinds. Local and external automations render as one flat table under a single header, so a correct name sort has to interleave them. The panel now maps one sorted AutomationListViewItem[] and dispatches per row, which required extracting AutomationListLocalRow / AutomationListExternalRow from the two …Rows list components. Those wrappers keep their existing exports and behavior — AutomationListHostGroups and existing tests are untouched.

Header. Name and Last run are interactive again; the other six columns stay plain text. No aria-sort — the layout is divs with no grid roles, so state rides the button's accessible name ("Name, sorted ascending"), matching the existing Jira and space-manager sort controls.

Two model fixes this surfaced

  • View items now key on the host-qualified row key, not the bare automation ID. buildAutomationListViewItems predated automation-list-row-identity; under All hosts two authorities returning the same ID collapsed in the sort tie-break — exactly what that module exists to prevent. New regression test covers it.
  • sortAutomationListViewItems takes locale as a parameter instead of reading getIntlLocale() internally. The list result is memoized, and a hidden global read is invisible to a dependency array — a language switch would not have re-sorted. This also makes the function pure; its test no longer needs an i18n mock.

Keyboard traversal and focus recovery now read the sorted order, so arrow navigation matches what is on screen. The dead filterAutomationListViewItems / old applyAutomationListView path is dropped in favor of the live row/entry filters the page already used.

Validation

pnpm tc:web, oxlint, and oxfmt clean. 798 tests pass across 102 files (src/renderer/src/components/automations/ plus the pane-agent-identity ratchet), including 4 new header-interaction tests and the host-key tie-break regression.

Verified in the running app via CDP on this branch (Orca: nwparker/automations-sort-rewire): Name and Last run render as buttons with pointer cursors while the other six columns do not; clicking Name gives "Name, sorted ascending" with a lucide-arrow-up, clicking again gives "Name, sorted descending" with lucide-arrow-down; clicking Last run moves the indicator there ("Last run, sorted descending") and resets Name to plain "Name".

Gap, stated plainly: the dev profile had one local automation and no reachable external manager, so multi-row ordering and local/external interleaving were proven by unit tests, not on screen. The single-row screenshot shows the sorted-column indicator (LAST RUN ↓) but cannot show ordering.

No wire, persistence, host-execution, or provider surface is touched; sort state is React-local and not persisted.

The flat-table redesign in #16532 dropped the sort UI, orphaning
AutomationListSortHeader, nextAutomationListSort and the whole
AutomationListViewItem layer. Wire them back to the rendered list.

Name and Last run become interactive header cells again; the other six
columns stay plain text. Sorting now spans local and external rows as
one list, so the panel renders per-row components from a single sorted
collection instead of two independent sections.

Two model fixes fall out of that:

- View items key on the host-qualified row key, not the bare automation
  ID. The old builder predated automation-list-row-identity, so under
  All hosts two authorities returning the same ID collapsed in the sort
  tie-break.
- sortAutomationListViewItems takes the locale as a parameter instead of
  reading getIntlLocale(). A hidden global read is invisible to a
  dependency array, and the list result is memoized.

Keyboard traversal and focus recovery now read the sorted order, so
arrow navigation matches what is on screen. The dead unified filter is
removed in favor of the live row/entry filters the page already used.
@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The automation list now uses a unified local and external item model. It supports locale-aware sorting for Name and Last run columns. Local and external row rendering moved into dedicated components with selection, status, and action menus. Page state and panel wiring now pass sorted mixed items. Tests and test helpers now observe rendered items through the unified list model.

Merge Risk: ⚪ Minimal · up to 004b0

No concrete merge-blocking risk remains in the automation list changes.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the change, motivation, implementation, and validation in detail. However, it does not follow the required template because it omits the mandatory linked issue section, explic… Add the required template sections. Include a valid issue reference such as Fixes #123``. Attach before-and-after UI screenshots or videos for the sorting behavior. Complete the testing checklist with tested platforms and commands. Complete…
Docstring Coverage ⚠️ Warning Docstring coverage is 36.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 36 functions across 25 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the primary change: restoring column sorting in the automations list.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the change, motivation, implementation, and validation in detail. However, it does not follow the required template because it omits the mandatory linked issue section, explicit visual-proof attachments or required UI proof format, testing checkboxes and platform details, and several checklist sections.

Resolution

Add the required template sections. Include a valid issue reference such as Fixes #123``. Attach before-and-after UI screenshots or videos for the sorting behavior. Complete the testing checklist with tested platforms and commands. Complete or explicitly mark the AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist sections.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pullfrog pullfrog Bot left a comment

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.

✅ No new issues found.

Reviewed changes

  • Row extraction — AutomationListLocalRow and AutomationListExternalRow are pulled out of the two …Rows list components (verbatim; wrapping exports preserved), so the panel can render one sorted AutomationListViewItem[].
  • Sort wiring — AutomationListSortHeader is restored, AutomationListTableHeader exposes Name and Last run as sort buttons, and nextAutomationListSort drives the React-local listSort state through AutomationsPageListPanel.
  • Sort spans both row kinds — buildAutomationListViewItems flattens local rows and external entries into one list, and the panel dispatches per item.kind.
  • Host-qualified tie-break — view items now key on row.key rather than the bare automation ID, so two authorities returning the same ID under All hosts no longer collapse in the tie-break (regression-tested).
  • Locale parameterization — sortAutomationListViewItems takes locale instead of reading getIntlLocale() internally, so the memoized sort re-collates on a language switch; the function is now pure and its test no longer needs an i18n mock.
  • Dead-path cleanup — filterAutomationListViewItems is removed; keyboard traversal and focus recovery now read the sorted render order.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
src/renderer/src/components/automations/AutomationListLocalRow.tsx (1)

294-333: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Share the automation menu action definitions. Both row components currently expose equivalent actions, labels, enablement, and callbacks in their dropdown and context menus. This causes no current runtime or enforced-check failure, but future edits can make the menus diverge. Use one parameterized action definition with either ContextMenuItem or DropdownMenuItem in both files.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 2911e9e4-fd08-4cd3-a461-d08db99e9b96

📥 Commits

Reviewing files that changed from the base of the PR and between 1924c8f and 004b09c.

📒 Files selected for processing (25)
  • src/renderer/src/components/automations/AutomationListExternalRow.tsx
  • src/renderer/src/components/automations/AutomationListExternalRows.tsx
  • src/renderer/src/components/automations/AutomationListLocalRow.tsx
  • src/renderer/src/components/automations/AutomationListLocalRows.tsx
  • src/renderer/src/components/automations/AutomationListSortHeader.tsx
  • src/renderer/src/components/automations/AutomationListTableHeader.test.tsx
  • src/renderer/src/components/automations/AutomationListTableHeader.tsx
  • src/renderer/src/components/automations/AutomationsListPanel.test.tsx
  • src/renderer/src/components/automations/AutomationsListPanel.tsx
  • src/renderer/src/components/automations/AutomationsPage.create-destination.test.tsx
  • src/renderer/src/components/automations/AutomationsPage.cross-authority-actions.test.tsx
  • src/renderer/src/components/automations/AutomationsPage.external-scope.test.tsx
  • src/renderer/src/components/automations/AutomationsPage.notice-recovery.test.tsx
  • src/renderer/src/components/automations/AutomationsPage.refresh-selection.test.tsx
  • src/renderer/src/components/automations/AutomationsPage.run-visibility.test.tsx
  • src/renderer/src/components/automations/AutomationsPage.test.tsx
  • src/renderer/src/components/automations/AutomationsPageListPanel.tsx
  • src/renderer/src/components/automations/automation-list-view-sort.test.ts
  • src/renderer/src/components/automations/automation-list-view.test.ts
  • src/renderer/src/components/automations/automation-list-view.ts
  • src/renderer/src/components/automations/automations-page-listed-items.ts
  • src/renderer/src/components/automations/automations-page-test-harness.tsx
  • src/renderer/src/components/automations/use-automations-page-list-state.ts
  • src/renderer/src/components/automations/use-automations-page-local-state.ts
  • src/shared/pane-agent-identity-inventory.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 2 remain after this review.

@nwparker
nwparker merged commit abdee9e into main Sep 5, 2026
29 checks passed
@nwparker
nwparker deleted the nwparker/automations-sort-rewire branch September 5, 2026 23:16
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
The flat-table redesign in stablyai#16532 dropped the sort UI, orphaning
AutomationListSortHeader, nextAutomationListSort and the whole
AutomationListViewItem layer. Wire them back to the rendered list.

Name and Last run become interactive header cells again; the other six
columns stay plain text. Sorting now spans local and external rows as
one list, so the panel renders per-row components from a single sorted
collection instead of two independent sections.

Two model fixes fall out of that:

- View items key on the host-qualified row key, not the bare automation
  ID. The old builder predated automation-list-row-identity, so under
  All hosts two authorities returning the same ID collapsed in the sort
  tie-break.
- sortAutomationListViewItems takes the locale as a parameter instead of
  reading getIntlLocale(). A hidden global read is invisible to a
  dependency array, and the list result is memoized.

Keyboard traversal and focus recovery now read the sorted order, so
arrow navigation matches what is on screen. The dead unified filter is
removed in favor of the live row/entry filters the page already used.
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.

1 participant