Retain table-crops for document view, surface table-quality warnings, add aspect-ratio support and formatting-audit script#1129
Conversation
|
Warning Review limit reached
Next review available in: 30 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. 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 Plus Run ID: 📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThe change adds crop-quality metadata, preserves selected uncaptured images for document viewing, exposes quality fields through document-detail contracts, and updates the viewer with warnings, aspect-ratio rendering, and low-confidence table fallbacks. A formatting-fixture audit command and related tests are also added. ChangesFormatting quality handling
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant PDFExtractor
participant CaptionWorker
participant DocumentDetailLoader
participant DocumentImage
PDFExtractor->>CaptionWorker: crop metadata and image classification
CaptionWorker->>DocumentDetailLoader: retained image and quality fields
DocumentDetailLoader->>DocumentImage: mapped image metadata
DocumentImage->>DocumentImage: calculate warnings and display order
DocumentImage->>DocumentImage: render source image or accessible table fallback
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49fdf1da59
ℹ️ 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".
|
@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. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49fdf1da59
ℹ️ 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".
CI triageCI failed on this PR. Automated classification of the 2 failed job(s):
Compared with main CI run #4650 (success). Classification is evidence routing, not permission to ignore a failure. Exact quarantined Playwright identities remain governed by the flake ledger. |
…ting-issues-in-tables-and-images Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Persist retainForDocumentView / audit table crops on document_images for the viewer, but only push searchable rows into insertedImages so they do not feed buildChunks, table-fact extraction, or embedding-field writes. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/document-viewer/source-panels.tsx (1)
287-295: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winDo not provide the fallback for every table.
AccessibleTabletreats anylowConfidenceFallbackas the replacement branch (as its new DOM test confirms), but this always passesimageBlock. Consequently, even high-confidence structured tables render no table; on the table-first path, the fallback image is also duplicated inside “Show original table image.”Gate this prop on an explicit low-confidence condition and ensure exactly one layer owns the source-image fallback.
🤖 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 287 - 295, Update the AccessibleTable usage in the source-panels component so lowConfidenceFallback is provided only when the image/table has an explicit low-confidence status. Preserve structured table rendering for high-confidence tables, and ensure the source-image fallback is owned by exactly one rendering layer without duplication on the table-first path.
🤖 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 `@scripts/audit-formatting-fixtures.ts`:
- Around line 39-41: Update the table_crop validation around sourceKind and
meta.table_rows so supported image-only fallback records emit a warning rather
than a failing audit result; only fail when metadata indicates structured rows
were expected, using the existing expectation metadata or an explicit
extraction-status field. Add a passing fixture covering the intentional
image-only table_crop case.
In `@src/components/clinical-dashboard/signed-image.tsx`:
- Around line 128-136: The signed-image error branch around the failed request
return (Lines 97-104) still applies the fixed aspect-[4/3] fallback instead of
the validated aspectRatio. Reuse the same validated/clamped aspect-ratio style
and fallback-class condition used by the main frame, and update the DOM test to
verify the supplied ratio remains applied when the signed-image request fails.
In `@worker/main.ts`:
- Around line 1115-1123: Update the re-enrichment flow used by
scripts/enrich-documents.ts to persist and consume a canonical top-level
skip/retention state, preserving retained_for_document_view for diagram_crop and
page_region as well as audit tables. Ensure retained view-only images remain
non-searchable and excluded from insertedImages/enrichment indexing, and add a
regression test covering this behavior.
---
Outside diff comments:
In `@src/components/document-viewer/source-panels.tsx`:
- Around line 287-295: Update the AccessibleTable usage in the source-panels
component so lowConfidenceFallback is provided only when the image/table has an
explicit low-confidence status. Preserve structured table rendering for
high-confidence tables, and ensure the source-image fallback is owned by exactly
one rendering layer without duplication on the table-first path.
🪄 Autofix (Beta)
✅ Autofix completed
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: b30f7095-744f-4d03-ab0c-0f1004784b48
📒 Files selected for processing (14)
package.jsonscripts/audit-formatting-fixtures.tssrc/components/clinical-dashboard/signed-image.tsxsrc/components/document-viewer/source-panels.tsxsrc/components/document-viewer/types.tssrc/lib/document-detail-contract.tssrc/lib/document-detail.tstests/accessible-table.dom.test.tsxtests/document-detail-performance.test.tstests/formatting-fixture-audit.test.tstests/signed-image.dom.test.tsxworker/main.tsworker/python/extract_pdf_assets.pyworker/python/test_extract_pdf_assets_budget.py
|
Note Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it. Fixes Applied SuccessfullyFixed 5 file(s) based on 3 unresolved review comments. Files modified:
Commit: The changes have been pushed to the Time taken: |
Fixed 5 file(s) based on 3 unresolved review comments. Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59e9b7d340
ℹ️ 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".
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
|
@cursoragent please fix failing CI testing |
|
CI on #1129 is green ( What was failing:
What I fixed:
Local checks: focused Vitest (formatting audit + signed-image) and ESLint on the touched files passed. Head is |
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
…-in-tables-and-images' into HEAD Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Unblocks Static PR checks format:check on the retained-for-view re-enrichment gate.
…-in-tables-and-images' into codex/identify-formatting-issues-in-tables-and-images
Unblocks the PR policy gate for this clinical-risk PR; remove the template after merge.
The prior policy run evaluated the pre-sync description; body now includes checked Clinical Governance Preflight.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9a1b1f989f
ℹ️ 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".
Clears the @typescript-eslint/no-unused-vars warning that failed Static PR checks under --max-warnings 0.
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>
|
Closed as safely deferred, not discarded. The 19-file patch expands crop/image retention, geometry, storage and time behavior without a real current-main malformed-asset fixture. The required next step is now durably recorded as #76 in |
* test(pdf): red repro for page-edge table crop truncation (#76) Add a minimal authorised synthetic fixture and deliberately-red Python/Vitest contracts that name the failing pymupdf_find_tables stage and expected clip geometry before any retention/padding change from PR #1129. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * fix(pdf): retain on-page remnant for page-edge table crops (#76) Extend find_tables candidates using contiguous cell drawings so straddling final rows are cropped to the page edge, recover structured remnant text when possible, and emit an incompleteness warning when content continues past the page. Flip the #76 red contracts green and archive the ledger item. Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * docs: record PR #1176 page-edge crop review in branch ledger Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * docs: supersede #1176 review ledger row for merged tip Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com> * fix(ci): format PDF crop follow-up * docs: record PR 1176 maintenance --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: BigSimmo <BigSimmo@users.noreply.github.com>


Summary
RAG impact: no retrieval behaviour change — ingestion retention and document-viewer presentation only; no ranking/retrieval comparator, selection, or search-order edits.
Verification
npm run format:check(after Prettier fix onscripts/enrich-documents.ts)Risk and rollout
Clinical Governance Preflight
Clinical KB Database(sjrfecxgysukkwxsowpy)Notes
scripts/enrich-documents.tsand missing Clinical Governance Preflight section in the PR body.PR_POLICY_BODY.mdafter merge so Sync PR policy body does not leave a stale template onmain.