Skip to content

Skip a Symlink Test Where Windows Withholds the Privilege, and Run bash From PATH - #2508

Merged
ptr727 merged 9 commits into
developfrom
fix/windows-test-suite
Oct 8, 2026
Merged

ptr727 merged 9 commits into
developfrom
fix/windows-test-suite

Conversation

@ptr727

@ptr727 ptr727 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Summary

This is the first step of #2488. It covers the two shared causes behind most of the suite's Windows failures. The rest of #2488 stays open for follow-up pull requests.

  • Symlink fixtures. Windows refuses os.symlink with WinError 1314 unless Developer Mode is on or the process is elevated. The new tests/host_capability.py probes this once. The 16 tests that build a symlink fixture now skip there with that reason, and two older ad-hoc catches use the same helper. The two test_build_dist tests that mix symlink and plain cases keep running their plain cases on Windows.
  • A bare bash resolving to WSL. A bare "bash" passed to subprocess on Windows is resolved by CreateProcess, which searches System32 before PATH. That finds the WSL launcher, which re-parses the script through a second shell. This caused the read -a errors and most of the test_prose_lint, test_release_guards and test_publish_plan failures. The tests now run the first bash.exe on PATH that is neither the launcher nor a .cmd/.bat shim. Where there is none, as from a PowerShell PATH, they skip with a reason saying to run the suite from Git Bash.
  • The receipt case in test_local_review now quotes its script path, in POSIX form, inside its bash -c string, since bash consumed the Windows path's backslashes.

Linux CI is unaffected. There, can_symlink() is true, and bash_path() returns the same binary shutil.which("bash") did.

Measured on a Windows 11 host, from Git Bash

Before After
Failures 47 15
Errors 26 10
Skipped 82 96

From PowerShell, the bash-driven modules (test_configure_*, test_prose_lint, test_release_guards, test_publish_plan) now report OK with skips, where they failed before.

Still open under #2488

  • test_local_review, 15. These include two ReceiptCase tests that exit 120 on a closed pipe. That is a local_review.py Windows defect the WSL launcher had been masking by running the case under Linux.
  • test_spec_validate, test_host_gate, test_docker_lint, 7. These come from path-separator and output assumptions.
  • test_release_guards, 1 test. It fails under winget's jq 1.8.2, which rejects \S.

Refs #2488

🤖 Generated with Claude Code

ptr727 and others added 3 commits October 7, 2026 14:25
…sh From PATH

Adds tests/host_capability.py, probing once per run for the two host capabilities
most of the suite's Windows failures traced to.

A symlink fixture raises WinError 1314 on Windows without Developer Mode or
elevation, so the tests that build one now skip there with that reason, replacing
two ad-hoc catches, and the two tests mixing symlink and plain cases keep their
plain cases running.

A bare "bash" passed to subprocess on Windows resolves through CreateProcess to
System32's WSL launcher, which re-parses the script through a second shell. The
tests now run the bash on PATH, and skip where PATH's bash is that launcher.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A Git install that puts its usr/bin on PATH after System32 now runs the
bash-driven tests rather than skipping them, and a test that changes PATH can no
longer pin the answer every later test reads.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The receipt case put the script's Windows path into a bash -c string unquoted, so
bash consumed its backslashes, and it now passes it quoted in its POSIX form. On
Windows a PATH directory's bash.cmd or bash.bat shim is passed over as the WSL
launcher is, since cmd.exe re-parses the arguments the same way.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI lite review requested due to automatic review settings October 7, 2026 21:44
@coderabbitai

coderabbitai Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration
  • Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6ca56cb6-364c-43ab-a842-e85f796fce71
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.50%. Comparing base (e853b3a) to head (08f21e5).
⚠️ Report is 2 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2508   +/-   ##
========================================
  Coverage    58.50%   58.50%           
========================================
  Files           16       16           
  Lines         8066     8066           
========================================
  Hits          4719     4719           
  Misses        3347     3347           
Flag Coverage Δ
python-3.13 58.50% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Bash discovery has unresolved correctness and coverage issues, and one skip reason is inaccurate.

2 open findings
What changed in this PR

This PR improves Windows test portability with shared symlink checks, PATH-aware Bash resolution, and script-path quoting.

Changes:

  • Adds shared symlink and Bash capability helpers.
  • Skips unsupported symlink fixtures.
  • Uses a usable Bash executable and quotes the local review script path.
File Reviewed changes
tests/​test_skills_install.py Gates symlink-dependent tests.
tests/​test_release_guards.py Uses resolved Bash.
tests/​test_publish_plan.py Uses resolved Bash.
tests/​test_prose_lint.py Uses resolved Bash.
tests/​test_local_review.py Gates symlinks and quotes script paths.
tests/​test_docker_lint.py Gates symlink-dependent tests.
tests/​test_configure_usage.py Uses resolved Bash.
tests/​test_configure_settings_live.py Uses capability-aware Bash lookup; skip messaging needs correction.
tests/​test_configure_ruleset_id.py Uses resolved Bash.
tests/​test_configure_project.py Uses resolved Bash.
tests/​test_configure_environments.py Uses resolved Bash.
tests/​test_configure_archived.py Uses resolved Bash.
tests/​test_carry.py Gates symlink-dependent tests.
tests/​test_canonical_review.py Gates symlink-dependent tests.
tests/​test_build_dist.py Conditionally handles symlink fixtures.
tests/​host_capability.py Adds capability helpers; Bash selection and unit coverage require changes.

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread tests/host_capability.py Resolved
Comment thread tests/test_configure_settings_live.py Resolved
ptr727 and others added 3 commits October 7, 2026 14:51
…h in the Skip

The launcher and shim checks now compare paths through ntpath rather than
resolving them, behind a Windows flag a test can set, so test_host_capability
covers them and the PATH walk on Linux CI too. The live-settings case now skips
through bash_or_skip, so a PATH holding only the WSL launcher says to run the
suite from Git Bash rather than that bash is absent.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ubcase

shutil.which on Windows looks in the current directory before the directory it
is given, so a bash.exe there came back as a relative path that passed the
launcher check and shadowed every PATH entry. Each absolute PATH entry is now
probed for bash.exe itself, which also leaves a bash.cmd shim unconsidered. The
WindowsApps comparison applies only where LOCALAPPDATA is set. The two build_dist
cases mixing a symlink with plain paths now record a skip for the link case
rather than dropping it unseen.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A skip inside a subTest stops the loop under failfast, so with the link case in
the middle a host that cannot create a symlink ran none of the cases after it
under unittest -f. Taken last, every plain case runs first either way.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@ptr727 ptr727 added the comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses label Oct 8, 2026
@ptr727
ptr727 requested a lite review from Copilot October 8, 2026 02:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Three unresolved findings remain, including two critical Windows PATH issues.

3 open findings
2 resolved since last review

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread tests/test_configure_archived.py Resolved
Comment thread tests/test_configure_usage.py Resolved
Comment thread tests/host_capability.py Resolved
ptr727 and others added 3 commits October 7, 2026 19:37
The PATH walk skipped a relative or empty entry on every platform, where the
bare "bash" it replaced honored one on POSIX. Off Windows bash_path now defers to
shutil.which("bash") as before, and only Windows walks PATH itself.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git Bash converts an inherited Windows PATH by splitting it on semicolons, so a
colon-joined stub directory fused with the first inherited entry and bash lost
that entry, along with any tool only it held.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Git Bash splits PATH on colons, so a drive-letter directory assigned inside the
script became a relative C entry and a rooted path read against the current
drive, and from another drive the real jq answered in the stub's place. bash now
names the directory in its own form before prepending it.

Refs #2488

Co-Authored-By: Claude Opus 5.5 <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

tests/test_configure_settings_live.py detects a Bash path but does not pass it to the subprocess, leaving the Windows resolution issue unresolved.

1 open finding
3 resolved since last review

🧠 Review effort: Lite


Give feedback about Copilot approvals in this survey to enter a drawing for a $150 gift card.

Comment thread tests/test_configure_settings_live.py Resolved
@ptr727
ptr727 merged commit 8bdfa25 into develop Oct 8, 2026
13 checks passed
@ptr727
ptr727 deleted the fix/windows-test-suite branch October 8, 2026 03:16
ptr727 added a commit that referenced this pull request Oct 8, 2026
#2515)

## Summary

Promotes one change from `develop`:

- #2508: the unittest suite skips or runs cleanly on Windows for its two
widest failure classes.
- **Symlink fixtures.** Windows refuses `os.symlink` without Developer
Mode or elevation. The new `tests/host_capability.py` probes this once,
and the tests that build a symlink fixture skip there with that reason.
The two `test_build_dist` tests that mix symlink and plain cases keep
their plain cases, and take the link case last so that a failfast run
still reaches every plain case.
- **A bare `bash`.** A bare `bash` passed to `subprocess` on Windows
resolves to System32's WSL launcher, which re-parses the script. The
tests now run the first `bash.exe` on PATH that is neither the launcher
nor a shim. Off Windows they use `shutil.which("bash")` as before.
- Two `configure` tests now join their stub directory onto PATH with
`os.pathsep`, since Git Bash's PATH conversion fused a `:`-joined stub
with the first inherited entry. The `jq` carriage-return test resolves
its stub directory in bash, since a drive-letter path split at its
colon.
- `tests/test_host_capability.py` covers the Windows selection on any
host, Linux CI included.

Refs #2488, which stays open for the remaining Windows failures.

## Verification

- On a Windows 11 host from Git Bash, the suite went from 47 failures
and 26 errors to 15 and 10. None of the remaining failures is in the two
classes above.
- From PowerShell, the bash-driven modules skip cleanly with a
run-from-Git-Bash reason, where they failed before.
- The touched modules pass under Linux python, and every check on #2508
passed.
- Follow-ups filed from the review: #2513 (a pre-existing vacuous `jq`
stub test), and a singular overview variant noted on #2480.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comments Permits the comment lines the pull request adds or edits, which the prose gate otherwise refuses

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants