Skip to content

Agentic Review: Add progress bar and keyboard shortcuts#35062

Open
ghengeveld wants to merge 2 commits into
yann/agentic-review-mcp-integrationfrom
review-shortcuts-progress
Open

Agentic Review: Add progress bar and keyboard shortcuts#35062
ghengeveld wants to merge 2 commits into
yann/agentic-review-mcp-integrationfrom
review-shortcuts-progress

Conversation

@ghengeveld

@ghengeveld ghengeveld commented Jun 5, 2026

Copy link
Copy Markdown
Member

What I did

Two improvements to the review addon's detail screen:

  • Rebindable navigation shortcuts. The detail screen's cross-collection navigation (back, previous/next story, previous/next collection) is now registered as customizable addon shortcuts that show up on the Shortcuts settings page. The review page no longer blanks/restores the manager's built-in Opt+Arrow/Escape bindings, so it no longer mutates global shortcut state.
  • Progress bar. A progress bar is pinned to the top of the detail header, spanning 0% on the first story to 100% on the last. It sits on top of (and rides with) the header, so when the stale banner appears it pushes the bar down with the header rather than being overlapped. Collection segment lines were removed for a single continuous fill.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

  1. Run a sandbox, e.g. yarn task --task sandbox --start-from auto --template react-vite/default-ts (or use the internal UI: cd code && yarn storybook:ui).
  2. Trigger a review (via the display-review flow) so the review page opens with multiple stories across collections.
  3. Open a story's detail screen and confirm the progress bar at the top of the header reads 0% on the first story and 100% on the last, filling proportionally in between.
  4. Confirm the bar sits at the header's top edge; when the "this review may be stale" banner is shown, the bar moves down with the header instead of overlapping the banner.
  5. Use the arrow keys to navigate (Left/Right for prev/next story, Up/Down for prev/next collection, Escape for back) and confirm navigation works and wraps across collection boundaries.
  6. Open the Shortcuts settings page and confirm the review navigation shortcuts appear and can be rebound; confirm the built-in Opt+Arrow/Escape bindings are left intact.

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

Release Notes

  • New Features

    • Added keyboard shortcuts for navigating reviews (back, previous/next story, previous/next collection navigation)
    • Added detail view with progress indicator and story counter for viewing individual stories
    • Enabled comparison of original and updated story versions with toggle between side-by-side and single-pane display modes
  • Tests

    • Added comprehensive test coverage for review navigation and detail view functionality

Register the detail screen's cross-collection navigation (back, prev/next
story, prev/next collection) as customizable addon shortcuts instead of
overriding the manager's built-in Opt+Arrow/Escape bindings, so users can
rebind them and the review page no longer mutates global shortcut state.

Add a progress bar pinned to the top of the detail header that spans 0% on
the first story to 100% on the last; it rides with the header when the stale
banner pushes it down rather than overlapping the banner.
@ghengeveld ghengeveld self-assigned this Jun 5, 2026
@ghengeveld ghengeveld added feature request ci:normal Run our default set of CI jobs (choose this for most PRs). qa:needed Pull Requests that will need manual QA prior to release. labels Jun 5, 2026
@ghengeveld ghengeveld changed the title Add review progress bar and rebindable navigation shortcuts Agentic Review: Add progress bar and keyboard shortcuts Jun 5, 2026
@ghengeveld ghengeveld requested a review from yannbf June 5, 2026 09:29
@ghengeveld ghengeveld changed the base branch from next to yann/agentic-review-mcp-integration June 5, 2026 09:29
@storybook-app-bot

storybook-app-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

Package Benchmarks

Commit: 5368d88, ran on 9 June 2026 at 07:09:47 UTC

No significant changes detected, all good. 👏

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the review addon with keyboard shortcut navigation and refinements to the details screen. It introduces pure navigation helpers for computing previous/next stories across collections with wraparound, integrates shortcut registration into ReviewPage, and enhances DetailsScreen with a progress bar and improved baseline-comparison UI with persisted mode switching.

Changes

Review Navigation and Keyboard Shortcuts

Layer / File(s) Summary
Navigation helpers for flattened story sequences
code/addons/review/src/review-navigation.ts
ReviewSequenceEntry type and helpers (flattenReviewStories, getReviewDetailNeighbors, getAdjacentCollectionFirstStory, ReviewShortcutHrefs) compute story position/neighbors within a flattened cross-collection sequence with wraparound support.
Navigation helper tests
code/addons/review/src/review-navigation.test.ts
Vitest suite validating flattening, boundary transitions, wraparound behavior, and null-handling for empty sequences and out-of-range indices.
ReviewPage keyboard shortcut registration and navigation
code/addons/review/src/ReviewPage.tsx
Adds shortcutHrefsRef to store dynamic navigation targets, navigateToShortcut handler, and manager addon shortcut registration for back/previous/next story and previous/next collection actions with computed hrefs from flattened sequences.
ReviewPage shortcut action testing
code/addons/review/src/ReviewPage.stories.tsx
Mocks setAddonShortcut in manager API, enhances Collections story assertions, and adds DetailsShortcutActionNavigates story verifying keyboard action invocation navigates between stories.
DetailsScreen component with progress and comparison controls
code/addons/review/src/screens/DetailsScreen.tsx
Implements component with styled header/progress-bar/comparison-controls; reads/persists compare mode (split vs single) via sessionStore; routes baseline/latest preview refs and conditionally renders panes based on showBaseline, isSingleUp, and activePane state.
DetailsScreen story coverage
code/addons/review/src/screens/DetailsScreen.stories.tsx
Storybook meta with ManagerContext mock; six stories (Default, WithBaseline, NewStory, Stale, Progress, WrapAroundNavigation) with play assertions for UI state, navigation hrefs, and baseline-comparison visibility.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

…uts-progress

Resolve review addon conflicts by keeping cross-collection navigation shortcuts
and the progress bar while adopting canonical story hrefs via getStoryHrefs.

@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

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@code/addons/review/src/screens/DetailsScreen.tsx`:
- Around line 319-329: Clamp the computed progress value to the [0,1] range
before using it in the ProgressFill width: replace the current progress
calculation (const progress = totalStories > 1 ? storyIndex / (totalStories - 1)
: 0) with a clamped value (e.g., const rawProgress = totalStories > 1 ?
storyIndex / (totalStories - 1) : 0; const progress = Math.max(0, Math.min(1,
rawProgress))); then use this clamped progress when setting the style width on
ProgressFill so negative or >100% widths cannot occur.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 52adc0b9-dffa-428d-b08a-0dca532ee9f1

📥 Commits

Reviewing files that changed from the base of the PR and between 1c8975f and 5368d88.

📒 Files selected for processing (6)
  • code/addons/review/src/ReviewPage.stories.tsx
  • code/addons/review/src/ReviewPage.tsx
  • code/addons/review/src/review-navigation.test.ts
  • code/addons/review/src/review-navigation.ts
  • code/addons/review/src/screens/DetailsScreen.stories.tsx
  • code/addons/review/src/screens/DetailsScreen.tsx

Comment on lines +319 to +329
const progress = totalStories > 1 ? storyIndex / (totalStories - 1) : 0;

return (
<Page>
{isStale ? <StaleBanner /> : null}
<ReviewHeader
autoFocusTitle
leading={
<IconButton
variant="ghost"
size="small"
padding="small"
ariaLabel="Back to review"
asChild
>
<a href={backHref}>
<ChevronSmallLeftIcon />
</a>
</IconButton>
}
title={title}
subtitle={subtitle}
actions={
<>
<Counter variant="ghost" size="small" readOnly>
{storyIndex + 1}/{totalStories}
</Counter>
<HeaderWrap>
<ProgressBar aria-hidden data-testid="review-progress">
<ProgressFill
data-testid="review-progress-fill"
style={{ width: `${progress * 100}%` }}
/>

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Clamp progress to [0, 1] before applying width.

If storyIndex is ever out of range, the fill width can go negative or exceed 100%, which breaks the progress visualization.

Suggested fix
-  const progress = totalStories > 1 ? storyIndex / (totalStories - 1) : 0;
+  const progress =
+    totalStories > 1 ? Math.min(1, Math.max(0, storyIndex / (totalStories - 1))) : 0;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const progress = totalStories > 1 ? storyIndex / (totalStories - 1) : 0;
return (
<Page>
{isStale ? <StaleBanner /> : null}
<ReviewHeader
autoFocusTitle
leading={
<IconButton
variant="ghost"
size="small"
padding="small"
ariaLabel="Back to review"
asChild
>
<a href={backHref}>
<ChevronSmallLeftIcon />
</a>
</IconButton>
}
title={title}
subtitle={subtitle}
actions={
<>
<Counter variant="ghost" size="small" readOnly>
{storyIndex + 1}/{totalStories}
</Counter>
<HeaderWrap>
<ProgressBar aria-hidden data-testid="review-progress">
<ProgressFill
data-testid="review-progress-fill"
style={{ width: `${progress * 100}%` }}
/>
const progress =
totalStories > 1 ? Math.min(1, Math.max(0, storyIndex / (totalStories - 1))) : 0;
return (
<Page>
{isStale ? <StaleBanner /> : null}
<HeaderWrap>
<ProgressBar aria-hidden data-testid="review-progress">
<ProgressFill
data-testid="review-progress-fill"
style={{ width: `${progress * 100}%` }}
/>
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/addons/review/src/screens/DetailsScreen.tsx` around lines 319 - 329,
Clamp the computed progress value to the [0,1] range before using it in the
ProgressFill width: replace the current progress calculation (const progress =
totalStories > 1 ? storyIndex / (totalStories - 1) : 0) with a clamped value
(e.g., const rawProgress = totalStories > 1 ? storyIndex / (totalStories - 1) :
0; const progress = Math.max(0, Math.min(1, rawProgress))); then use this
clamped progress when setting the style width on ProgressFill so negative or
>100% widths cannot occur.

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

Labels

ci:normal Run our default set of CI jobs (choose this for most PRs). feature request qa:needed Pull Requests that will need manual QA prior to release.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant