Repository navigation
feat(csv-viewer): detect semicolon-separated CSVs - #19894
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe CSV delimiter detector now counts semicolons alongside commas and tabs. When semicolons exceed both, it checks up to eight records for consistent existing comma or tab columns. If the counts are consistent and semicolon counts vary, it retains the existing delimiter; otherwise, it selects semicolon. CsvViewer adds automatic and manual delimiter selection. Tests cover detection, parsing, and viewer selection behavior. Priority: ➖ Normal Merge Risk: 🔵 Low · up to Some comma-delimited files containing literal quotes can display incorrectly in Auto mode. Readers can select Comma manually, so this is a bounded issue that can be accepted for merge with a follow-up fix. Architecture SummaryArchitecture risk: 🟡 Medium · up to The change affects 1 system. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Reliability and maintainability
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
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.
✅ No new issues found.
Reviewed changes
Reviewed detectCsvDelimiter gaining a semicolon candidate and four new tests covering the sniffing behavior.
- Semicolon sniffing — adds a
semicolonscount and a branch returning;only when semicolons strictly beat commas and at least tie tabs, preserving comma as the RFC 4180 default and every prior tab/comma outcome for semicolon-free files. - Tests — four new cases: a semicolon export with comma decimals (asserting both delimiter and parsed rows), semicolons confined to quotes not winning, tab dominating semicolon, and the
.tsvshort-circuit.
The tie-break is deliberate and defensible: ; ties/beats tab because a semicolon export can carry tabs inside cells while a TSV rarely carries semicolons, and detection reads only the first non-empty line. I ran vitest run src/renderer/src/components/editor/csv-parse.test.ts locally — 19/19 pass — and the toBe(';') assertion is a genuine regression guard (it fails against the pre-PR implementation). The added pass is bounded by CSV_DELIMITER_SNIFF_SCAN_CODE_UNITS and uses index access, so the existing charCodeAt budget and no-split guarantees still hold.
DeepSeek Pro (free via Pullfrog for OSS) | 𝕏
|
up |
Spreadsheet apps running a comma-decimal locale export `;` as the list separator, so a large share of real-world CSVs are semicolon-separated. The viewer only sniffed tab vs comma, so those files rendered as a single column of raw text. Add semicolon as a third sniffing candidate. A candidate only wins when it strictly beats comma, so comma remains the RFC 4180 default on ties and for files with no delimiter at all, and existing tab/comma behaviour is unchanged. Semicolon is checked ahead of tab because a semicolon export can legitimately contain tabs inside cells, while a TSV rarely contains semicolons. The `.tsv` extension still short-circuits to tab. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01ByGxbX82uLxMRhKHUBxz8h
Require semicolons to strictly outnumber both commas and tabs on the bounded first non-empty line. Keep the existing precedence on ties and reuse quote-aware counting and the existing delimiter-parameterized parser. Cover decimal commas, quoted separators, escaped quotes, embedded newlines, BOM and leading blanks, extension overrides, ties and scan limits. Record the unavoidable ambiguity of comma headers containing unquoted semicolons. Adapted from Kevin Saliou (kbsali) in PR stablyai#19894; the preceding commit retains his original authorship and coauthor credit.
8d26d30 to
5bd8103
Compare
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the commits landed since pullfrog's previous review (8d26d30). The delta is the semicolon tie-break rework plus a substantially expanded test suite.
- Tab ties preserved —
detectCsvDelimiternow returns;only when semicolons strictly outnumber tabs (>was>=), so a first line where semicolons and tabs tie keeps the pre-PR tab choice; the strategy comment was condensed to match. - Precedence table — a new
it.eachcovers six comma/tab/semicolon combinations, includinga;b\tcpinned to\t, locking in the tab-tie behavior. - Edge coverage — added cases for escaped quotes inside a quoted field,
.TSVcase-insensitivity, BOM/leading whitespace-only lines, quoted separators with escaped quotes and embedded newlines, the ambiguous unquoted-semicolon header, and the first-line scan boundary.
I reran pnpm test src/renderer/src/components/editor/csv-parse.test.ts — 29/29 pass — and traced countDelimiterOutsideQuotes against the new tie cases by hand; the strict > comparison matches every table row. Reversing the earlier >= rationale is deliberate and documented in the PR body, and the tab-tie row is now a genuine regression guard for it.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
…/sweep-pr19894-semicolon-csv
Check a bounded sample before overriding an existing delimiter with semicolons. Keep the first-line choice when the sample remains ambiguous, and preserve TSV handling.
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:
fd56129f-92d6-49bf-89fa-e929ba4c7f04
📒 Files selected for processing (2)
src/renderer/src/components/editor/csv-parse.test.tssrc/renderer/src/components/editor/csv-parse.ts
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 6 remain after this review.
There was a problem hiding this comment.
ℹ️ No critical issues — minor suggestions inline.
Reviewed changes
Re-reviewed the two commits pushed since the prior pullfrog review (5bd8103): a behavior change to the semicolon tie-break plus substantially expanded coverage.
- Consistent-column corroboration — when semicolons strictly win the first line,
detectCsvDelimiternow scans up to eight logical records and keeps the existing comma/tab choice if those columns are consistent while semicolon counts vary, so a comma header carrying stray semicolons (notes;one;two,value) no longer flips the parse to;. - Tests — replaced the ambiguous-header expectation and added cases for consistent comma/tab columns, varying unquoted commas, a multiline quoted field, the 8-record corroboration cap, the scan boundary, and CRLF plus escaped quotes/quoted newline.
The two findings below are low-stakes; I ran the file (36/36 pass) and reproduced both against the checked-out branch.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Important
The new delimiter picker references five localization keys that are not declared in en.json, so this head fails the required localization checks.
Reviewed changes
Re-reviewed the commit pushed since pullfrog's prior review (96147a9): a manual delimiter picker layered on the existing semicolon detection.
- Delimiter picker — added
csv-delimiter-picker.tsx, aSelectover Auto / Comma / Semicolon / Tab that shows the currently detected delimiter in the Auto label. - Viewer state —
CsvViewernow holds the choice in local state and parses with either the detected or the explicitly chosen delimiter; a different file remounts (via the caller's existingkey={activeFile.id}) and resets to Auto. - Interaction tests — five happy-dom cases: ambiguous decimal data, quoted multiline records, a
.tsvforced to comma, choice persistence across a content refresh, and reset on file identity change.
I confirmed this commit leaves csv-parse.ts and parseCsv untouched, verified tc:web and the new test file pass, and reproduced the localization-gate failure locally. The two earlier inline threads remain open and unchanged, so they are not re-raised.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found — the prior localization blocker is resolved.
Reviewed changes
Re-reviewed the commit pushed since pullfrog's prior review (0100448): a catalog-only follow-up that declares the picker's English strings.
- English delimiter labels — added the five
delimiter*keys underauto.components.editor.CsvViewerinen.json, completing the labelscsv-delimiter-picker.tsxalready references and clearing the required localization check. - No code surface — the follow-up touches only
en.json; every picker, parser, and test byte is unchanged from0100448.
I confirmed pnpm run verify:localization-catalogs and pnpm run verify:localization-extraction both pass at this head, and oxfmt --check is clean on the file. The two earlier inline threads (hasConsistentExistingCsvColumns quote model, the non-falsifiable boundary case) remain open and were not touched by this follow-up, so they are not re-raised.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
Re-reviewed the commit pushed since pullfrog's prior review (b52dc5f): a fix that aligns the delimiter scanner's quote handling with parseCsv, plus the boundary coverage called out in the prior review.
- Scanner quote model —
hasConsistentExistingCsvColumnsnow tracksfieldIsEmptyand opens a quoted field only at field start, matchingparseCsv'sfield === ''rule, so a literal quote in an unquoted field (6" bolts) no longer hides later commas and records from corroboration. - Literal-quote coverage — a new
keeps literal quotes inside unquoted %j fieldscase asserts both the detected delimiter and the parsed rows for comma and tab; it fails when the quote rule is reverted to an unconditional toggle. - Boundary / EOF guards — the existing quoted-boundary case now seeds the unfinished record with a pre-quote comma (
plain,") so it is falsifiable, and two cases (partial unquoted record at the scan boundary, unfinished quoted record at EOF) were added. All three fail when the flush guard is dropped.
I ran the focused suite at this head — 45/45 pass — plus tc:web, and confirmed each new guard by mutation. Both earlier inline threads (scanner quote model, non-falsifiable boundary case) are addressed and resolved.
deepseek-v4.1-flash (free via Pullfrog for OSS) | 𝕏

ELI5
Semicolon-separated CSV files render as columns, and you can choose the separator when automatic detection guesses wrong. Decimal values such as
1,50stay in one cell.What Changed
The viewer offers Auto, Comma, Semicolon, and Tab in its footer. Auto shows the detected separator. An explicit choice bypasses detection and the
.tsvextension rule, using the existing parser and virtualized table.For ambiguous headerless data such as
1,50;coffee\n2,75;tea, Auto still guesses comma. Choosing Semicolon displays the decimal values and labels in separate columns. Quoted separators, escaped quotes, and multiline fields retain their values. The choice affects the view and leaves the file bytes intact. It stays selected through content refreshes while that viewer is mounted; a newly mounted file starts in Auto.The bounded consistency scanner now follows the parser's rule for opening a quoted field. A literal quote in
6" boltstherefore stays literal instead of hiding later commas and rows from detection. Five matching English labels are declared in the existing catalog.Why
Some text is valid under more than one separator, so automatic detection cannot always infer the author's intent. Keeping Auto as the default and offering an explicit choice resolves those cases through the existing Label and Select components. The consistency scanner uses the existing parser's quote rule and retains its existing record and scan limits.
Linked Issue
Context: #19893. This continues @kbsali's contribution in #19894.
Visual Proof
The delimiter choice menu is shown open below at current head
88b1915. It offers Auto, Comma, Semicolon and Tab. Auto displays the detected separator; selecting Semicolon explicitly overrides automatic detection. These fresh hidden Electron captures use the same file and viewport, with the three-column table unchanged behind the menu. The rendered check verifies all four choices and both checkmarks.Fresh hidden Electron screenshots on macOS, captured through Playwright CDP at the same 1280×800 viewport. Before uses main snapshot
8cd9751963b3046e8393f2007c9104a56a63fa84; after uses current88b19155af379d7f7c2370c5009bcf36b2fdc101. Both show the identicaleuropean-sales.csvfile bytes. The baseline displays one column containing semicolons; the current viewer automatically displays Product, Quantity and RevenueEUR as three columns.The following pair shows the new choice on the same final branch, rather than another pre-change baseline. For the unchanged
1,50;coffee\n2,75;teafile, Auto guesses Comma. Choosing Semicolon preserves1,50and2,75as complete cell values.Both fresh hidden-app tests passed with no retries. Each screenshot follows exact table assertions and two completed animation frames. File bytes, source and compiled output stayed unchanged; the two owned apps exited and disposable profiles were removed.
Earlier additional rendered cases remain available: quoted multiline values, comma override for a misnamed TSV, and literal quotes with Auto.
Testing
45 focused tests pass: 40 parser/detection controls and five actual viewer/selector tests. Literal-quote comma and tab cases fail before the scanner repair. Three private mutations independently demonstrate that the boundary/EOF tests catch unsafe partial-record corroboration.
The freshly rebuilt native rendered test passes all four file cases using the real virtualized table and keyboard-operated selector. It asserts exact headers/cells, switches back to Auto, checks that fixture files retain their exact bytes, and confirms every Electron window stays hidden.
Localization extraction, catalog validation, coverage, Node/CLI/renderer typechecks, lint, formatting, and changed-code quality pass. Validation uses existing installed tools directly with
ORCA_BACKGROUND_LAUNCH=1; native dependencies retain their bytes and modification times.Rerun focused tests:
AI Disclosure
Original contribution assisted by Claude Opus 5 via Claude Code, as disclosed by @kbsali. Follow-up adaptation and validation assisted by Codex.
Review
Independent review covered the selector, five catalog entries, and scanner repair at their exact committed versions. The original contribution and its author/coauthor metadata remain in the branch history. The earlier literal-quote and weak-boundary review findings are addressed by this follow-up.
Agent skill upstream boundary
Notes
Auto remains a guess for inherently ambiguous data. A manual choice lasts while the viewer remains mounted; it is not a persistent per-file preference. Existing first-row-as-header behavior remains. Native rendered validation covers macOS; Linux and Windows rendered checks were not run locally.
Required CI passes for the current head. All six feature files match the actual CI checkout. The preceding catalog failure was reproduced and repaired; earlier CI results remain historical.
Checklist