Skip to content

fix(frontend/csvParser): accept single-column CSVs without a detectable delimiter#2

Merged
dimknaf merged 1 commit into
masterfrom
fix/single-column-csv-parsing
May 8, 2026
Merged

fix(frontend/csvParser): accept single-column CSVs without a detectable delimiter#2
dimknaf merged 1 commit into
masterfrom
fix/single-column-csv-parsing

Conversation

@dimknaf
Copy link
Copy Markdown
Owner

@dimknaf dimknaf commented May 8, 2026

Summary

A valid single-column CSV (no , \t | ; anywhere in the sample) was being rejected at upload with the alert "Error parsing CSV file. Please ensure it is a valid CSV." even though the data parsed correctly. This filters out PapaParse's informational UndetectableDelimiter warning before deciding whether to reject, so single-column CSVs work as expected.

Changes

  • frontend/lib/csvParser.ts — filter {type: 'Delimiter', code: 'UndetectableDelimiter'} out of the error array before the reject check. All other PapaParse error codes (MissingQuotes, TooManyFields, InvalidQuotes, etc.) remain fatal and continue to surface to the user.
  • frontend/__tests__/csvParser.test.ts — add a regression test mirroring a real failing file: header + values, CRLF line endings, no delimiter characters anywhere. The test fails on master and passes with the filter applied.

Test plan

  • cd frontend && npm run lint
  • cd frontend && npm run test — 41 passed (was 40; +1 new single-column test)
  • cd backend && pytest tests/ -v — 56 passed (no regressions; backend untouched)
  • Manual: uploaded a single-column CSV (Symbol header + 33 tickers) end-to-end via docker-compose -f docker-compose.local.yml up --build; column tag and data preview render, no alert.

Versioning

  • No version bump (bug fix; no API or behavior change for consumers beyond accepting previously-rejected valid input)

Breaking changes

None. Multi-column CSVs are unaffected; only previously-rejected single-column CSVs now succeed.

…le delimiter

PapaParse appends a `Delimiter / UndetectableDelimiter` warning to
`results.errors` when the sample contains none of `,` `\t` `|` `;` (e.g.
a single-column CSV). The data still parses correctly using the default
`,` fallback, so the warning is informational. `parseCSV` was rejecting
on any non-empty `results.errors`, so a valid single-column CSV produced
the alert "Error parsing CSV file. Please ensure it is a valid CSV."

Filter that specific `{type, code}` pair out of the error array before
deciding whether to reject. All other PapaParse error codes
(`MissingQuotes`, `TooManyFields`, etc.) remain fatal.

Adds a unit test mirroring a real failing CSV (header + tickers, CRLF,
no delimiter chars). It fails on master, passes with the filter applied.
@dimknaf dimknaf merged commit 77be7ca into master May 8, 2026
2 checks passed
@dimknaf dimknaf deleted the fix/single-column-csv-parsing branch May 8, 2026 14:08
Sign up for free to 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.

1 participant