Repository navigation
Description
Context
In #78 we marked several test modules skipif(win32) to get the new 3-OS CI matrix green:
tests/test_log_sh.py— bash dispatch + ownership checkstests/test_migration.py— bash bootstrap-dirs.shtests/test_security_fixes.py— RCE prevention insafe_eval, path-with-space cleanup,_jq_fallbackquotingtests/test_path_resolution.py— POSIX path layouts + bash subprocess capture
Three of these (test_log_sh, test_migration, test_security_fixes) test logic that does run on Windows when Claude Code invokes hooks via Git Bash. Skipping them means we ship no Windows security/regression coverage for those code paths.
Root cause of the skip
The GitHub Actions Windows runner's bash on PATH resolves to the WSL launcher (C:\Windows\System32\bash.exe), not Git Bash. WSL isn't installed on the runner, so every subprocess.run(["bash", "-c", script], ...) emits a UTF-16-encoded "no distributions installed" error and returns exit 1. The tests see garbage output and fail.
Proposed fix
In .github/workflows/tests.yml, on the Windows row, prepend Git Bash to PATH so subprocess.run(["bash", ...]) resolves to C:\Program Files\Git\bin\bash.exe:
- name: Use Git Bash on Windows
if: runner.os == 'Windows'
shell: pwsh
run: echo "C:\Program Files\Git\bin" | Out-File -FilePath $env:GITHUB_PATH -Append -Encoding utf8Then revert the pytestmark = pytest.mark.skipif(sys.platform == "win32", ...) blocks added in #78 on:
tests/test_log_sh.pytests/test_migration.pytests/test_security_fixes.py
Leave test_umask.py skipped — POSIX mode bits genuinely can't exist on NTFS. Possibly test_path_resolution.py too — /c/Users vs C:\Users path-form assumptions may need targeted per-test fixes.
Out of scope
- Per-test debugging once Git Bash runs — may surface real Windows bugs in the scripts that need actual fixes (path normalization, line endings, etc.).
test_umask.py— NTFS lacks Unix permission bits, not a CI configuration problem.
Test plan
- Workflow
PATHshim added. - Skip marks removed from the 3 files above.
- Each file passes on
windows-latest× 3.9/3.10/3.11/3.12. - If any individual test surfaces a real Windows bug, file a targeted follow-up rather than re-skipping the whole module.
Activity
test(windows): skip remaining bash-subprocess tests, fix utf-8 open()
test(windows): skip remaining bash-subprocess tests (#79)
ci: add Python 3.9 + green Linux/Windows test matrix (#78)
ci: prepend Git Bash in-step + MSYS-normalize paths for Windows shell…
ci: invoke bash by explicit Git path on Windows (#79) + CHANGELOG cat…
test: use forward-slash drive paths (C:/x) for bash+Windows-Python cr…
test: instrument migration test to capture Windows runner state (#79,…
fix: recognize Windows drive paths (C:/, C:\) as absolute in lib-memo…
docs(changelog): record the lib-memory-dir.sh Windows data_dir fix (#79)
ci: run shell-subprocess tests on Windows via Git Bash (#79) (#105)
fdaviddpt commentedon Jun 19, 2026
Resolved in #105 (merged) — all three modules now run green on
windows-latest× 3.9–3.12.Three layers, two of them deeper than the original PATH-shim plan anticipated:
GITHUB_PATHshim can't work: WindowsCreateProcesssearchesSystem32before PATH, sosubprocess.run(["bash", …])always resolves toSystem32\bash.exe(the WSL launcher) regardless of PATH order. Tests now invoke bash via the explicit Git-for-Windows path (_find_bash(), mirroringtest_hooks_json._find_git_bash).C:/x(not MSYS/c/x) — forward-slash drive form is accepted by both Git Bash and the Windowspython3the scripts shell out to (jq fallback, migration'sPath()round-trip), where/c/xis not.lib-memory-dir.shonly treated/…/~…as absolute when resolvingREMEMBER_DIRfrom adata_dir, so a Windows drive-pathdata_dir(C:/…/{slug}) was wrongly treated as relative and prepended toPROJECT_DIR(path doubling +{slug}never substituted). Fixed to recognizeC:/…andC:\…. This affected real Windows users on external mode, not just the tests — exactly why re-enabling them was worth it.TestDispatchOwnershipChecksstaysskipif(win32): POSIX ownership + world-writable (0o777) semantics genuinely don't map to NTFS (Git Bash fakes mode bits), so thedispatch()guard is a no-op there — a real platform limitation, not a CI gap.release: 0.8.0 (#106)
fix(#740): strip haiku from every document of an untrusted project co…
fix(#903): clear two CI failures -- network-word allowlist, Windows s…
Optional git reconcile step for a two-machine memory store (#903) (#924)
fix(#989): add rotate-credential advice to git-backup's could-not-unt…
Fix #994: write the CRLF-unsafe pre-commit hook via open(newline="\n"…
Fix #1134: quiet when the shared helper is missing, stub plugins carr…
docs: triage the #1134 guard tests in windows-skip-triage.md
Fix #1134: git-backup #138 guard fails closed when PROJECT_DIR is gon…