Skip to content

fix(export): make CSV null values consistent across export paths - #1176

Open
markankamaransheogarat-sys wants to merge 1 commit into
TabularisDB:mainfrom
markankamaransheogarat-sys:fix/consistent-csv-null-exports
Open

markankamaransheogarat-sys wants to merge 1 commit into
TabularisDB:mainfrom
markankamaransheogarat-sys:fix/consistent-csv-null-exports

Conversation

@markankamaransheogarat-sys

Copy link
Copy Markdown
Contributor

Problem

Fixes #1157. Previously, csvValue in src/utils/resultExport.ts exported null and undefined as an empty field (""), whereas value_to_csv_string in the streaming exporter (src-tauri/src/export/format.rs) emitted the sentinel NULL. As a result, exported CSV representations differed depending on whether file export was triggered through frontend loaded rows or the backend streaming path.

Changes

  1. Frontend csvValue Representation (src/utils/resultExport.ts):

    • Updated csvValue to emit NULL when value === null || value === undefined, aligning directly with src-tauri/src/export/format.rs (value_to_csv_string).
    • Retained empty string "" preservation, numbers (e.g. 0), booleans (e.g. false), objects, and quoting rules via csvField.
  2. Frontend Test Suite (tests/utils/resultExport.test.ts):

    • Updated existing loaded result rows CSV tests to assert NULL for null fields.
    • Added parity test verifying a fixture with null, empty string "", literal "NULL", 0, and false produces "c_null,c_empty,c_literal_null,c_zero,c_false\nNULL,,NULL,0,false".
  3. Backend Test Suite (src-tauri/src/export/tests.rs):

    • Added test csv_exports_null_empty_literal_zero_false_consistently asserting the identical fixture representation in the Rust streaming exporter.

Verification

  • pnpm typecheck (tsc --noEmit): passed with 0 errors.
  • pnpm lint: passed (ESLint and theme token check clean).
  • vitest run tests/utils/resultExport.test.ts: all 10 tests passed.
  • Parity verified across both frontend and backend streaming export paths.

Closes #1157

@kilo-code-bot

kilo-code-bot Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

The frontend csvValue now emits NULL for null/undefined, matching value_to_csv_string in src-tauri/src/export/format.rs. Empty strings, 0, false, and literal "NULL" strings are preserved identically on both paths. The updated and new tests on both sides assert the same fixture output. The only caller of formatResultForExport is src/pages/Editor.tsx, which needs no changes.

Files Reviewed (3 files)
  • src/utils/resultExport.ts
  • tests/utils/resultExport.test.ts
  • src-tauri/src/export/tests.rs

Reviewed by claude-sonnet-5.5 · Input: 252 · Output: 1.8K · Cached: 227.1K

Review guidance: REVIEW.md from base branch main

This branch has not been deployed

No deployments
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.

[Bug]: Make CSV null values consistent across export paths

1 participant