Skip to content

refactor(viewer): Phase 1 DocumentViewer shell extraction - #1665

Merged
BigSimmo merged 8 commits into
mainfrom
cursor/viewer-phase1-shell-extract-1db8
Aug 7, 2026
Merged

refactor(viewer): Phase 1 DocumentViewer shell extraction#1665
BigSimmo merged 8 commits into
mainfrom
cursor/viewer-phase1-shell-extract-1db8

Conversation

@BigSimmo

Copy link
Copy Markdown
Owner

Summary

  • Phase 1 of the PDF/photo viewer redesign: behaviour-preserving extraction of the DocumentViewer shell (~1677 → ~1470 LOC).
  • New modules under src/components/document-viewer/:
    • signed-url-request.ts — shared signed-URL GET + rowsById
    • pdf-readers-lazy.tsx — real next/dynamic boundary for canvas/native PDF readers
    • use-document-viewer-route.ts — page/chunk URL sync without remount
    • use-pdf-viewer-preference.ts — canvas vs native localStorage preference
    • use-document-summarize.ts/api/answer/stream summaryMode controller
  • Clarifies document-viewer-lazy.tsx as an RSC compatibility re-export (not code-splitting); PDF split lives in pdf-readers-lazy.tsx.
  • Updates lazy/perf contract tests to follow the new ownership.

Verification

  • Focused vitest (viewer shell/lazy/perf/frame): 34 passed
  • npm run test5447 passed | 1 skipped (515 files)
  • npm run verify:pr-local -- --files <phase1 paths> — exit 0 (format, docs guards, lint, typecheck, full unit suite, build, client-bundle scan, RAG fixtures)
  • Note: one earlier PR-local attempt hit a 30s timeout flake in design-system-adoption hosted-Linux provenance; isolated re-run passed; subsequent full verify:pr-local was green
  • UI verification not run: no phone-chrome ownership, composer, or visual behaviour change — extraction only. verify:phone-chrome not required for this phase.
  • Release verification not run: not a release handoff

Risk and rollout

  • Risk: Clinical document surface refactor (auth-clear, signed URLs, summarize stream moved into hooks). Intended behaviour unchanged.
  • Rollback: Revert the branch commit.
  • Provider or production effects: None

Clinical Governance Preflight

  • Source-backed claims still require linked source verification before clinical use
  • No patient-identifiable document workflow was introduced or expanded without explicit governance approval
  • Supabase target remains Clinical KB Database (sjrfecxgysukkwxsowpy)
  • Service-role keys and private document access remain server-only
  • Demo/synthetic content remains clearly separated from real clinical sources
  • Source metadata, review status, and outdated/unknown-source behavior remain conservative
  • Deployment classification/TGA SaMD impact was checked when clinical decision-support behavior changed — no CDS behaviour change; shell extraction only. Summarize still posts summaryMode: true to /api/answer/stream with the same abort/auth-epoch semantics.

Notes

  • Detail load machine and composer chrome remain in DocumentViewer.tsx for a follow-up extraction if needed.
  • Next programme step: Phase 2 unified DocumentFrame / photo chrome (after Phase 0 lands if not already).
  • Flightplan evidence: .local/workflow-evidence/2026-08-06T18-02-00-331Z-flightplan.json
Open in WebOpen in Cursor

Move signed-URL helpers, PDF reader dynamic imports, route sync, PDF
mode preference, and summarize stream into focused document-viewer
modules without changing preview/chrome behaviour. Clarify that
document-viewer-lazy is a re-export; pdf-readers-lazy owns the split.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@coderabbitai

coderabbitaiBot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in:33 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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c7817a85-e4a3-4b89-b20b-77b155b9c0de

📥 Commits

Reviewing files that changed from the base of the PR and between 7d3e626 and 5e3aef4.

📒 Files selected for processing (9)
  • src/components/DocumentViewer.tsx
  • src/components/document-viewer-lazy.tsx
  • src/components/document-viewer/pdf-readers-lazy.tsx
  • src/components/document-viewer/signed-url-request.ts
  • src/components/document-viewer/use-document-summarize.ts
  • src/components/document-viewer/use-document-viewer-route.ts
  • src/components/document-viewer/use-pdf-viewer-preference.ts
  • tests/document-detail-performance.test.ts
  • tests/document-viewer-pdf-reader-lazy.test.ts

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

@supabase

supabaseBot commented Aug 6, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project sjrfecxgysukkwxsowpy because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@BigSimmo
BigSimmo marked this pull request as ready for review August 6, 2026 18:17
@BigSimmo
BigSimmo enabled auto-merge (squash) August 6, 2026 18:17
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

cursoragentand others added 7 commits August 6, 2026 18:23
Empty commit to re-fire pull_request synchronize for the current tip
after stale/queued runs were cancelled during the Actions major outage.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Empty commit to fire pull_request synchronize after head had no Actions runs.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
@BigSimmo
BigSimmo merged commit bd46a39 into mainAug 7, 2026
25 checks passed
@BigSimmo
BigSimmo deleted the cursor/viewer-phase1-shell-extract-1db8 branch August 7, 2026 01:34
cursorBot pushed a commit that referenced this pull request Aug 7, 2026
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Sign up for freeto 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.

2 participants

@BigSimmo@cursoragent