Repository navigation
Make the test suite pass on Windows #44
Copy link
Copy link
Open
Description
Context
The engine (scripts/watchdog.py) is stdlib-only Python, and its test suite passes on Linux and macOS in CI (#43). On Windows it doesn't: the first windows-latest run (Git Bash) failed 17 of roughly 680 checks (run 38610074575), so that job was left out of #43's matrix. This issue gets the Windows job green and puts it back.
The consumer is anyone running Claude Code natively on Windows with the plugin installed. The failure they would notice is in the rm exemptions: the failing fixtures have a recursive delete inside the project getting ask on Windows where macOS allows it.
What failed
| Cause | Checks | Side |
|---|---|---|
Windows paths in the rm exemptions. In-tree deletes ([RL-15], [RL-16], is_in_project_tree) and is_recoverable ([RL-18]) return ask where the fixtures expect allow |
7 (watch-files, engine, is_recoverable) | Engine, not yet traced |
cp1252 console encoding. scripts/reset-decisions.py:103 builds its summary with →, which cp1252 can't encode, so the print at :115 raises and the script exits 1. The output-formatting tests' helper writes — through the same encoding, so their grep for the UTF-8 em dash misses |
7 (reset, output formatting) | Script and tests |
The tests sandbox the log with HOME=, but Python on Windows resolves ~ from USERPROFILE |
2 (logging, analyze) | Tests |
| The test asserts POSIX modes 0600/0700 on the log file and directory | 1 (logging) | Tests |
Proposed approach
- Path handling first. Trace how the in-tree and recoverability predicates compare a target against
cwdandCLAUDE_PROJECT_DIRwhen Python seesD:\…paths and the command carries/d/…or/tmp/…forms. Decide which spellings the predicates accept on Windows and record that in [RL-16]/[RL-18], then fix the engine to match. This is the only cause that changes a decision a user sees. - Encoding. Make the scripts that print summaries write UTF-8 regardless of the console code page (for example
sys.stdout.reconfigure(encoding="utf-8")), and have the tests' Python helpers do the same. - Test portability. Set
USERPROFILEalongsideHOMEin the sandboxed cases, and skip the file-mode assertion where the platform has no POSIX modes. - Re-add
windows-latestto.github/workflows/test.yml.
Acceptance criteria
-
.github/workflows/test.ymlruns onubuntu-latest,macos-latest, andwindows-latest, and all three pass - A recursive
rmof a path inside the project is allowed on Windows exactly as on macOS, for bothis_in_project_treeandis_recoverable, with fixtures covering Windows path spellings -
scripts/reset-decisions.pyexits 0 and prints its summary on a cp1252 console - [RL-16]/[RL-18] state which path forms count as in-tree on Windows, and
STATUS.mdcovers them - No test is skipped on Windows except the POSIX file-mode assertion
Considerations
- Interpreter on PATH.
hooks/hooks.ymllaunches the engine withpython3. The runner has it, but whether a stock Windows machine running Claude Code does (rather than onlypython/py, or the Microsoft Store stub) is unverified. If it doesn't, the hook can't start, which Make the PreToolUse guards fail closed #41'sonFailure: blockwould turn into every call being blocked. Settle this before calling Windows supported.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
Run the test suite in CI on Linux and macOS