Repository navigation
test(eval): write scorecard fixtures as UTF-8 so Windows can run them - #4119
Conversation
Eight tests in this file are permanently red for every Windows contributor on clean main: the rendered scorecard contains a sigma, and these write_text calls inherit the cp1252 locale encoding, so they die with UnicodeEncodeError before asserting anything. The production writer in release_scorecard.py and the sibling test_scorecard_gate.py already pass encoding="utf-8"; this file was the only place missing it.
|
Verdict: Approve This makes eight test fixture writes save as UTF-8 so they stop crashing on Windows, where the default encoding can't represent the maths symbols the scorecard renders. The fix is right, matches what the real scorecard writer already does, and the claim that this file was the last place missing it checks out across the repo. One thing worth a follow-up, not a blocker: a nearby test reads a scorecard back without pinning UTF-8 too. On Windows that won't crash — it quietly mangles the text and the test still passes, which is a weaker check than it looks. Real-world evidenceNo evidence bundle was produced for this PR, and none is needed — the change touches only a test file, no user-facing CLI, API, MCP, or UI surface. The verdict rests on static review plus a local check of the failure mechanism. I could not run the test suite in this review container (no 🔍 Technical detailsVerification performed
🟢 Minor — read path still uses the platform encoding ( This reads back a scorecard written by Strengths
|
…#4136) ## Why this matters A Windows contributor running the four shell test suites sees `112 skipped`, which is visually indistinguishable from green. CI on ubuntu and macOS sees 112 real results. So the loop is: verify locally, see no red, push, watch CI fail — which is exactly how the confirm-gate defect in amd#3808 reached CI undetected. The skip reason is genuine for the tests that actually launch a process: Windows runs each pipeline through `cmd.exe`, and `os.killpg` / process groups are POSIX-only. It is *not* genuine for the refusal, parsing, grant and tool-description tests — those decide before anything reaches a shell, and a module-level skip was hiding them on the platform most GAIA contributors develop on. After this change Windows runs **70 passed / 42 skipped** instead of `112 skipped`, and every one of those 70 is a real assertion about the security-adjacent refusal path. POSIX is untouched: the per-test mark carries the same `sys.platform == "win32"` condition the module-level one did, so off Windows it is a no-op and all 112 still run. <details> <summary>🔍 Technical details</summary> **Membership was measured, not guessed.** A throwaway pytest plugin stripped the `cmd.exe` skipifs, wrapped `shell_tools.subprocess.Popen` / `.run`, and recorded which node IDs actually spawned a child. 42 did; 70 did not. The 70 were then run on Windows 11 and all passed; every one of the 10 failures fell inside the 42. So the split is empirical, not a reading of the test names. That measurement mattered, because *running the tests* would have given the wrong answer. This dev box has MSYS coreutils on `PATH`, so `ls`, `cat`, `sort` and `date` resolve and most execution tests pass here — they would not on a clean Windows machine or a `windows-latest` runner. Classifying on "does it pass on my box" is the hidden-state trap CLAUDE.md warns about; classifying on "does it spawn a process" is not. - `pytestmark = pytest.mark.skipif(...)` → `posix_only = pytest.mark.skipif(...)`, same reason string per module, applied as `@posix_only` to the 35 spawning tests across three files. - **No assertion was weakened, relaxed, or deleted.** The diff is 53 insertions / 3 deletions; the 3 deletions are the `pytestmark` name on each of the three lines. - Node IDs are unchanged (no reorganisation into classes), so other in-flight PRs that name these tests in their test plans still resolve. - `test_shell_env_assignment.py`'s two existing `shutil.which("pytest")` skipifs stack above `@posix_only`; pytest ORs them, so behaviour off Windows is identical. - `tests/unit/test_shell_pipelines.py` keeps its module-level mark — all seven of its tests genuinely run a pipeline, so there is nothing to promote. `test_shell_output_encoding.py` already used per-test marks and is untouched. - One pleasing side effect: `test_windows_never_hands_a_compound_line_to_cmd_exe_as_one_string` — a fully-mocked test *about* the Windows path — was itself skipped on Windows. It now runs there. **Merge-conflict note for reviewers:** amd#3721 and amd#3402 both touch `test_shell_compound_commands.py`, neither near the `pytestmark` line. Whichever lands second may need a trivial rebase. </details> ## Scope This does **not** close amd#4127. That issue asks for `windows-latest` in the `test_unit.yml` matrix, gated on amd#4115 and amd#4119 landing first so the lane starts green. This is a prerequisite for that lane being worth anything — without it, 112 of the tests the new lane would run are skipped by construction. ## Test plan - [x] `python -m pytest tests/unit/test_shell_compound_commands.py tests/unit/test_shell_env_assignment.py -q` on Windows 11 — was `77 skipped`, now `51 passed, 26 skipped` - [x] Same for all four modules — was `112 skipped`, now `70 passed, 42 skipped` - [x] `python -m pytest tests/unit/test_shell*.py tests/unit/test_powershell_command_injection.py -q` — `266 passed, 42 skipped` - [x] `python util/lint.py --all` — output byte-identical to a clean `origin/main` worktree (both exit 1 on the same pre-existing mypy findings in `src/gaia/`, none in files this PR touches) - [ ] CI on ubuntu/macOS — expect the same counts as before this PR; the mark is a no-op off Windows Towards amd#4127. Co-authored-by: Kalin Ovtcharov <[email protected]>
…4126) A review bot that ran out of budget now looks different from a review that found problems. Until now both rendered the same: `pr-review / run` went red with "Claude produced no review" plus a warning blaming an upstream install crash, and the only way to tell a spend cap from a genuinely broken review was to pull the job log and read the CLI's raw result object. On amd#4119 and amd#4120 that was a weekly-cap rejection both times, and the lane said "the action crashed" — a cause that wasn't there. The lane still fails. That's the point: an outage that renders as a pass is how 50 PRs once merged unreviewed. What changed is that the red is now legible — each verdict gets its own named step, so the checks list carries the cause without opening a log. <details> <summary>🔍 Technical details</summary> `claude-run.yml` classifies the run from `claude-code-action`'s `execution_file` into `ok` / `errored` / `not_started` / `no_output`, and each gets its own named step. The outage gate keys on the CLI's own numbers, never on the rejection wording: a run that reached a model always bills tokens into `modelUsage`, so `is_error` with an empty usage map and zero cost means the request was refused before any model work. Wording is used only to *narrow* an outage the numbers already established (to name the budget case and say "don't rotate the credential"), never to create or suppress one — the rejection text quotes a reset date that moves, embeds a U+00B7, and in both observed cases carried no body at all. That's the same failure mode amd#4120 fixed on the eval preflight's probe classifier, which owns the authoritative phrase list. The ENOENT install-crash claim now fires only when there is genuinely no execution log — which is what that crash actually looks like. Only `require_comment` callers (`pr-review`) fail, unchanged from before: an outage on the optional lanes still must not red-X a contributor's PR. **Not doable outside YAML:** `pull_request_target` checks out the untrusted fork tree with secrets in scope, so this file must not run a script from that tree — the detection itself has to be inline bash + jq. The tests compensate by extracting the step's real `run:` body and executing it against captured execution logs. </details> ## Test plan - [ ] `pytest tests/unit/test_claude_review_posting.py` — 24 tests. Nine execute the step's actual `run:` body against real captured execution logs, including the verbatim amd#4119/amd#4120 outage result. - [ ] Mutation check (already run): dropping the `modelUsage` term, dropping the cost term, or accepting any `is_error` record instead of the CLI's `result` record each fails exactly one test. - [ ] Zero-cost is not sufficient on its own — a Claude *subscription* run bills $0 per request, and the fixtures assert such a run still classifies `ok` / `errored`, never as an outage. - [ ] On the next real cap, confirm the `pr-review` checks list shows **"Claude never reached a model — budget or credential, not this PR"** rather than "Claude produced no review". Closes nothing; makes amd#4080 self-reporting. Companion to amd#4120, which fixed the same misclassification on the eval preflight's probe. --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
Eight tests in
test_release_scorecard.pyfail on every Windows machine against cleanmain— the rendered scorecard contains a Σ, and these fixture writes inherit the cp1252 locale encoding, so they blow up withUnicodeEncodeErrorbefore asserting anything. After this, they pass everywhere. It's a constant that every delta-vs-baseline run on Windows has been quietly subtracting, so it corrupts the measuring instrument, not just the file.The production writer and the sibling gate tests already pass
encoding="utf-8"; this file was the only place missing it.Test plan
python -m pytest tests/unit/eval/test_release_scorecard.py -q— was 8 failed / 100 passed, now 108 passedpython -m pytest tests/unit/eval/ -q— 683 passed, 1 skipped