Skip to content

Handle empty CSV exports in remote dataset cache#1481

Open
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:fix-empty-csv-cache-writes
Open

Handle empty CSV exports in remote dataset cache#1481
biefan wants to merge 1 commit intoAzure:mainfrom
biefan:fix-empty-csv-cache-writes

Conversation

@biefan
Copy link
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

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