Skip to content

Use UTF-8 when reading Bedrock test fixtures - #3530

Merged
marcuswood-oai merged 2 commits into
openai:mainfrom
GhravenLabs:fix/bedrock-fixtures-utf8
Oct 23, 2026
Merged

marcuswood-oai merged 2 commits into
openai:mainfrom
GhravenLabs:fix/bedrock-fixtures-utf8

Conversation

@Ghraven

@Ghraven Ghraven commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Read Bedrock JSON/JSONL fixture files with encoding="utf-8" instead of the platform default encoding.
  • Keep the opt-in Bedrock live env-file reader deterministic across developer machines.

Problem

These test fixtures and optional live-test env files are text inputs with repo-controlled formats, but Path.read_text() defaults to the host locale. On Windows or other non-UTF-8 locales, that can make the Bedrock tests less portable than they need to be.

Before / After

Before: Bedrock fixture loading depended on the platform default text encoding.

After: the fixture and env-file readers explicitly decode as UTF-8.

Verification

  • python -m py_compile tests/lib/test_bedrock_auth_conformance.py tests/lib/bedrock_live.py
  • uv run --with pytest --with pytest-asyncio --with pytest-xdist --with jsonschema --with respx --with botocore python -m pytest -q tests/lib/test_bedrock_auth_conformance.py (20 passed)

@Ghraven
Ghraven requested a review from a team as a code owner July 23, 2026 04:28

@ting-hong-shieh ting-hong-shieh left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Reviewed base e67afa88, head ba3c6562, and clean synthetic merge 63c91cde with current main d9029e3a.

Using the same UTF-8 env file (# café plus an ASCII assignment) in a real LC_ALL=C, UTF-8-mode-disabled subprocess:

base:               {"exception": "UnicodeDecodeError", "status": "error"}
head:               {"status": "ok", "value": "ok"}
current-main merge: {"status": "ok", "value": "ok"}

The 20 Bedrock auth conformance tests pass on both the exact head and current-main merge. Ruff lint/format, py_compile, and git diff --check also pass for the two touched files. No AWS or OpenAI API call, credentials, or external runtime service was used. I did not find a blocking issue.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 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-23T23:26:04.607262Z 68227be New commits
ℹ️ 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.

Copy link
Copy Markdown
Contributor

Thanks for the fix! Explicit UTF-8 makes sense for these files. I checked the patch against current main, and the Bedrock conformance tests pass. Looks good to me as-is.

@github-actions

Copy link
Copy Markdown
Contributor

Castiron custom code

Evaluated main: 43045fcaf91aec08571e54c57706597cefd32d45.

Trusted main policy: 43045fcaf91aec08571e54c57706597cefd32d45.

✅ No new custom-code files detected.

0 mixed files remain; 0 existing customizations changed.

Compared 43045fcaf91a → 68227bea4e1e. Generated baselines verified.

A changed generated baseline means this report cannot reliably identify which handwritten lines changed.

Inspect the custom-code diff

Download the exact patch produced by this run (requires repository access):

gh run download 40039656026 --repo openai/openai-python \
  --name castiron-custom-code-40039656026-1 --dir /tmp/castiron-custom-code-40039656026-1
git apply --stat /tmp/castiron-custom-code-40039656026-1/custom-code.patch
cat /tmp/castiron-custom-code-40039656026-1/custom-code.patch

Or reproduce it from an SDK checkout containing the vendored reporter:

git fetch --no-tags origin 43045fcaf91aec08571e54c57706597cefd32d45 68227bea4e1eb79f7fac9cf7a555f2ca3b8677df
python3 scripts/castiron/custom_code_report.py report \
  --base 43045fcaf91aec08571e54c57706597cefd32d45 \
  --head 68227bea4e1eb79f7fac9cf7a555f2ca3b8677df --target-branch main --fetch --require-head-hash --public \
  --out /tmp/castiron-custom-code-68227bea4e1e
cat /tmp/castiron-custom-code-68227bea4e1e/custom-code.patch

This is the current full custom patch for mixed files, not an attribution of only the handwritten lines changed by this PR.

Full report and patch

@marcuswood-oai
marcuswood-oai merged commit 718aee9 into openai:main Oct 23, 2026
20 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