[Windows port] Make windows-latest CI green - #26
Merged
Merged
Conversation
Skip POSIX-shell integration tests on Windows and fix a git<2.48 default-branch detection bug. On GitHub's windows-latest runner, `bash` resolves to the WSL launcher stub (no distro installed), not Git Bash, so every test that shells out to a `.sh` script fails. These scripts are POSIX-only and fully exercised on Linux CI, so skip the seven bash-invoking test modules on Windows via a module-level `pytestmark` skipif(os.name == 'nt'). Also skip test_load_shadowignore_unreadable_file_warns on Windows: chmod(0o000) does not remove read access there, so the warning path is never hit. dream-setup.sh: guard the `git symbolic-ref refs/remotes/origin/HEAD` call with `|| true`. git < 2.48 does not auto-create origin/HEAD on fetch, so under `set -euo pipefail` the unset ref aborted the script before the origin/main / origin/master fallback could run. Continues the [Windows port] series. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c7ecd4cf-cc31-45e1-a660-82c2ad9b66af
Replaces the blanket `skipif(os.name == 'nt')` on the seven bash-invoking
test modules with a real cross-platform harness so the shell scripts are
actually exercised on windows-latest (recovering ~200 tests from skipped
to running).
tests/_shell.py (new): resolves a real POSIX bash on Windows (Git Bash,
never the System32 WSL launcher stub) and builds a PATH that makes
`python3` (via a shim that execs the test interpreter) and `git` +
coreutils discoverable inside Git Bash. On POSIX both helpers are
pass-throughs, so Linux behaviour is unchanged.
Each module now:
- runs the scripts via BASH (Git Bash on Windows) and shell_path()
- skips only when no POSIX bash exists at all (skipif(not HAVE_BASH))
- uses prepend_path() so PATH stubs use os.pathsep, not a hard-coded ':'
Remaining Windows skips are narrow and precisely documented — only for
irreducibly-POSIX behaviour that cannot exist on Windows:
- SIGTERM-trap signal tests (Windows send_signal(SIGTERM) hard-kills)
- dream-gc worktree/gitdir tests (the script detects absolute gitdir
targets with the POSIX pattern `/*`; Windows drive paths like
`C:\\...` are not POSIX-absolute, and ':' is illegal in filenames)
- the `/etc`-style POSIX sensitive-base parametrizations
- chmod(0o000) (does not remove read access on Windows)
Also normalises a `git worktree list` path comparison (POSIX separators)
and forces UTF-8 subprocess I/O in the fault-injection matrix so the
non-ASCII-path payload cell works under Windows' cp1252 locale.
Windows: 1029 passed, 44 skipped, 0 failed (was 827 passed / 246 skipped).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: c7ecd4cf-cc31-45e1-a660-82c2ad9b66af
The windows-latest job surfaced 5 failures that don't reproduce on a single-drive box or Python 3.13. Root causes are Windows/py3.12 realities, not product bugs: - test_exit_1_when_unsafe / reconcile refuses-unsafe-base: both assumed '/tmp' is a sensitive base. It's sensitive only on POSIX; on Windows it's neither forbidden nor a root (and py<3.13 treats '/tmp' as absolute), so the gate returns 'safe-but-missing' (exit 2). Use a filesystem root as the unsafe base on Windows (refused on every platform). - test_rejects_symlinked_parent_escaping_base: on the two-drive CI runner (repo D:, tmp C:) the escaped target lands on a different mount, so relpath raises and the gate refuses with 'not relatable to base' instead of 'strictly under base'. Both mean refused; broaden the regex. - test_auto_gc_runs_when_no_tombstone / sweeps_other_namespace: dream-gc's worktree sweep relies on POSIX path/realpath semantics and no-ops across drives on the runner. Dream-mode Windows support is out of scope; skip only these two sweep-asserting tests (narrow, precise reason). Verified: Windows native 260 passed / 28 skipped for the 3 modules; native Linux 265 passed / 8 skipped (no regressions). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: c7ecd4cf-cc31-45e1-a660-82c2ad9b66af
Keep symlink coverage active on Linux and Windows runners that permit symlink creation, while allowing non-elevated local Windows suites to pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 2b51cdb2-48da-44a6-bb36-ac7b0ab36f16
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.
What
Makes the
windows-latestCI job green and actually runs the POSIX-shellintegration tests on Windows (via Git Bash) instead of skipping them.
1. dream-setup.sh: git < 2.48 default-branch fix
git symbolic-ref refs/remotes/origin/HEADexits non-zero whenorigin/HEADis unset (git < 2.48 does not auto-create it). Underset -euo pipefailthis aborted before theorigin/main/origin/masterfallback could run. Guarded with
|| true.2. Run bash integration tests on Windows via Git Bash
New
tests/_shell.pyresolves a real POSIX bash on Windows — Git Bash,never the
System32\bash.exeWSL launcher stub that a barebashresolvesto on the runner — and builds a PATH that makes
python3(a shim that execsthe test interpreter) and
git+ coreutils discoverable inside Git Bash. OnPOSIX both helpers are pass-throughs, so Linux behaviour is unchanged.
The seven bash-invoking modules now run the scripts via
BASH/shell_path()and skip only when no POSIX bash exists at all (
skipif(not HAVE_BASH)).3. Narrow, precisely-documented skips for irreducibly-POSIX cases
Only behaviour that cannot exist on Windows is skipped, each with an exact
reason:
send_signal(SIGTERM)hard-kills(
TerminateProcess), so the bashtrap 'exit 0' TERMcannot run.dream-gcworktree/gitdir tests — the script detects absolute gitdirtargets with the POSIX pattern
/*; Windows drive paths (C:\...) arenot POSIX-absolute, and
:is illegal in filenames./etc-style POSIX sensitive-base parametrizations.chmod(0o000)(does not remove read access on Windows).Also normalises a
git worktree listpath comparison and forces UTF-8subprocess I/O in the fault-injection matrix (Windows' cp1252 locale otherwise
can't encode the non-ASCII-path payload).
Verification
(was 827 passed / 246 skipped when the modules were blanket-skipped).
Continues the
[Windows port]series.