Skip to content

test(sweep): read feedback and manifest files as UTF-8 (#624) - #766

Open
Polloinfilzato wants to merge 1 commit into
bmad-code-org:mainfrom
Polloinfilzato:fix/624-utf8-test-reads
Open

test(sweep): read feedback and manifest files as UTF-8 (#624)#766
Polloinfilzato wants to merge 1 commit into
bmad-code-org:mainfrom
Polloinfilzato:fix/624-utf8-test-reads

Conversation

@Polloinfilzato

@Polloinfilzato Polloinfilzato commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

What

Four bare open(...).read() calls in tests/test_sweep.py now read UTF-8 explicitly through Path.read_text, matching the sibling at :4458 that #616 already fixed.

Why

They use the platform default encoding and leak the handle. The default is not UTF-8 on Windows and CI runs windows py3.11 / py3.14, so a non-ASCII byte in one of these files would raise UnicodeDecodeError there and nowhere else.

Fixes #624.

How

  • :4063 — the instance the issue names, using the one-liner it proposes.
  • :1617, :2412, :4034 — the same defect in the same file, found by the same search. Happy to drop these three if you would rather keep the PR to the filed line.

Testing

uv run pytest -q tests/test_sweep.py — 198 passed. trunk check clean. These tests pass before and after: the fault is latent and only reachable under a non-UTF-8 default encoding, so this is a non-regression check rather than a proof.

Changelog

n/a — test-only, nothing user-visible.

Summary by CodeRabbit

  • Tests
    • Standardized test file reading to explicitly use UTF-8 encoding.
    • Updated coverage for intent, triage feedback, migration manifest, and migration feedback files.

…#624)

Four bare `open(...).read()` calls used the platform default encoding and
leaked the handle. The default is not UTF-8 on Windows and CI runs the suite
on windows py3.11 and py3.14, so a non-ASCII byte in one of these files would
raise UnicodeDecodeError there and nowhere else.

Matches the sibling read at tests/test_sweep.py:4458, fixed in bmad-code-org#616.
@coderabbitai

coderabbitai Bot commented Sep 4, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 2fa41a6f-5d3f-4734-9102-0f02761e044b

📥 Commits

Reviewing files that changed from the base of the PR and between c47333d and c66a0a8.

📒 Files selected for processing (1)
  • tests/test_sweep.py

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

Four assertions in tests/test_sweep.py now read files with explicit UTF-8 encoding. The migration manifest continues to parse as JSON after text decoding.

Changes

Test file encoding consistency

Layer / File(s) Summary
Update sweep test file reads
tests/test_sweep.py
Four intent, feedback, and migration manifest reads now use Path.read_text(encoding="utf-8").

Estimated code review effort: 1 (Trivial) | ~3 minutes

Merge Risk: ⚪ Minimal · up to c66a0

Sweep tests now decode intent, feedback, and manifest files as UTF-8, making test behavior deterministic across platforms without changing production behavior. The change is ready to merge.

Suggested reviewers: pbean

Poem

A rabbit reads files in the morning light
With UTF-8 pinned just right
Intent and feedback hop in line
Manifests parse and tests shine
Four small changes keep bytes bright

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The pull request satisfies issue #624 by replacing the platform-default feedback-file read with Path.read_text(encoding="utf-8"). It also applies the same fix to three related occurrences.
Out of Scope Changes check ✅ Passed All four changes concern file-reading behavior in tests/test_sweep.py and directly support the linked issue objective. No unrelated changes are present.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: updating sweep tests to read feedback and manifest files as UTF-8.
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

test_sweep: feedback-file read at :3146 uses the platform default encoding

1 participant