Repository navigation
Write spec/validate.py Output as UTF-8, and Fix Four Windows-Shaped Test Assertions - #2523
Conversation
…est Assertions On Windows a piped stdout uses the ANSI code page, so spec/validate.py crashed reporting a registry name the code page cannot encode, and wrote others in a form the suite's UTF-8 decode rejected. It now reconfigures both streams to UTF-8, the way scripts/pr_review.py already does. The rest are test-side: - test_host_gate asserted POSIX path and flag forms, where Windows prints backslashes, the PowerShell call operator, and -Repo. - test_docker_lint expected a forward-slash mount source from a native Windows path. - test_release_guards handed its guard script to Git Bash through -c. Git Bash's parse of the Windows command line collapses each doubled backslash, so the jq filter's escaped class failed to compile and every value was refused. The script is now run from a file, and host_capability.bash_path records why. Part of #2488. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2523 +/- ##
===========================================
- Coverage 58.50% 58.40% -0.10%
===========================================
Files 16 16
Lines 8066 8090 +24
===========================================
+ Hits 4719 4725 +6
- Misses 3347 3365 +18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 Changes recommended
Address the two moderate review findings before approval.
2 open findings
What changed in this PR
This PR fixes remaining Windows portability issues and ensures validator output is UTF-8 encoded.
Changes:
- Runs release guard scripts from temporary files.
- Makes host and Docker assertions platform-aware.
- Configures validator streams for UTF-8.
- Requires a UTF-8 regression test and restoration of strict command-prefix validation.
| File | Summary |
|---|---|
tests/test_release_guards.py |
Executes guard scripts from files. |
tests/test_host_gate.py |
Updates Windows-specific expectations. |
tests/test_docker_lint.py |
Uses host-native path separators. |
tests/host_capability.py |
Documents Git Bash quoting behavior. |
spec/validate.py |
Configures UTF-8 output streams. |
🧠 Review effort: Lite
Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.
…ertion Exact A new case runs spec/validate.py with a cp1252 console and a name that code page cannot encode, so removing the entry point's UTF-8 reconfigure fails on Linux too, where the streams are otherwise UTF-8 already. The host-setup remedy case compares the whole printed command again, built from quote_argument with the call operator on Windows, rather than only finding the path somewhere in it. Part of #2488. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
A recorded local strict-review pass covers head |
## Summary Promotes three changes from `develop`, which together make `python3 -m unittest discover -s tests` pass on a Windows host from Git Bash. - #2521: two Windows defects in `scripts/local_review.py`, and the tests that exercise them. - A write to a closed pipe raises `OSError` with `EINVAL` on Windows rather than `BrokenPipeError`, so `status | head -0` exited 120 outside the 0/1/2 contract. `closed_reader` now recognizes both forms. - `worktree_states` left its throwaway object directory behind on Windows, holding the staged content of every untracked file, because `rmtree(ignore_errors=True)` could not unlink git's read-only loose objects. An `onexc` handler now clears the read-only bit and retries. - #2523: `spec/validate.py` writes its output as UTF-8 on every host, and a cp1252 regression case pins that on Linux CI too. Four Windows-shaped test assertions take the host's path, quoting, and flag forms. `test_release_guards` runs its guard script from a file, since Git Bash's parse of a Windows command line halves each doubled backslash inside a quoted `-c` argument, and `host_capability.bash_path` records that. - #2524: the jq carriage-return test's fixture now says `cataloged`, so the test fails when its stub is not reached. Closes #2488. Closes #2513. ## Verification - On the Windows host from Git Bash, `python3 -m unittest discover -s tests` at `develop`'s head ran 2245 tests and reported `OK`, where the round started from 15 failures and 10 errors. - Each change took a recorded local strict-review pass and a Copilot round on its first head. #2523's fix push is covered by an attested local pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code)

Summary
Clears the rest of #2488, the 9 Windows failures left once #2521 cleared the
test_local_reviewcluster. With both changes,python3 -m unittest discover -s testspasses on the Windows host from Git Bash.spec/validate.pywrites UTF-8. On Windows a piped stdout uses the ANSI code page, so the validator crashed reporting a registry name that code page cannot encode, a zero-width space for one, and wrote others, such asß, in a form the suite's UTF-8 decode rejected. It now reconfigures both streams to UTF-8 at the top ofmain, through the sameutf8_consolehelperscripts/pr_review.pyalready carries. On Linux the streams were already UTF-8, so CI output is unchanged.test_release_guardsruns its guard script from a file. The handoff read this failure as jq 1.8.2 rejecting\S, and that diagnosis is wrong: winget's jq 1.8.2 compiles the filter and gives every expected verdict when it receives it intact. The script went throughbash -c, and Git Bash's own parse of the Windows command line collapses each doubled backslash inside a quoted argument, so the filter arrived holding an invalid escape and every value was refused. The test now writes the script to a temporary file and runs that, andhost_capability.bash_path's docstring records the trap for the next test.test_host_gateasserted POSIX forms where Windows prints a backslash path, the PowerShell call operator, and-Repo. Each assertion now takes the host's form, and on Linux each expected string is still byte-identical to the literal it replaces.test_docker_lintexpected a forward-slash mount source from a native WindowsPath. The expectation takes the separator from the host, and the doubled-quote escaping it pins is unchanged.Part of #2488, which the promotion pull request closes.
Verification
test_spec_validate,test_host_gate,test_docker_lint, andtest_release_guardseach pass, and the python-versions guard case runs rather than skips.test_local_review, which Absorb a Windows Closed Pipe and Remove Read-Only Staged Objects in local_review #2521 fixes and which has since merged intodevelop.ruff format --check,ruff check, andmypypass.🤖 Generated with Claude Code