Skip to content

fix(tier3): read evaluation datasets as UTF-8 - #355

Merged
rng1995 merged 4 commits into
NVIDIA:mainfrom
YMuskrat:codex/fix-dataset-utf8
Nov 7, 2026
Merged

rng1995 merged 4 commits into
NVIDIA:mainfrom
YMuskrat:codex/fix-dataset-utf8

Conversation

@YMuskrat

@YMuskrat YMuskrat commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Summary

UTF-8 evaluation datasets containing non-ASCII prompts or expected answers fail to load when Python uses an ASCII locale. The dataset generator writes UTF-8, but the shared JSON, JSONL and YAML readers use the host's default encoding.

Read all four supported formats explicitly as UTF-8. Preserve the exact authored text and continue rejecting invalid UTF-8. The regression tests run real child Python processes with LC_ALL=C, UTF-8 mode disabled and locale coercion disabled; all four Unicode cases raised UnicodeDecodeError before the fix.

Verification

  • Familiar with the contributing guidelines; commit includes DCO sign-off.
  • Added eight focused tests, including exact Unicode round trips and invalid-byte rejection.
  • 105 dataset, configuration and generation tests passed; the eight new tests also passed independent review.
  • Updated the user-visible changelog.
  • make lint passed.
  • make build produced the wheel and source distribution.
  • Ran make test with two workers and a first-failure limit: 824 passed, 2 skipped, 2 failed before stopping. Both failures also occur on unchanged upstream 55d8b8d: the GitLab template test cannot create its hard-coded /tmp directory in this sandbox, and the standalone provenance test returns no run_dir (cause not diagnosed). Full-suite success is not claimed.
  • No credentials, private datasets or proprietary benchmark content added.

The change and tests use Python 3.12 with the repository's locked all/dev dependencies. No live model requests were made.

Release Impact

  • Updated CHANGELOG.md.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed head 4df9e7ee against main 55d8b8d4. I found no issues.

  • The three path.open() calls in dataset_utils.py were the only Tier 3 dataset reads without an explicit encoding. The Harbor adapter, plugin-prepare and report readers already decode UTF-8, and the generator writes UTF-8.
  • The new subprocess test fails on main for all four suffixes ('ascii' codec can't decode byte 0xc3) and passes on this head. I ran it on macOS and in Linux python:3.12-slim and 3.13-slim containers. The locale assertion holds on both (US-ASCII and ANSI_X3.4-1968), and the subprocess takes about 0.2 s, so the 20 s timeout has plenty of room under coverage and xdist.
  • Invalid UTF-8 still raises UnicodeDecodeError for every suffix under any locale. BOM handling is unchanged from main and matches the sibling readers.
  • The new file and the related dataset suites pass with -n 4 (336 tests) and under --cov, and ruff check / ruff format --check are clean. The CHANGELOG entry is under Unreleased > Fixed.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at 4df9e7ee. See my earlier review for what I checked.

@chrisknvidia chrisknvidia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed. The fix is correct: _load_jsonl, _load_yaml and _load_json were the only dataset readers that relied on the locale encoding, and the subprocess test with LC_ALL=C, PYTHONUTF8=0 and PYTHONCOERCECLOCALE=0 really exercises the ASCII-locale path rather than inheriting UTF-8 mode from the test runner. Rejecting invalid UTF-8 instead of using errors="replace" is the right call for authored eval text.

Nothing blocking from me. CI has not run on this fork PR yet, so it still needs a maintainer to approve the workflow run before merge.

@chrisknvidia

Copy link
Copy Markdown
Collaborator

@YMuskrat thanks for this fix. I left a review above, and nothing in the diff needed an inline comment: the reader change and the subprocess locale test look correct. The only step left is a maintainer approving the CI workflow run on this fork PR.

@rng1995 rng1995 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving at f1eabafc. I merged main (e5c100a7) to resolve the CHANGELOG conflict from #371: the entry is now under Unreleased > Fixed. The code and tests are unchanged from 4df9e7ee, which I reviewed earlier.

@rng1995
rng1995 enabled auto-merge (squash) November 7, 2026 06:23
@rng1995
rng1995 merged commit 006d812 into NVIDIA:main Nov 7, 2026
22 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.

3 participants