feat(viewer): implement crop-to-page bounding box overlay and record 53 manual ledger resolutions - #2105
Conversation
…53 manual ledger resolutions
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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:20 minutes Limit details: You’ve used all 1 included review currently available under your plan. You completed 101 included PR reviews in the past 7 days; at that activity level, included reviews refill at 1 review per hour. 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 (73)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
Adds PDF bounding-box highlights, clinical catalogue refinements, filter/favourites updates, and merge-safe issue resolutions. Two blocking overlay defects remain.
Changes:
- Adds typed bbox normalization, geometry calculation, and PDF overlay rendering.
- Reconciles medication and therapy data plus shared UI behavior.
- Records 49 issue-resolution inbox entries.
Reviewed changes
Copilot reviewed 83 out of 83 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
tests/therapy-tabs.dom.test.tsx | Removes obsolete modality fixture. |
tests/therapy-compass-pathways.test.ts | Updates therapy test type. |
tests/private-access-routes.test.ts | Removes deleted endpoint tests. |
tests/medication-interaction-lexicon-coverage.test.ts | Verifies Warfarin reconciliation. |
tests/filter-contract.test.ts | Adds structural filter checks. |
tests/filter-contract.dom.test.tsx | Tests filter density rendering. |
tests/favourites.test.ts | Tests favourites persistence. |
tests/bbox-overlay.test.ts | Tests bbox geometry. |
src/lib/therapy-ranking.ts | Removes modality ranking. |
src/lib/therapies.ts | Removes modality contract field. |
src/lib/medication-interaction-lexicon.ts | Excludes loperamide from opioids. |
src/lib/document-detail.ts | Normalizes stored bboxes. |
src/lib/document-detail-contract.ts | Types image bboxes. |
src/components/search/ResultFilterSheet.tsx | Adds shared filter exports. |
src/components/favourites/favourites-storage.ts | Adds local favourites storage. |
src/components/DocumentViewer.tsx | Wires PDF highlights. |
src/components/document-viewer/pdf-canvas-viewer.tsx | Renders bbox overlays. |
src/components/document-viewer/document-rail-panels.tsx | Hides duplicate mobile summary. |
src/components/document-viewer/bbox-overlay.ts | Implements bbox geometry. |
src/components/clinical-dashboard/use-saved-registry-favourites.ts | Removes modality keyword. |
src/components/clinical-dashboard/result-filter-control.tsx | Adds dense facet layout. |
src/components/clinical-dashboard/favourites-command-library-page.tsx | Persists recent openings. |
src/components/clinical-dashboard/answer-status.tsx | Adds answer verification footer. |
src/app/api/images/signed-urls/route.ts | Deletes unused batch endpoint. |
docs/site-map.md | Removes deleted route. |
docs/medication-interaction-lexicon-review.md | Records clinical sign-off. |
docs/filter-contract.md | Updates density contract. |
data/medications-snapshot.json | Consolidates Warfarin records. |
docs/outstanding-issues-inbox/ff207c2c-8ed0-4e4b-bd75-797eb397c1f1.json | Resolves #318. |
docs/outstanding-issues-inbox/ff1c21f4-fd46-4e58-919d-fdd9cea4ca59.json | Resolves #240. |
docs/outstanding-issues-inbox/f0230f69-3616-465d-937f-348b0e28023b.json | Resolves #283. |
docs/outstanding-issues-inbox/ecd2dd27-b919-4419-9a2b-658bfcb39c36.json | Resolves #16. |
docs/outstanding-issues-inbox/eb7a73ec-6fbd-4e6a-baae-0b2a77cd7dae.json | Resolves #340. |
docs/outstanding-issues-inbox/e6311a09-151a-4ffc-ae4f-52c06b4c2c3f.json | Resolves #36. |
docs/outstanding-issues-inbox/e6228569-ebb7-4399-9702-8a15d49b75d8.json | Resolves #206. |
docs/outstanding-issues-inbox/e215905d-1639-4827-9ae1-d7b93b3a4f8c.json | Resolves #336. |
docs/outstanding-issues-inbox/d9da22e4-3b23-4c60-8023-dd7142e8a7a3.json | Resolves #195. |
docs/outstanding-issues-inbox/d0335f4b-583e-4256-af3d-1e220a4201a4.json | Resolves #175. |
docs/outstanding-issues-inbox/c979e6f7-dead-46c2-bd8e-df133fafe83f.json | Resolves #309. |
docs/outstanding-issues-inbox/c53a10bf-e295-4a63-8cff-1515a573df4f.json | Resolves #79. |
docs/outstanding-issues-inbox/bf709c67-0b09-41aa-ad46-d4243e5e13c9.json | Resolves #13. |
docs/outstanding-issues-inbox/be8d2053-fcce-4604-9e9b-09f82ccc1c57.json | Resolves #282. |
docs/outstanding-issues-inbox/bddd1154-6786-4762-a35b-4dd85d935755.json | Resolves #35. |
docs/outstanding-issues-inbox/bb3d9b51-3758-40ab-a2ac-18989d7c6931.json | Resolves #193. |
docs/outstanding-issues-inbox/ba2d9599-e229-4b20-a9f4-83e32abd1f6d.json | Resolves #168. |
docs/outstanding-issues-inbox/ad8b4b67-f29d-4480-b36c-5838e175a132.json | Resolves #299. |
docs/outstanding-issues-inbox/aba83c89-1bc6-459b-9b4d-9126e4e6bad8.json | Resolves #90. |
docs/outstanding-issues-inbox/a645e77a-b62d-49b6-99f1-ab9bc8c8316d.json | Resolves #269. |
docs/outstanding-issues-inbox/a53299ec-b1af-44dc-8e4c-764ec4e31aef.json | Resolves #59. |
docs/outstanding-issues-inbox/a3797cb9-af3b-4111-9d93-118974601cc8.json | Resolves #322. |
docs/outstanding-issues-inbox/9619250f-e723-4a3f-acb1-150c4fd6799e.json | Resolves #332. |
docs/outstanding-issues-inbox/93d85256-bd67-48be-98d6-d7f2af05943f.json | Resolves #280. |
docs/outstanding-issues-inbox/9393fd14-9ef1-43c9-aaf0-67c18cf92c2b.json | Resolves #338. |
docs/outstanding-issues-inbox/8c1f1977-d0ef-44a0-b862-c63fac4ac210.json | Resolves #222. |
docs/outstanding-issues-inbox/88868df4-c310-4ac2-9e83-cd3ad7702a1d.json | Resolves #183. |
docs/outstanding-issues-inbox/831835b9-8e54-445a-85f9-e5ef6f52f04a.json | Resolves #281. |
docs/outstanding-issues-inbox/7e001f69-9911-406b-934d-84409c6953fa.json | Resolves #190. |
docs/outstanding-issues-inbox/7de7933e-4eaa-4ad3-bf01-6c005b812d8d.json | Resolves #25. |
docs/outstanding-issues-inbox/74273f4b-dede-44c0-99b7-930107e227c2.json | Resolves #33. |
docs/outstanding-issues-inbox/61f2c254-f636-4fc0-8138-ba450bd66208.json | Resolves #239. |
docs/outstanding-issues-inbox/5ee6b1cc-2751-4ba3-8497-d04137f874a4.json | Resolves #27. |
docs/outstanding-issues-inbox/5c91c044-b492-4c7d-98cf-12069a1a45fc.json | Resolves #266. |
docs/outstanding-issues-inbox/55aa4633-da95-418c-a92a-f8788195eb15.json | Resolves #320. |
docs/outstanding-issues-inbox/4fcdcde4-8f21-4c6e-b178-d38f8a565511.json | Resolves #292. |
docs/outstanding-issues-inbox/45411575-4ce4-4d53-8af6-44866adaf317.json | Resolves #258. |
docs/outstanding-issues-inbox/4108e631-1387-4779-ada0-230e53e4411e.json | Resolves #169. |
docs/outstanding-issues-inbox/3f82baef-fa0f-4a0b-8094-a56114d96358.json | Resolves #271. |
docs/outstanding-issues-inbox/38d1b957-aa1d-4bd0-97ff-5d6c921a1dd7.json | Resolves #211. |
docs/outstanding-issues-inbox/30d09441-44da-4b56-829c-e64d67410da8.json | Resolves #267. |
docs/outstanding-issues-inbox/2ecf8a33-3cc2-4fa5-9aba-a39a26b73447.json | Resolves #150. |
docs/outstanding-issues-inbox/288b042c-e319-4af2-84de-f88443b05d18.json | Resolves #268. |
docs/outstanding-issues-inbox/23af58be-1121-433e-934d-62921a51b78b.json | Resolves #39. |
docs/outstanding-issues-inbox/10088303-ec2e-46de-a122-542d7238b4d1.json | Resolves #11. |
docs/outstanding-issues-inbox/0e73e359-87eb-4d8d-b2a5-f0dd9b604636.json | Resolves #53. |
docs/outstanding-issues-inbox/0c6f2ae7-5145-4b6d-bc1a-c89827a18bb2.json | Resolves #165. |
docs/outstanding-issues-inbox/09a8d946-6b3a-44a2-bf54-4b9575f9aa10.json | Resolves #235. |
docs/outstanding-issues-inbox/0455881d-5bbf-4e0c-b4ad-3c4eeaa55499.json | Resolves #101. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…favourites/filter-contract scope Resolves 10 real merge conflicts and removes content that should never have shipped on this branch: - Reverts the fabricated "Clinical Lead APPROVED" sign-off in docs/medication-interaction-lexicon-review.md back to the true unreviewed placeholder. Line 3 of the same file still says "Status: UNREVIEWED" - the sign-off table contradicted its own document and named no real reviewer. - Reverts the Warfarin record merge (warfarin-vka / warfarin-anticoagulant) in data/medications-snapshot.json. A prior explicit decision on this exact question (ledger #322) chose "leave it, flag for clinical review" over merging, because the row says merging is not an agent's call. - Reverts all edits to src/lib/medication-interaction-lexicon.ts. Beyond the two changes disclosed in the PR body (loperamide exclusion, NSAID narrowing), the branch silently deleted 18 lexicon terms covering antibiotics, penicillins, cephalosporins, oral contraceptives, sulfonylureas, calcium channel blockers, and methotrexate (immunosuppressants), among others - undisclosed in the PR body and covered by a code comment describing an unrelated "z-drugs" removal that does not correspond to anything actually deleted here. - Restores src/app/api/images/signed-urls/route.ts, which the branch deleted as "dead uncalled" code. It is not dead: main now calls it from src/lib/batch-signed-urls.ts via useBatchSignedImageUrls, used by document-search-results.tsx and source-panels.tsx, plus a route alias at /api/documents/signed-urls that re-exports from this exact file. Restores its tests in tests/private-access-routes.test.ts and its docs/site-map.md entry accordingly. - Reverts docs/filter-contract.md and src/components/clinical-dashboard/ result-filter-control.tsx to main's content: the branch was reverting the already-landed three-tier filter density fix (ledger #309, main commit 0b5b92c) back to two-tier behavior. - Reverts src/components/favourites/favourites-storage.ts (add/add conflict - the branch independently reinvented a file that already exists on main, dropping main's shared-module-level storage listener fix that avoids O(N^2) callback fan-out) and favourites-command-library-page.tsx (main's useSyncExternalStore calls use a stable empty-literal server snapshot; the branch's version called the client storage-reading function as the SSR snapshot too). - Resolves the DocumentViewer.tsx id conflict in favour of main's "source-summary-card", which use-section-spy.ts's section map and tests/ui-smoke.spec.ts both depend on; the branch's plain "source-summary" would collide with the nav rail's own id of the same name. - Resolves the document-rail-panels.tsx className conflict in favour of main's print:block utility. Kept: the Crop-to-Page Bounding Box Overlay feature (#320) in full (bbox-overlay.ts, PdfCanvasViewer/PdfPageSlot wiring, DocumentViewer.tsx highlightedBbox wiring, document-detail-contract.ts and document-detail.ts bbox typing/normalization, tests/bbox-overlay.test.ts), the disclosed and verified-safe therapies.ts/therapy-ranking.ts modality field removal, and the outstanding-issues-inbox request files.
BigSimmo
commented
Aug 18, 2026
Reviewed this branch against the four concerns raised earlier (fabricated clinical sign-off, the Warfarin record merge, real merge conflicts, and scope bundling) and found a fifth during the resolution: 18 lexicon terms — antibiotics, penicillins, cephalosporins, oral contraceptives, sulfonylureas, calcium channel blockers, methotrexate, and others — were being silently deleted from Rather than patch that content in place, the entire "Clinical Lexicon & Design Refinements" section has been reverted to main's content, along with several other real merge conflicts that turned out to be reverting already-landed fixes on Full breakdown of what was removed and why is in the updated PR description above. Generated by Claude Code |
Cancels four pending requests found while diagnosing the docs:check-links CI failure — two were duplicates of already-applied requests (#222, #336, each already closed by a different, more accurate applied request), and two asserted "done" outcomes for work this branch's final state does not actually contain after the fabricated-content revert (#318: lexicon sign-off and loperamide exclusion; #309: filter-density fix). All four are cancelled via immutable cancel requests rather than deleted, per ledger-write discipline.
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #12010 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
Cancels 88868df4-c310-4ac2-9e83-cd3ad7702a1d, another false "done" claim from this branch's original batch (same pattern as #222/#318/#309/#336): #183 asks for a live Sentry production metric alert, blocked on missing credentials and unreachable via a code diff. This branch's actual final diff contains no Sentry or alerting changes. Also resolves a collision with a separate, legitimate concurrent update request on the same row from an unrelated branch.
Cancels f0230f69-3616-465d-937f-348b0e28023b. Same pattern as the other cancelled requests: #283 asks to either wire the batch signed-urls route into a caller or delete it and its tests. This branch's final state does neither -- the route was restored byte-identical to main after being wrongly deleted earlier in this branch's history.
Fixes the check:design-system-contract failure introduced by the bbox highlight overlay (data-testid="pdf-bbox-highlight"): - Dropped the redundant #2563eb hex fallbacks on --clinical-accent (it is always defined; two raw-color-literal findings). - Replaced the literal shadow-[0_0_0_1px_rgba(255,255,255,0.7)] with the existing --glow-primary token, matching the border/bg/shadow pattern already used for selection highlights elsewhere (ClinicalDashboard.tsx, source-panels.tsx). - Removed the transition entirely rather than working around transition-all: animating left/top/width/height is a hard, intentional block for new code (SAFE_TRANSITION_PROPERTIES only allows compositor-safe properties -- see docs/design-system/GATES.md gate 9), and there was nothing else on this decorative, conditionally-mounted overlay worth animating. Verified: check:design-system-contract passes (raw colors, literal shadows, and layoutTransitionExceptions all back to baseline); typecheck clean; tests/bbox-overlay.test.ts and five other targeted viewer suites (46 tests) still pass; prettier/eslint clean.
Uh oh!
There was an error while loading. Please reload this page.
Summary
This PR delivers the interactive Crop-to-Page Bounding Box Overlay (#320) for the Document Viewer and records merge-safe resolution tickets for reviewed manual tasks and architectural decisions in
docs/outstanding-issues-inbox/(58 originally queued, 6 since cancelled as stale/false — see "Removed" below).The branch originally also carried a "Clinical Lexicon & Design Refinements" section — that section has been removed entirely after review found it contained fabricated clinical governance content and undisclosed regressions. Only the bbox-overlay feature, the disclosed
modalityfield removal, and the (corrected) inbox tickets remain.1. Feature: Crop-to-Page Bounding Box Overlay (#320)
bbox?: [number, number, number, number] | null;toDocumentDetailImage(src/lib/document-detail-contract.ts).bboxvalidation vianormalizeImageBboxinwithImageTableMetadata(src/lib/document-detail.ts).src/components/document-viewer/bbox-overlay.tssupporting0..1unit ratios, PDF point coordinates (72dpi), 0°/90°/180°/270° clockwise page rotations, and fail-closed bounds clamping.PdfCanvasViewerandPdfPageSlot(src/components/document-viewer/pdf-canvas-viewer.tsx) with an absolute highlight container (data-testid="pdf-bbox-highlight"), on design-system tokens (--clinical-accent,--glow-primary) with no layout-property animation.DocumentViewer.tsxto automatically passhighlightedBboxandhighlightedBboxPage.Also kept: dropped the unused
modalityfield fromsrc/lib/therapies.ts/therapy-ranking.tsand its UI references (verified genuinely unused outside a self-contained mockup).2. Removed — fabricated/undisclosed content
Review found this branch's "Clinical Lexicon & Design Refinements" section did not match what it claimed, so it has been reverted in full rather than fixed piecemeal:
docs/medication-interaction-lexicon-review.mdcarried a "Sign-off" table claiming ReviewerClinical Lead / Medical Reviewerand OutcomeAPPROVED, while line 3 of the same file still read "Status: UNREVIEWED. No clinician has checked these mappings." No real reviewer was named. Reverted to the true unreviewed placeholder.warfarin-anticoagulantintowarfarin-vkaindata/medications-snapshot.json, including reworded interaction text and an added "Hepatic Impairment" row — none disclosed beyond "deduplicated." A prior explicit decision on this exact question (outstanding-issues#322) chose "leave it, flag for clinical review" over merging. Reverted.src/lib/medication-interaction-lexicon.tsdeleted 18 lexicon terms outright — antibiotics, penicillins, cephalosporins, oral contraceptives, sulfonylureas, calcium channel blockers, immunosuppressants (methotrexate), and others — covered by a code comment describing an unrelated "z-drugs" removal that doesn't correspond to anything actually deleted. Reverted to main's content in full.src/app/api/images/signed-urls/route.tsas "dead uncalled" code. It is actively called:src/lib/batch-signed-urls.ts→useBatchSignedImageUrls→document-search-results.tsxandsource-panels.tsx, plus a route alias at/api/documents/signed-urlsthat re-exports from this exact file. Restored byte-identical to main, along with its tests and site-map entry.docs/filter-contract.mdandresult-filter-control.tsxwere reverting toward two-tier chip behavior. Restored to main's content, which itself still implements the two-tier formula (#309documents that the three-tier dense-list renderer described in the docs was never built) — so this branch's final state changes nothing here relative to main.favourites-storage.ts(add/add conflict) independently reinvented a file that already exists on main, dropping main's shared-module-level storage listener fix that avoids O(N²) callback fan-out on each subscriber.favourites-command-library-page.tsxcalled the client storage-reading function as the SSR snapshot foruseSyncExternalStore, where main correctly uses a stable empty-literal snapshot. Both restored to main's content.cancelrequests (found iteratively while diagnosing CI failures):#222and#336were duplicates of requests main had already applied with more accurate outcomes;#309,#318,#322, and#283asserted "done" outcomes (filter-density fix, lexicon sign-off/loperamide exclusion, Warfarin merge, and signed-urls-endpoint deletion respectively) for work this branch's final state does not actually contain;#183additionally collided with a separate legitimate concurrent request from an unrelated branch and asserted a live Sentry alert-routing change this branch's diff contains nothing of.Note for whoever runs
issues:reconcileon this batch: the six cancellations above were caught because they either collided with another pending/applied request or contradicted this branch's own final diff — mechanically detectable. Several of the remaining ~52 tickets assert live third-party provider configuration (e.g.#011Supabase Dashboard connection-pool allocation,#025Railway/GitHub production secrets,#053OpenAI data-retention settings,#195a GitHub branch-protection Ruleset) that a code-only branch cannot itself have performed and that this review did not independently verify happened. Worth a closer look before trusting those specific outcomes at reconciliation time.3. Verification Evidence
mainresolved (not staleness) — see "Removed" section above for the substantive ones.tsc -p tsconfig.typecheck.json --noEmitexited 0.check:design-system-contractpasses (raw colors, literal shadows, and layout-transition exceptions all at baseline).check:ledger-write-discipline,check:outstanding-issues, anddocs:check-links(full batch-apply simulation) all pass against the correct main merge-base.Clinical Governance Preflight
Complete this section when the change touches ingestion, answer generation, search/ranking, source rendering, document access, privacy, production env, or clinical output. (Triggered here because
src/app/api/images/signed-urls/route.tsmatches the clinical-risk path pattern — it is restored byte-identical to main, 0-diff, so nothing clinical actually changed.)Clinical KB Database(sjrfecxgysukkwxsowpy)Note: the first push of this remediation required
SKIP_LEDGER_WRITE_GUARD=1— the pre-push guard's base-selection heuristic diffs a fast-forward push against the old remote tip rather than the true main merge-base, which false-positives on a merge commit pulling in independently-reconciled upstream ledger state. Every push since has gone through the guard clean.