Skip to content

Virtualize automations run history table for large histories - #20916

Merged
AmethystLiang merged 4 commits into
mainfrom
make-sure-automations-table-virtualized
Sep 16, 2026
Merged

AmethystLiang merged 4 commits into
mainfrom
make-sure-automations-table-virtualized

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor
Files Added Deleted Net
Test 2 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​515 $\color{#cf222e}{\Huge{\mathbf{−}}}$​23 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​492
Prod 7 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​434 $\color{#cf222e}{\Huge{\mathbf{−}}}$​167 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​267

Problem

The automations run history table renders every run in the DOM, causing performance degradation when displaying large histories (thousands of runs).

Solution

Implements virtual scrolling using @tanstack/react-virtual to render only visible rows at any time, keeping mounted DOM nodes bounded. Optimizes date formatting by freezing Intl.DateTimeFormat at module scope.

What Changed

  • AutomationRunHistory.tsx: Refactored to use useVirtualizer; handles 5,000+ runs with <50 mounted rows
  • AutomationRunsTable.tsx: Moved sticky header into scroller, improved scroll-based load-more guard
  • Performance: Froze DateTimeFormat at module scope to avoid per-cell allocations
  • Test coverage: New virtualizer-test-stub.ts, comprehensive virtualization and row content tests
  • Layout: AutomationsDetailPane wrapper adjusted for virtualization ownership of scroll

Why

Virtualization is the standard solution for large scrollable lists—ensures smooth scrolling and bounded memory regardless of history size.

Linked Issue

Fixes #

Visual Proof

N/A — performance improvement, no visible UI change

Testing

  • Virtualization: 5,000-run history test verifies <50 mounted rows

  • Row content: spend, tokens, workspace names, status, occurrence labels

  • Keyboard navigation: ArrowUp/Down/Enter with virtualized rows

  • Load-more: scroll position guards and pagination behavior

  • Selection: stale selection drops on automation change

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

AI Disclosure

N/A

Review

Agent skill upstream boundary

  • Not applicable, or this change follows docs/reference/agent-skill-sharing-upstream-boundary.md and copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

Checklist

  • This PR is small and focused
  • I explained what changed and why (including ELI5)
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

- Add virtual scrolling to AutomationRunHistory for efficient rendering of large run lists
- Implement sticky table header that stays visible during scroll
- Update keyboard navigation and focus management for virtualized rows
- Move AutomationRunsTable header inside scroll container for visual consistency
- Add virtualizer-test-stub for testing virtual scroll behavior without DOM measurement
- Cache DateTimeFormat to avoid per-cell allocation overhead
- Tests verify row content renders spend, tokens, and workspace labels correctly
- Keyboard navigation guards prevent operations during failed host reads
- Load-more pagination triggers at scroll end and respects page boundaries
- New fixtures support flexible automation run and usage test scenarios
@coderabbitai

coderabbitai Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: b6ce25ea-31a6-4374-aaeb-65debd7ebffb

📥 Commits

Reviewing files that changed from the base of the PR and between 57e28aa and b20e27f.

📒 Files selected for processing (1)
  • src/renderer/src/components/automations/AutomationRunHistory.test.tsx

📝 Walkthrough

Walkthrough

Automation run history now uses virtualized rows with measured header offsets and updated keyboard navigation. The runs table uses a sticky header and flex-based loading and empty states. The detail pane delegates scrolling to the history component. Tests and fixtures now cover virtualization, row content, keyboard guards, table behavior, pagination, usage data, and worktree data. Date formatting reuses a module-scope formatter.

Merge Risk: ⚪ Minimal · up to 57e28

The virtualized history guards missing selections before scrolling, and no merge-blocking issue remains.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the problem, solution, scope, and testing. However, the required linked issue is blank, the ELI5 and Review sections are missing or empty, and Visual Proof is marked N/A despi… Add a valid issue reference after “Fixes #”. Add the required ELI5 section and complete the Review section. Provide before-and-after visual proof for the UI and interaction changes, or justify N/A with a more accurate explanation. Document …
Docstring Coverage ⚠️ Warning Docstring coverage is 18.18% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 22 functions across 9 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 describes the primary change: virtualizing the automations run history table for large histories.
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 problem, solution, scope, and testing. However, the required linked issue is blank, the ELI5 and Review sections are missing or empty, and Visual Proof is marked N/A despite layout and interaction changes such as sticky scrolling and keyboard navigation.

Resolution

Add a valid issue reference after “Fixes #”. Add the required ELI5 section and complete the Review section. Provide before-and-after visual proof for the UI and interaction changes, or justify N/A with a more accurate explanation. Document the platforms tested and the status of the required lint, typecheck, test, and build commands.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 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.

@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.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Advanced

Run ID: ae584043-6242-4e2a-8069-f2cd49f9cffe

📥 Commits

Reviewing files that changed from the base of the PR and between a9232e8 and 6db175d.

📒 Files selected for processing (8)
  • src/renderer/src/components/automations/AutomationRunHistory.test.tsx
  • src/renderer/src/components/automations/AutomationRunHistory.tsx
  • src/renderer/src/components/automations/AutomationRunsTable.test.tsx
  • src/renderer/src/components/automations/AutomationRunsTable.tsx
  • src/renderer/src/components/automations/AutomationsDetailPane.tsx
  • src/renderer/src/components/automations/automation-page-parts.tsx
  • src/renderer/src/components/automations/automations-page-fixtures.ts
  • src/renderer/src/components/automations/virtualizer-test-stub.ts

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

@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 critical issues — one coverage gap inline, plus two small notes.

Reviewed changes

  • AutomationRunHistory virtualization — replaces the full runs.map() render with useVirtualizer, adds a sticky in-scroller header with a measured scrollMargin, and routes keyboard navigation through a ref so the window listener no longer resubscribes on every render.
  • Deferred keyboard focus — arrow moves record pendingFocusRunIdRef and focus the row only after the scroll-driven render mounts it, since the target can sit outside the virtual window.
  • AutomationRunsTable header — moved inside the scroller as sticky top-0; the scroll container is now a flex column.
  • Detail pane layout — the runs tab now owns its scrolling via a p-5 wrapper instead of padding on TabsContent.
  • Formatting and fixtures — Intl.DateTimeFormat frozen at module scope; makeRunUsage/makeWorktree fixtures added and an as Worktree cast dropped.
  • Tests — shared virtualizer-test-stub.ts, plus new virtualization, row-content and load-more coverage.

ℹ️ Nitpicks

  • The PR body says "no visible UI change", but the runs tab now has its own scroll, a sticky table header, and a fixed "Run history" bar. A before/after screenshot would confirm the new flex/scroll chain renders as intended.
  • RUNS_VIEWPORT_INITIAL_RECT is defined identically in AutomationRunHistory.tsx and AutomationRunsTable.tsx; a shared constant would keep the two viewport windows from drifting.

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

- Implement scrollToIndex in virtualizer stub to move viewport window
- Optimize row-size estimation to use predicate instead of labels
- Test validates keyboard navigation scrolls rows into view before focus

@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 critical issues — one minor coverage note inline.

Reviewed changes

  • Extracted isAutomationRunFolded and switched row-size estimation to it, so estimateSize no longer builds the occurrence label (and formats a date) for every unmounted index; the label still returns null exactly when the predicate is false, so the estimate is unchanged.
  • Made the shared virtualizer stub window move on scrollToIndex instead of always returning the first 21 items, and added a test that arrows a selection past the virtual window, asserting the row mounts, carries data-current, and takes focus (document.activeElement).

Pullfrog  | Fix all ➔ | Fix 👍s ➔ | View workflow run | Using DeepSeek Flash (free via Pullfrog for OSS) | 𝕏

@AmethystLiang
AmethystLiang merged commit feb04ec into main Sep 16, 2026
2 of 4 checks passed

@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

  • Virtualization test helpers extracted — renderRuns, pressArrow and makeRuns replace the render/arrow loops duplicated across the virtualization cases.
  • Scroll-up focus coverage added — a case that arrows past the virtual window and back up, asserting the first row remounts with data-current and takes focus, closing the upward direction the previous commit left untested.

The new test is real: forcing the stub's index < current branch to a no-op makes it fail. Both prior pullfrog threads are addressed and resolved.

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

ivanvykopal pushed a commit to ivanvykopal/orca that referenced this pull request Sep 20, 2026
…i#20916)

* refactor(automations): virtualize run history table

- Add virtual scrolling to AutomationRunHistory for efficient rendering of large run lists
- Implement sticky table header that stays visible during scroll
- Update keyboard navigation and focus management for virtualized rows
- Move AutomationRunsTable header inside scroll container for visual consistency
- Add virtualizer-test-stub for testing virtual scroll behavior without DOM measurement
- Cache DateTimeFormat to avoid per-cell allocation overhead

* test(automations): add coverage for virtualized run table

- Tests verify row content renders spend, tokens, and workspace labels correctly
- Keyboard navigation guards prevent operations during failed host reads
- Load-more pagination triggers at scroll end and respects page boundaries
- New fixtures support flexible automation run and usage test scenarios

* test(automations): verify scroll-to-focus path in virtualized runs

- Implement scrollToIndex in virtualizer stub to move viewport window
- Optimize row-size estimation to use predicate instead of labels
- Test validates keyboard navigation scrolls rows into view before focus

* add more tests
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