Skip to content

Make the test suite pass on Windows #44

Open

Description

@chris-peterson

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 cwd and CLAUDE_PROJECT_DIR when Python sees D:\… 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 USERPROFILE alongside HOME in the sandboxed cases, and skip the file-mode assertion where the platform has no POSIX modes.
  • Re-add windows-latest to .github/workflows/test.yml.

Acceptance criteria

  • .github/workflows/test.yml runs on ubuntu-latest, macos-latest, and windows-latest, and all three pass
  • A recursive rm of a path inside the project is allowed on Windows exactly as on macOS, for both is_in_project_tree and is_recoverable, with fixtures covering Windows path spellings
  • scripts/reset-decisions.py exits 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.md covers them
  • No test is skipped on Windows except the POSIX file-mode assertion

Considerations

  • Interpreter on PATH. hooks/hooks.yml launches the engine with python3. The runner has it, but whether a stock Windows machine running Claude Code does (rather than only python/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's onFailure: block would turn into every call being blocked. Settle this before calling Windows supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementNew feature or request

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions