Skip to content

Handle empty CSV exports in remote dataset cache#1481

Merged
romanlutz merged 3 commits intomicrosoft:mainfrom
biefan:fix-empty-csv-cache-writes
Apr 12, 2026
Merged

Handle empty CSV exports in remote dataset cache#1481
romanlutz merged 3 commits intomicrosoft:mainfrom
biefan:fix-empty-csv-cache-writes

Conversation

@biefan
Copy link
Copy Markdown
Contributor

@biefan biefan commented Mar 16, 2026

Summary

  • allow empty example lists to be written through the CSV cache/export helper
  • add a regression test covering _RemoteDatasetLoader._write_cache(..., file_type="csv") with no rows

Problem

_RemoteDatasetLoader routes CSV cache writes through pyrit.common.csv_helper.write_csv(). That helper currently assumes examples[0] exists, so exporting or caching an empty CSV-backed dataset raises IndexError instead of producing an empty file like the JSON, JSONL, and TXT helpers already do.

Testing

  • .venv/bin/pytest tests/unit/datasets/test_remote_dataset_loader.py -q

romanlutz and others added 2 commits April 11, 2026 17:16
…_csv tests

- Add round-trip read_cache assertion to verify empty CSV can be read back as []
- Add dedicated test_csv_helper.py with direct unit tests for write_csv

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@romanlutz romanlutz merged commit df331d7 into microsoft:main Apr 12, 2026
38 checks passed
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.

2 participants