Repository navigation
Keep large CSV previews responsive and add column resizing and links - #25381
Conversation
|
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
📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe change adds bounded filesystem reads and runtime range-read routing. It adds CSV parsing limits, byte indexing, and worker-based page loading. CSV and TSV files at least 1 MiB can use a read-only paged preview. The renderer displays preview data in a virtualized grid with column resizing, row navigation, and HTTP(S) link handling. The change also updates editor state and save behavior for preview-only files, and adds unit and end-to-end tests. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to This incremental change only touches end-to-end tests for the large CSV preview and link behavior. No actionable merge-blocking risk was identified in the supplied evidence. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
318b966e-50b5-4f85-b843-dc6d59d298d4
📒 Files selected for processing (48)
src/main/ipc/filesystem/filesystem-chunk-read-handler.tssrc/main/ipc/filesystem/filesystem-read-handlers.tssrc/main/ipc/filesystem/local-file-range-read.test.tssrc/main/ipc/filesystem/local-file-range-read.tssrc/main/runtime/orca-runtime-files-ssh-chunk-reads.test.tssrc/main/runtime/runtime-file-commands-read-file-explorer-preview.tssrc/preload/api/filesystem-api.tssrc/preload/api/fs-bridge.tssrc/renderer/src/components/editor/CsvCellValue.tsxsrc/renderer/src/components/editor/CsvColumnResizeHandle.tsxsrc/renderer/src/components/editor/CsvGrid.test.tsxsrc/renderer/src/components/editor/CsvGrid.tsxsrc/renderer/src/components/editor/CsvPagedViewer.tsxsrc/renderer/src/components/editor/CsvViewer.delimiter.test.tsxsrc/renderer/src/components/editor/CsvViewer.tsxsrc/renderer/src/components/editor/EditorEditFileSurface.tsxsrc/renderer/src/components/editor/EditorPanelHeader.tsxsrc/renderer/src/components/editor/csv-byte-index.test.tssrc/renderer/src/components/editor/csv-byte-index.tssrc/renderer/src/components/editor/csv-cell-links.test.tsxsrc/renderer/src/components/editor/csv-delimiter-detection.tssrc/renderer/src/components/editor/csv-link-routing.tssrc/renderer/src/components/editor/csv-paged-preview.test.tssrc/renderer/src/components/editor/csv-paged-preview.tssrc/renderer/src/components/editor/csv-parse-budget.test.tssrc/renderer/src/components/editor/csv-parse.tssrc/renderer/src/components/editor/csv-preview-save-safety.test.tssrc/renderer/src/components/editor/csv-preview-worker-client.tssrc/renderer/src/components/editor/csv-preview-worker-protocol.tssrc/renderer/src/components/editor/csv-preview.worker.tssrc/renderer/src/components/editor/editor-autosave.tssrc/renderer/src/components/editor/editor-csv-file-content.tssrc/renderer/src/components/editor/editor-lazy-views.tssrc/renderer/src/components/editor/editor-panel-content-types.tssrc/renderer/src/components/editor/editor-save-queue.tssrc/renderer/src/components/editor/useCsvPagedPreview.test.tsxsrc/renderer/src/components/editor/useCsvPagedPreview.tssrc/renderer/src/components/editor/useEditorPanelFileContentLoader.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/runtime/runtime-file-client-test-harness.tssrc/renderer/src/runtime/runtime-file-range-client.test.tssrc/renderer/src/runtime/runtime-file-range-client.tssrc/renderer/src/store/slices/editor/actions/editor-draft-state.tssrc/renderer/src/store/slices/editor/actions/open-file-mutations.tssrc/renderer/src/store/slices/editor/types/open-file.tssrc/renderer/src/web/preload-api/web-filesystem-api.tstests/e2e/csv-paged-preview.spec.tstests/e2e/csv-url-links.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — two minor suggestions inline.
Reviewed changes
- Paged large-CSV preview. CSVs ≥ 1 MiB are admitted as a renderer-only descriptor (
content: ''+CsvFilePreview) and rendered from a worker-built byte index with a bounded page cache, instead of loading the full text into the editable buffer. - Two-axis virtualization + resizing.
CsvGridvirtualizes rows and columns with TanStack Virtual, adds a 500k-row scroll window, and adds pointer/keyboard column resize/reset. - Whole-cell HTTP/HTTPS links.
CsvCellValue+csv-link-routingopen URLs through the existingopenHttpLinkowner-routing rules; executable/scheme-invalid values stay literal text. - Read-only save safety. Transient
csvPreviewOnlyguards drafts, dirty state, autosave, and the save queue; the loader partitions in-flight reads and refuses to pair a paged preview with an existing draft. - Chunked host reads. New
fs:readFileChunkIPC and sharedreadLocalFileRange; the runtime chunk path is refactored onto it; owner/access routing preserved for local, SSH, and paired hosts.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
ℹ️ The delta is clean; one prior finding remains open on the byte-index record-length threshold.
Reviewed changes (delta since 2cb954b)
- Dense sub-threshold CSVs render again.
CsvViewerreplacesmaxCells: 250_000withCSV_PAGED_PREVIEW_BYTES + 1, which covers the worst case for a file strictly under 1 MiB; regression unit test and a 600k-row e2e added. - Bounded page cache.
CsvPagedPreviewbounds the cache by 64 pages, 512 Ki cells, and 8 MiB of raw bytes, and adds a batchedrows()loader that stats once before/after the viewport and aborts after the current page when abandoned;useCsvPagedPreviewdelegates to it. - Row-window shrink recovery.
CsvGridclamps the requestedwindowStartagainst the currentrowCount, so a refresh that shrinks the file returns to row 0. - Shared page-cell limit.
CSV_PAGE_CELLSis exported and used by both the index and the worker parser.
ℹ️ Record-length parity at the 1 MiB CRLF/BOM boundary is still open
The previous review flagged that CsvByteIndex.emitRow measures a record's span including its terminator (and the BOM on row 0), so a CRLF row with exactly CSV_RECORD_BYTES - 1 content bytes is rejected by the index while parseCsv accepts it. The new commit does not change that accounting, so the thread below is still open and is the reason this review is not an approval. It is a one-byte, error-path-only gap — not a page-boundary mismatch.
Technical details
# CRLF/BOM record length counts the terminator
## Affected sites
- `src/renderer/src/components/editor/csv-byte-index.ts:82` — `end - this.rowStart > CSV_RECORD_BYTES` includes the CRLF (and BOM) bytes.
- `src/renderer/src/components/editor/csv-byte-index.ts:107` — pending-CR path passes `at + 1` (LF offset + 1).
- `src/renderer/src/components/editor/csv-byte-index.ts:56-60` — `consumePrefix` skips BOM bytes without moving `rowStart`.
- `src/renderer/src/components/editor/csv-parse.ts:48` / `:85-90` — parser measures `end - recordStart` with the CRLF already coalesced, so content only.
## Required outcome
- The byte index and `parseCsv` should agree on the maximum accepted record length, or the gap should be pinned by a test so it is intentional.
## Suggested approach (optional)
- Measure the terminator-exclusive span (pass the CR/LF index rather than LF+1), or add CRLF/BOM-at-limit samples to `csv-byte-index.test.ts` and document the boundary.Existing thread: #25381 (comment)
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Repository UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
4891e91a-cc5a-4294-9f62-95b6ffd0dc70
📒 Files selected for processing (7)
src/renderer/src/components/editor/csv-byte-index.test.tssrc/renderer/src/components/editor/csv-byte-index.tssrc/renderer/src/components/editor/csv-paged-preview.test.tssrc/renderer/src/components/editor/csv-paged-preview.tssrc/renderer/src/components/editor/csv-parse-budget.test.tssrc/renderer/src/components/editor/csv-parse.tstests/e2e/csv-paged-preview.spec.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.
There was a problem hiding this comment.
✅ No new issues found. The prior record-length parity finding is fixed in
7ef9196; the delta is correct and well tested.
Reviewed changes (delta since e81075d)
- Aligned record-length limits across parser and byte index.
CsvByteIndex.emitRownow takes a terminator-exclusivecontentEndandconsume/finish/consumePrefixpass it, so a lone CR, the CR of a CRLF, and a leading BOM no longer count toward the 1 MiB record limit;parseCsv's limit check skips a terminating CR/LF unless it is inside quotes. The two now agree at the boundary, which closes the prior open finding. - Bounded the page-span validation. Added
CSV_MAX_PAGE_BYTES = CSV_RECORD_BYTES + 5(BOM + max content + CRLF) and switchedCsvPagedPreview.read's range guard fromCSV_RECORD_BYTESto it; theemitRowpre-check isolates an over-length row into its own page, so+5is the true page-span ceiling. - Pinned the behavior with tests. A table-driven
csv-byte-index.test.tscase covers both BOMs × four line endings × three at-limit record shapes and asserts index/parser parity plus rejection one byte over;csv-parse-budget.test.tscovers quoted newlines;csv-paged-preview.test.tsreads a max-size BOM+CRLF record in 256 KiB chunks; a new hidden e2e test opens a 1 MiB record with BOM/CRLF and checks the tail row. All 35 focused unit tests pass locally.
I traced the parity paths for lone CR at EOF, CRLF after a closing quote, embedded newlines inside quotes, and escaped quotes; index and parser agree in each. All prior Pullfrog threads on this PR are resolved.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found. The one commit since the prior review is a test-only change, and it is correct.
Reviewed changes (delta since 7ef9196)
- Guarded the CSV e2e visibility assertions by run mode.
csv-paged-preview.spec.tsandcsv-url-links.spec.tsnow run theirisVisible() === falsechecks only whenORCA_E2E_FORCE_HEADFUL !== '1'andtestInfo.project.metadata.orcaHeadful !== true, so an explicit headful/forced-headful run no longer fails these specs while still asserting hidden windows in the default headless project.testInfois in scope in every guarded test, and the guard matches the establishedpdf-find-counter.spec.ts:98/terminal-split-activation-latency.spec.ts:588pattern.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
Large or wide CSVs can exhaust memory because Orca loads and parses the whole file and renders every column. This change loads large CSVs in bounded chunks, renders only visible rows and columns, and adds column resizing and clickable web links.
What Changed
Why
Changing parsers alone still retains the full cell matrix. Paging bounds retained data, while column virtualization also bounds the DOM for wide files. CSV keeps its own plain-text grid because the Markdown table operates on rich-document positions and transactions. No new dependency is added.
Linked Issue
Related to #12915: implements column resizing; leaves the issue open for direct editing and the other requested table operations.
Visual Proof
Same 48-row × 1,024-column fixture in hidden Electron. Before renders the viewer from
8ff6ec9fb1cd; after renders this implementation, with Description resized to 400 px and URLs navigable. The capture checks that the old viewer mounts all 1,024 columns and the new viewer mounts fewer than 40.Before
After
Large-file and horizontal-scroll proof
Final row of a 1,900,100-row CSV:
Final column of a 2,048-column CSV:
Recovery after a dense file shrinks while its later row window is selected:
Testing
On macOS, 253 focused tests passed across 21 suites; one existing test was skipped.
pnpm tc,pnpm run check:code-quality:changed, localization catalog/extraction checks, and the Electron E2E build passed.All four hidden Electron E2E tests passed:
csv-paged-preview.spec.tsverifies final-row/column access, pointer/keyboard resizing, bounded DOM/heap, blocked saves, and a maximum-size first record with a BOM and CRLF;csv-url-links.spec.tsverifies click and Enter navigation in small and paged previews, a dense 600,000-row CSV under 1 MiB, and recovery when a later row window shrinks to three rows. All test windows remained hidden.The 117 MiB / 1,900,100-row fixture indexed in 4.98 seconds and increased renderer heap by 8.24 MiB after scrolling to the last row. The wide fixture mounted 48 rows and 16 columns. Heap measurement excludes worker memory and total process RSS.
Owner-routing tests cover SSH, paired hosts, folder workspaces, changed/unsupported hosts, and local file-access propagation. Live SSH, Linux, and Windows were not tested locally.
Review
Adversarial review reproduced and fixed the inline findings: dense sub-threshold files remain viewable, a wide viewport no longer evicts itself from the page cache, and record limits exclude the initial BOM and line terminators consistently in the index and parser. Bounded page reads include the BOM and terminator overhead. The cache is bounded independently by 512 Ki cells, 8 MiB of raw page bytes, and 64 pages. Viewport loads check the file snapshot once before and after the batch; abandoned loads stop after their current page. Also fixed shrinking-file row-window recovery, shared the scanner/parser page-cell limit, and verified user-resized widths survive estimate changes. Regression tests cover each case.
Reviewed parser compatibility, worker cancellation, stale file detection, draft/save safety, host ownership, and library sizing/event behavior. Rebased onto main and preserved its file-access rules.
Agent skill upstream boundary
Notes
Large previews are read-only. Indexing scans the file once before showing the table, including remote transfers. Safety limits reject records above 1 MiB or files above 4,096 columns. Column widths last for the mounted grid and reset on remount. Only whole-cell HTTP/HTTPS URLs are linked.
Checklist