Repository navigation
Make the judge tests OS-portable and run the suite in CI - #287
Open
Liu5201988 wants to merge 2 commits into
Open
Liu5201988 wants to merge 2 commits into
Liu5201988 wants to merge 2 commits into
Conversation
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
force-pushed
the
fix/windows-portable-tests
branch
2 times, most recently
from
November 9, 2026 19:33
b9a6a4c to
9869857
Compare
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.
python -m unittest discover -s testsreports 3 failures on Windows. All three live intests/test_judge.py'sEndToEndTestand share one cause: the stub judges are launched assh -c "<script>".shis 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):Summary
tests/test_judge.py— the four stub runners now execute[sys.executable, "-c", <snippet>]instead ofsh -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 withcase. No assertion was changed andscripts/judge.pyis untouched..github/workflows/tests.yml— new workflow, matrixubuntu-latest+windows-latest, runningpython -m unittest discover -s tests -vonpull_requestand onpushtomain.Before / after (observable):
scripts/or any test module other thantest_always_on_hooks.pyruns no test gate, and the suite fails on Windows with 3 failures.Why a CI job is part of this: today only
tests/test_always_on_hooks.pyruns in CI, viaplugin-load-check.yml, and that workflow is path-filtered tohooks/**,skills/**,.claude-plugin/**and that single test file. A Windows-only break intests/test_judge.pytherefore 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
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_requiredbecause this is a first contribution from a fork, so theubuntu-latesthalf is unproven in CI; the suite is verified locally on Windows only.python-versionis3.xbecause the repository declares no minimum version.Labels
Target label:
Target:EvalsAuthor label:
Author:HybridWorkflow labels:
bug(Submitting from a fork account, so I cannot apply labels myself — please add them.)
Safety and side effects
Side effects, permissions, network access, and cost: the workflow declares
permissions: contents: read, usespersist-credentials: false, reads no secrets, and calls no third party beyondactions/checkoutandactions/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
Migration or rollback notes: none required. The two changes are independent: reverting
.github/workflows/tests.ymlremoves 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/OKpython -m unittest discover -s tests— same machine, upstream1ecea19without the fix:Ran 78 tests/FAILED (failures=3), failing exactly the three cases abovepython -m pytest tests/ -q—78 passed, 94 subtests passedpython scripts/run_evals.py validate—Evaluation cases are valid..github/workflows/tests.yml— triggers resolve topull_request+push: [main], one jobunittestBehavior evals: not applicable — no
SKILL.md, prompt, or rubric text is touched, andevals/cases.jsonlis unchanged and validates.Final accountability