Skip to content

Make the judge tests OS-portable and run the suite in CI - #287

Open
Liu5201988 wants to merge 2 commits into
ayghri:mainfrom
Liu5201988:fix/windows-portable-tests
Open

Liu5201988 wants to merge 2 commits into
ayghri:mainfrom
Liu5201988:fix/windows-portable-tests

Conversation

@Liu5201988

@Liu5201988 Liu5201988 commented Nov 9, 2026 •

Copy link
Copy Markdown

python -m unittest discover -s tests reports 3 failures on Windows. All three live in tests/test_judge.py's EndToEndTest and share one cause: the stub judges are launched as sh -c "<script>". sh is not on PATH on Windows, and where a POSIX shell does exist it rewrites the backslash-separated paths embedded in the script, so the stubs never read the payload and the assertions fail for reasons unrelated to the code under test.

Before (Windows 11, Python 3.13.14, upstream 1ecea19):

FAIL: test_a_malformed_verdict_skips_its_group_instead_of_killing_the_run
FAIL: test_judging_produces_paired_rows_the_scorer_accepts
FAIL: test_runner_failure_skips_its_group_and_continues
Ran 78 tests
FAILED (failures=3)

Summary

  1. tests/test_judge.py — the four stub runners now execute [sys.executable, "-c", <snippet>] instead of sh -c. The snippets read the prompt from stdin (sys.stdin.buffer.read()) and write the reply to stdout as bytes, which is the contract the judge already relies on, and they branch in Python rather than with case. No assertion was changed and scripts/judge.py is untouched.
  2. .github/workflows/tests.yml — new workflow, matrix ubuntu-latest + windows-latest, running python -m unittest discover -s tests -v on pull_request and on push to main.

Before / after (observable):

  • Before: a PR touching scripts/ or any test module other than test_always_on_hooks.py runs no test gate, and the suite fails on Windows with 3 failures.
  • After: the full suite must pass on Linux and Windows before merge; the suite passes locally on Windows.

Why a CI job is part of this: today only tests/test_always_on_hooks.py runs in CI, via plugin-load-check.yml, and that workflow is path-filtered to hooks/**, skills/**, .claude-plugin/** and that single test file. A Windows-only break in tests/test_judge.py therefore merges with every check green. Issue #134 proposed this exact workflow and was closed because its author withdrew it, not because the idea was rejected.

Authorship and provenance — select exactly one

  • Human-authored — substantive implementation and text were produced by a human.
  • Autonomous agent-authored — an agent planned and produced most of the substantive change.
  • Hybrid — a human and one or more agents both made substantive contributions.

Agent/tool and model/version: WorkBuddy agent ("小天机") running DeepSeek-V4.1-Flash.

Agent contribution: diagnosed the three failures, wrote the _script() helper and the four stub rewrites, wrote .github/workflows/tests.yml, ran the suite locally, and drafted this description.

Human verification: the human contributor commissioned and approved the change; the commands below were run on the submitter's machine (Windows 11, Python 3.13.14) and the outputs are pasted verbatim.

Known limitations or uncertain results: the new workflow has not executed yet. GitHub holds the run at action_required because this is a first contribution from a fork, so the ubuntu-latest half is unproven in CI; the suite is verified locally on Windows only. python-version is 3.x because the repository declares no minimum version.

Labels

Target label: Target:Evals

Author label: Author:Hybrid

Workflow labels: bug

(Submitting from a fork account, so I cannot apply labels myself — please add them.)

Safety and side effects

  • The change does not access or expose secrets, private files, or unrelated user/repository data.
  • Scripts, hooks, workflows, and evals are bounded and do not create surprising or irreversible side effects.
  • No destructive, privileged, production, externally visible, or persistent action occurs without explicit user intent and appropriate safeguards.
  • Network access, third-party code, permissions, and provider costs are minimized and documented.
  • Prompt text, examples, and fixtures contain no hidden instructions that weaken safety or expand agent authority.

Side effects, permissions, network access, and cost: the workflow declares permissions: contents: read, uses persist-credentials: false, reads no secrets, and calls no third party beyond actions/checkout and actions/setup-python. Cost is one additional 2-OS job per PR, roughly 15 s of test time per platform. Rollback is deleting the workflow file.

Compatibility

  • This is not a breaking change.
  • This is a breaking change; it was discussed, and migration/deprecation documentation is included below.
  • Canonical and mirrored skill files are synchronized when applicable.
  • Relevant platform manifests and installation documentation were reviewed.

Migration or rollback notes: none required. The two changes are independent: reverting .github/workflows/tests.yml removes the CI gate and leaves the test fix intact.

Verification

  • python -m unittest discover -s tests — Windows 11, Python 3.13.14, this branch: Ran 78 tests in 12.716s / OK
  • python -m unittest discover -s tests — same machine, upstream 1ecea19 without the fix: Ran 78 tests / FAILED (failures=3), failing exactly the three cases above
  • python -m pytest tests/ -q — 78 passed, 94 subtests passed
  • python scripts/run_evals.py validate — Evaluation cases are valid.
  • YAML parse of .github/workflows/tests.yml — triggers resolve to pull_request + push: [main], one job unittest
  • Not run: the CI job itself (see known limitations).

Behavior evals: not applicable — no SKILL.md, prompt, or rubric text is touched, and evals/cases.jsonl is unchanged and validates.

Final accountability

  • I reviewed the complete diff, removed unrelated generated changes, and take responsibility for the submitted content.
  • All failed, skipped, or unrun checks are disclosed above.

The three EndToEndTest cases in tests/test_judge.py built their stub runner
commands with 'sh -c "..."'. On Windows 'sh' is not on PATH, and where a
POSIX shell does exist it rewrites the backslash-separated paths embedded in
the script, so the stubs never read the payload. All three cases failed on
Windows for reasons unrelated to the code under test.

Replace 'sh -c' with 'python -c' and pass the script through stdin, using
sys.stdin.read() instead of a shell command substitution. This keeps the
'the runner reads its prompt from stdin' contract that the stubs are there to
verify, and behaves identically on POSIX and Windows.

Also add .github/workflows/tests.yml: 'python -m unittest discover -s tests'
is the documented pre-PR command, but nothing ran it in CI, which is how the
Windows-only failures stayed green.
The stubs now read stdin and write stdout as bytes, so a non-ASCII prompt cannot
round-trip through the locale encoding (cp1252 on a default Windows runner). The
helper also moves below the imports and the return annotation is quoted so the
module still imports on Python without PEP 585 builtins.
@Liu5201988
Liu5201988 force-pushed the fix/windows-portable-tests branch 2 times, most recently from b9a6a4c to 9869857 Compare November 9, 2026 19:33
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.

1 participant