Skip to content

Accept a UTF-8 BOM in eval CSV manifests - #290

Open
codebanditssss wants to merge 1 commit into
AssemblyAI:mainfrom
codebanditssss:fix/eval-csv-bom
Open

codebanditssss wants to merge 1 commit into
AssemblyAI:mainfrom
codebanditssss:fix/eval-csv-bom

Conversation

@codebanditssss

Copy link
Copy Markdown

Fixes #288

Summary

assembly eval read CSV manifests as utf-8. When a file starts with a UTF-8 byte-order mark (as Excel's "CSV UTF-8" export writes), the first header becomes \ufeffaudio, so both column auto-detection and --audio-column audio fail with exit code 2.

This one-line change opens CSV manifests with encoding="utf-8-sig". That encoding strips a single leading BOM and otherwise decodes exactly like utf-8, so existing BOM-less manifests behave the same. JSONL loading is unchanged.

Tests

New tests/test_eval_csv_encoding.py covers every combination of:

  • with and without a BOM;
  • auto-detected columns and explicit --audio-column audio --text-column text;
  • LF and CRLF line endings.

Each case uses quoted headers and a quoted non-ASCII reference that contains a comma ("héllo, world"), plus a real WAV file. Each case checks two layers:

  • Loader: identical EvalItems.
  • Real Typer eval --json command with a fake transcription boundary: exit 0, exactly one transcription call for the local file, 2 words, 0 errors, WER 0.0, and no \ufeff in the output.

Before the fix, the 4 BOM cases fail (Could not find an audio column (columns: \ufeff"audio", text) or The dataset has no 'audio' column ...) and the 4 BOM-less cases pass. After the fix, all 8 pass. The tests/test_eval*.py suite passes (145 tests, including the new cases).

Validation

Linux (Fedora 44), Python 3.13.14:

  • The gate ran sequentially with TERM=xterm-256color and PYTEST_ADDOPTS=--timeout=180.
  • ./scripts/check.sh printed All checks passed.: 3782 tests passed, 99.51% branch coverage, diff-cover 100%. The mutation gate generated 0 mutants because the changed line contains only a string constant.
  • Locally unavailable and self-skipped: shellcheck, actionlint, gitleaks, swiftlint/swift and brew.
  • Public assembly console entry point, with a fake key and the SDK boundary stubbed: the BOM manifest now exits 0 with both auto-detected and explicit --audio-column audio, and each run makes one transcription-boundary call, the same as the BOM-less control. The literal \ufeffaudio column name is now rejected, because the real header is audio.

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.

Evaluation CSV cannot recognize a BOM-prefixed audio header

1 participant