Skip to content

Write spec/validate.py Output as UTF-8, and Fix Four Windows-Shaped Test Assertions - #2523

Merged
ptr727 merged 2 commits into
developfrom
fix/windows-remaining-tests
Oct 8, 2026
Merged

ptr727 merged 2 commits into
developfrom
fix/windows-remaining-tests

Conversation

@ptr727

@ptr727 ptr727 commented Oct 8, 2026

Copy link
Copy Markdown
Owner

Summary

Clears the rest of #2488, the 9 Windows failures left once #2521 cleared the test_local_review cluster. With both changes, python3 -m unittest discover -s tests passes on the Windows host from Git Bash.

  • spec/validate.py writes 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 of main, through the same utf8_console helper scripts/pr_review.py already carries. On Linux the streams were already UTF-8, so CI output is unchanged.
  • test_release_guards runs 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 through bash -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, and host_capability.bash_path's docstring records the trap for the next test.
  • test_host_gate asserted 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_lint expected a forward-slash mount source from a native Windows Path. 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

  • On the Windows host from Git Bash, test_spec_validate, test_host_gate, test_docker_lint, and test_release_guards each pass, and the python-versions guard case runs rather than skips.
  • The full suite on this branch failed only in 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 into develop.
  • ruff format --check, ruff check, and mypy pass.

🤖 Generated with Claude Code

…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>
Copilot AI lite review requested due to automatic review settings October 8, 2026 04:01
@coderabbitai

coderabbitai Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d572b4c5-0d4b-4aae-921a-a078c4ec418a
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 16.66667% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 58.40%. Comparing base (8bdfa25) to head (d438d25).
⚠️ Report is 2 commits behind head on develop.

Files with missing lines Patch % Lines
spec/validate.py 16.66% 5 Missing ⚠️
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     
Flag Coverage Δ
python-3.13 58.40% <16.66%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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.

Comment thread spec/validate.py
Comment thread tests/test_host_gate.py Outdated
…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>
@ptr727

ptr727 commented Oct 8, 2026

Copy link
Copy Markdown
Owner Author

A recorded local strict-review pass covers head d438d25b957617f78399834e8c4b31d2937d5687, the content this pull request carries at that commit against develop, and it recorded 0 findings.

@ptr727
ptr727 merged commit 5c5d890 into develop Oct 8, 2026
12 checks passed
@ptr727
ptr727 deleted the fix/windows-remaining-tests branch October 8, 2026 13:29
ptr727 added a commit that referenced this pull request Oct 8, 2026
## 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)
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.

2 participants