Repository navigation
fix(scripts): reconfigure setup_plan.py streams as UTF-8 - #5569
Merged
mnriem merged 1 commit intoNov 25, 2026
Merged
Conversation
Redirected runs on a legacy Windows code page raised UnicodeEncodeError when setup_plan.py printed a non-ASCII feature path. The sibling Python helpers already reconfigure both streams; mirror that helper here. Fixes github#5567 Assisted-by: OpenCode (model: Gemini 4 Neon, autonomous)
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are present, and the change includes targeted regression coverage for legacy-encoding output and related error paths.
No open issues 🎉
What changed in this PR
This pull request fixes setup_plan.py failures when redirected stdout or stderr uses a legacy encoding on Windows, aligning it with the existing UTF-8 stream handling in setup_tasks.py and adding subprocess regression coverage.
Changes:
- Reconfigure stdout and stderr to UTF-8 with safe error handling before executing
main(). - Add coverage for non-ASCII paths, text and JSON output, invalid initialization directories, and template-resolution errors under
cp1252andasciienvironments.
| File | Description |
|---|---|
| tests/test_setup_plan_utf8_output.py | Adds subprocess regression tests for non-ASCII paths, UTF-8-safe text and JSON output, and error handling. |
| scripts/python/setup_plan.py | Adds UTF-8 stream configuration at the script entry point before plan setup execution. |
Review effort: Lite (adaptive)
Collaborator
|
Thank you! |
4 of 5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #5567
What
scripts/python/setup_plan.pynow reconfigures stdout and stderr to UTF-8 beforemain()runs, mirroring the existing helper inscripts/python/setup_tasks.py.Why
When either stream is redirected on Windows with a legacy code page (cp1252 in the reproduction),
print()of a feature path containing non-ASCII characters raisedUnicodeEncodeErrorand aborted plan setup beforeplan.mdwas created. The other Python workflow helpers already reconfigure both streams;setup_plan.pywas the outlier.Tests
tests/test_setup_plan_utf8_output.pyruns the script as a real subprocess withPYTHONIOENCODING=cp1252andascii, covering a non-ASCII feature path (positive) plus invalidSPECIFY_INIT_DIRand broken template-composition layers (negative).main: 8 failed. Green after fix: 8 passed.uvx ruff@0.15.0 check src tests: all checks passed.specify --help: exit 0.git diff --check: clean.AI disclosure
This PR, its paired issue, its commit, and its tests were authored by an AI agent (OpenCode, model: Gemini 4 Neon, autonomous) acting for adityajai119. The contributor did not line-by-line review the change; automation produced the verification evidence above.