Add condensed document reader view - #1380
Conversation
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
Warning Review limit reachedYou’ve reached a temporary PR review limit under our Fair Usage Limits Policy. Next review available in: 24 minutes Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (8)
📝 WalkthroughWalkthroughChangesThe document viewer now supports a persisted compact/full density preference, density toggles across desktop and phone navigation, compact clinical-summary behavior, controlled indexed-text reveals, and extracted print disclosure handling. Document viewer density and print integration
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Viewer
participant DensityToggle
participant DensityHook
participant IndexedTextPanel
Viewer->>DensityHook: read compact preference
Viewer->>DensityToggle: render compact state and setter
DensityToggle->>DensityHook: request full or compact mode
DensityHook-->>Viewer: publish updated compact state
Viewer->>IndexedTextPanel: pass compact state
IndexedTextPanel->>IndexedTextPanel: preserve forced reveal for selected or searched content
Possibly related PRs
Suggested labels: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Comment |
|
@cursoragent Inspect the PR and repository state, identify the root cause of every failing CI check, unresolved review comment, merge conflict, and related defect. Apply the smallest robust fix using existing project patterns and best practices, without unrelated changes. Run Bugbot and all relevant lint, type-check, test, build, and CI-equivalent commands, fix any issues found, then resolve only the review comments that are fully addressed. Summarise the root causes, changes made, validation results, and any remaining blockers. |
|
PR #1380 is green again. All required checks passed on the fix tip, including Production UI and CircleCI. Root causes
Fixes (pushed on
|
| Check | Result |
|---|---|
lint, format:check, typecheck, verify:cheap |
pass |
| Focused Vitest (document density/summary/nav) | pass |
| Local Playwright condensed-view smoke (4 tests) | 4 passed |
| Hosted Static / Build / Unit / Advisory / Production UI / PR required / CircleCI | pass |
Reviews
- Codex P2 thread resolved after the inert-summary fix.
- No unresolved
cursor[bot]Bugbot threads (Bugbot agent run found the lint issues above; no separate Bot comments).
Remaining
- None blocking merge on the fix tip. A docs-only ledger commit (
3e96301f) may still be finishing CI; it should not reintroduce product failures. - Merge remains a human action.
|
@codex review PR |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88d27ab6ec
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@CodeRabbit review PR |
|
@codex resolve actionable Codex review findings for this pull request and current head using the repository instructions. This is the pull request's single automatic repair pass: do not perform a fresh review, create new standalone findings, or request another review. Work only the existing unresolved Codex threads on the current head. Always fix P0 and P1 findings. For P2 and lower findings, fix only clear, scoped, low-risk issues; otherwise disposition them with a concise reason. After fixing or dispositioning a thread, reply in that thread with as the first line, followed by a concise summary; that marker authorizes the workflow to close that exact thread. If human input or new authorization is required, do not use the marker and leave the thread open with the blocker. Finish only after every actionable thread is fixed or dispositioned and closed, or explicitly left open for a human decision. Do not update the branch from main, address unrelated reviews, broaden scope, or create more than one scoped fix commit. Do not use external APIs, paid services, credentials, dependency changes, or broad refactors unless explicitly authorized. Add targeted tests where behavior changes and run the narrowest relevant validation. |
|
✅ Action performedReview finished.
|
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Replace setState-in-effect density/disclosure sync with useSyncExternalStore and adjust-during-render patterns so Static PR checks and CircleCI lint pass. Make the full-view indexed-text summary non-interactive so it no longer advertises a collapse control that cannot activate. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Keep format:check green for CircleCI and Static PR checks. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #6463 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Condensed view was latching closed when exclusive-accordion toggles raced deep-linked chunks, hiding highlighted passages in Production UI. Force reveal from selectedChunkId/search, ignore collapse while forced, and restore open after browser toggle settlement. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
tests/document-section-summary.dom.test.tsx (1)
41-86: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winConsider covering the search-driven reveal and the plain compact-collapse path.
This test exercises only the
selectedChunkIdbranch offorceReveal. ThenormalizedSearchbranch and the ordinary compact behavior (no deep link, user collapses, stays collapsed) are the paths most likely to regress from theonTogglelogic.🤖 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 `@tests/document-section-summary.dom.test.tsx` around lines 41 - 86, Extend the “IndexedTextPanel condensed reveal” tests to cover forceReveal via normalizedSearch without selectedChunkId, verifying the matching content stays revealed through summary and toggle interactions. Add a separate plain compact case with no deep link or search, confirming the panel starts open, can be collapsed by the user, and remains collapsed after the toggle settles.src/components/document-viewer/source-panels.tsx (1)
455-476: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueConsider distinct
keys on the inert vs. interactive<summary>.Both branches render
<summary>in the same slot, so wheninteractiveflips React reuses the same DOM node and swaps the handler in place rather than remounting. Impact here is benign (worst case one click toggles or no-ops), but distinct keys make the swap explicit and avoid stale-handler surprises if this header later gains stateful behavior.Based on learnings: "when conditionally replacing a control ... ensure the two rendered controls do not reuse the same DOM node. Give the alternative controls distinct React
keys (so React remounts instead of swapping handlers in-place)".♻️ Proposed keys
if (!interactive) { return ( <summary + key="static" aria-disabled="true" tabIndex={-1}return ( <summary + key="interactive" onClick={onClick} className="flex min-h-[72px] cursor-pointer list-none items-center justify-between gap-3 px-4 py-3" >🤖 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 `@src/components/document-viewer/source-panels.tsx` around lines 455 - 476, Add distinct React keys to the inert and interactive `<summary>` elements in the conditional rendering branch, using stable, branch-specific values so React remounts the element when `interactive` changes instead of reusing its DOM node and swapping handlers.Source: Learnings
🤖 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 `@src/components/document-viewer/use-document-view-density.ts`:
- Around line 28-35: Update setCompact in the document view density hook to
always retain the new density in an in-memory fallback when localStorage.setItem
fails, then dispatch documentViewDensityEvent regardless of persistence success.
Preserve localStorage persistence when available and ensure subscribers receive
the updated value in both paths.
---
Nitpick comments:
In `@src/components/document-viewer/source-panels.tsx`:
- Around line 455-476: Add distinct React keys to the inert and interactive
`<summary>` elements in the conditional rendering branch, using stable,
branch-specific values so React remounts the element when `interactive` changes
instead of reusing its DOM node and swapping handlers.
In `@tests/document-section-summary.dom.test.tsx`:
- Around line 41-86: Extend the “IndexedTextPanel condensed reveal” tests to
cover forceReveal via normalizedSearch without selectedChunkId, verifying the
matching content stays revealed through summary and toggle interactions. Add a
separate plain compact case with no deep link or search, confirming the panel
starts open, can be collapsed by the user, and remains collapsed after the
toggle settles.
🪄 Autofix (Beta)
❌ Autofix failed (check again to retry)
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: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 0a51f7a2-3f49-48dd-a7b3-f56d73a362de
📒 Files selected for processing (16)
docs/branch-review-ledger.mdsrc/components/DocumentViewer.tsxsrc/components/document-viewer/document-clinical-summary.tsxsrc/components/document-viewer/document-overview-landing.tsxsrc/components/document-viewer/document-rail-panels.tsxsrc/components/document-viewer/section-index.tssrc/components/document-viewer/section-nav.tsxsrc/components/document-viewer/source-panels.tsxsrc/components/document-viewer/use-document-view-density.tssrc/components/document-viewer/use-printable-disclosures.tstests/document-clinical-summary.dom.test.tsxtests/document-section-index.test.tstests/document-section-nav.dom.test.tsxtests/document-section-summary.dom.test.tsxtests/document-view-density.dom.test.tsxtests/ui-smoke.spec.ts
|
@cursoragent Inspect the PR and repository state, identify the root cause of every failing CI check, unresolved review comment, merge conflict, and related defect. Apply the smallest robust fix using existing project patterns and best practices, without unrelated changes. Run Bugbot and all relevant lint, type-check, test, build, and CI-equivalent commands, fix any issues found, then resolve only the review comments that are fully addressed. Summarise the root causes, changes made, validation results, and any remaining blockers. |
|
PR #1380 is merged ( Root causes
Changes made
Validation
Remaining
|
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. ❌ Cannot run autofix: This PR has merge conflicts. Please resolve the conflicts with the base branch and try again. Alternatively, use |
Resolve source-panels conflict by keeping condensed details/forceReveal behavior and adopting main's tracking-eyebrow token. Also keep the density toggle usable when localStorage is blocked (in-memory fallback) and extend condensed reveal coverage for search and plain collapse paths. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Append the merge/conflict-resolution and CodeRabbit density-fallback outcome for tip 7cefb24. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Resync after main advanced with ledger closeout #1382. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Resync after main landed #1383; merge-tree was already clean. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Keep PR tip current after CI green; main advanced by one commit. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Note hosted Production UI / PR required success and post-CI main resync. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>


Summary
Verification
Verification not run: the repository's exclusive browser/build lease remained occupied by another active document-UI worktree. The dry-run plan was reviewed; hosted CI should run the complete gate.
UI verification not run: the same coordinated browser lease was still active. Focused Playwright coverage was added for the density toggle, disclosure state, navigation, and print restoration.
Risk and rollout
Clinical Governance Preflight
Notes
Summary by CodeRabbit
New Features
Bug Fixes
Tests