Skip to content

feat(content-preview): forward comparison flags so Preview can own the banners - #4882

Open
zhirongwang wants to merge 1 commit into
box:masterfrom
zhirongwang:zhirong/comparison-preview-flags
Open

zhirongwang wants to merge 1 commit into
box:masterfrom
zhirongwang:zhirong/comparison-preview-flags

Conversation

@zhirongwang

@zhirongwang zhirongwang commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Open side-by-side version comparison and confirm each pane still loads the correct file version
  • Confirm the current pane does not nest a second compared slot
  • Start comparison on an already-open current file and confirm Preview receives the flag update without a reload
  • Leave comparison and confirm flags are cleared on the next show / setComparisonMode

Made with Cursor

Summary by CodeRabbit

  • Bug Fixes
    • Comparison previews now correctly distinguish the active pane from the older-version pane.
    • Comparison mode updates on an existing preview when comparison starts without requiring a reload.

…e banners

Stamp isComparing and isComparedPreview on show() and on an already-open
current pane so BCP can render comparison chrome without a reload.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 5e3752e1-a1d1-408b-8269-3791ff7ba926

📥 Commits

Reviewing files that changed from the base of the PR and between 430cf02 and 4767081.

📒 Files selected for processing (2)
  • src/elements/content-preview/ContentPreview.js
  • src/elements/content-preview/__tests__/ContentPreview.test.js

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.


Walkthrough

ContentPreview now distinguishes the compared pane from the active pane. It passes comparison flags when creating a preview and updates an existing preview when comparison starts without requiring a reload.

Changes

Comparison Preview Mode

Layer / File(s) Summary
Comparison flags and preview updates
src/elements/content-preview/ContentPreview.js, src/elements/content-preview/__tests__/ContentPreview.test.js
ContentPreview identifies the compared pane and sets comparison flags during preview initialization. When comparison starts and no reload is needed, it updates the existing preview. Tests cover both panes and reload behavior.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Feature

Suggested reviewers: ahorowitz123

Merge Risk: ⚪ Minimal · up to 47670

The comparison preview changes are mergeable after normal checks; no actionable issue remains from this review.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 47670

The inspected changes preserve file-version selection and token handling; they do not establish an expanded access path. Compatibility with the separately delivered Preview changes remains unverified, so correct comparison banners during live transitions and rollback cannot yet be confirmed.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The established changed path affects comparison metadata on the current and historical Preview instances within the existing component. It does not establish new tenant, datastore, service, or credential authority. External interpretation of those flags remains outside the hydrated source coverage.

Trust Boundaries and Controls

  • inferred — Host-controlled comparison props cross the existing Preview integration boundary as normalized booleans. The changed ranges do not establish a bypass of file-version selection or token handling: those inputs continue through separate initialization logic, and historical-version changes retain reload gating.

Resilience and Maintainability Implications

  • observed — The added tests assert initialization options for both pane roles, live comparison initiation, suppression during reload, and wrapper ownership. These caller-level assertions do not verify the external method's atomicity, concurrency, interruption, or recovery behavior.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: forwarding comparison flags from ContentPreview so Preview can render comparison banners.
Description check ✅ Passed The description explains the implementation, related pull request, and test plan. The test plan items remain unchecked, so completion evidence is not provided, but the description is otherwise suffici…
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.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.

Warning

Some tools did not complete. Review the errors below.

🔧 ast-grep (0.45.3)
src/elements/content-preview/__tests__/ContentPreview.test.js

ast-grep timed out on this file

🔧 Biome (2.5.13)
src/elements/content-preview/ContentPreview.js

File contains syntax errors that prevent linting: Line 22: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 37: 'import { type x ident }' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 68: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 69: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 70: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 71: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 72: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 73: 'import type' are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 74: '

... [truncated 18839 characters] ...

expected ) but instead found :; Line 1832: Expected a JSX attribute but instead found ')'.; Line 1830: Illegal return statement outside of a function; Line 1832: Unexpected token. Did you mean {'}'} or &rbrace;?; Line 1832: Unexpected token. Did you mean {'>'} or &gt;?; Line 1949: Expected a statement but instead found '}'.; Line 1952: 'export type' declarations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 1970: Type annotations are a TypeScript only feature. Convert your file to a TypeScript file or remove the syntax.; Line 1972: Expected an expression but instead found '?'.; Line 1972: expected : but instead found ;; Line 1973: Expected an expression but instead found '?'.; Line 1973: expected : but instead found ;


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

A rabbit checks the preview panes,
One marks the past, one stays in view.
When no reload is needed,
The live mode changes too.
Soft paws hop through comparison flags.

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

@zhirongwang zhirongwang self-assigned this Oct 2, 2026

This branch has not been deployed

No deployments
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