Skip to content

Tests: read the training API job bodies fixture as UTF-8 - #16025

Merged
danielhanchen merged 1 commit into
mainfrom
tests-snippet-contract-utf8
Oct 29, 2026
Merged

danielhanchen merged 1 commit into
mainfrom
tests-snippet-contract-utf8

Conversation

@danielhanchen

Copy link
Copy Markdown
Member

Repo tests (CPU, rest-2) is red on main since #15996 (Use via API button on the Train page). It now fails on unrelated PRs, for example #16024:

test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding[5]
AssertionError: 1 file reads in the test trees touch a checked-in file with the platform default encoding ...
  'studio/backend/tests/test_training_api_snippet_contract.py:19: read_text()'

The new snippet contract test reads its JSON fixture fixtures/training_api_job_bodies.json with read_text(). On Windows that decodes as cp1252, so the test breaks as soon as the fixture gains a non-ASCII byte. The guard is right and the test was wrong. The fix is read_text(encoding = "utf-8").

Verification

  • tests/test_source_read_encoding.py: fails on main (the one site above), 16 passed here.
  • studio/backend/tests/test_training_api_snippet_contract.py: 12 passed.

#15996's snippet contract read its JSON fixture with the platform default encoding, which
test_checked_in_file_reads_name_an_encoding refuses (rest-2 shard red on main).
@danielhanchen

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-29T18:57:50.620569Z cee066f Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: cee066fe73

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@danielhanchen
danielhanchen merged commit 61176d5 into main Oct 29, 2026
0 of 35 checks passed
@danielhanchen
danielhanchen deleted the tests-snippet-contract-utf8 branch October 29, 2026 19:05
danielhanchen added a commit that referenced this pull request Oct 30, 2026
…6123)

`Repo tests (CPU, rest-2)` is red on main since #16106 (prepare decision
datasets faster, in less memory, with row progress). It fails on
unrelated PRs, for example #16114:

```
tests/test_source_read_encoding.py::test_checked_in_file_reads_name_an_encoding[14]
AssertionError: 1 file reads in the test trees touch a checked-in file with the platform default encoding ...
  'studio/backend/tests/test_decision_dataset_prefetch.py:298: read_text()'
```

`_frontend_regex` reads
`studio/frontend/src/features/studio/preparation-progress.ts` with
`read_text()`. On Windows that decodes as cp1252 and breaks as soon as
the file gains a non-ASCII byte. The guard is right and the test was
wrong, so this adds `encoding = "utf-8"`. This is the same fix #16025
made for #15996.

## Verification

- `tests/test_source_read_encoding.py`: fails on main on the line above.
16 passed here.
- `studio/backend/tests/test_decision_dataset_prefetch.py`: 11 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.

1 participant