Repository navigation
Skip a Symlink Test Where Windows Withholds the Privilege, and Run bash From PATH - #2508
Conversation
…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]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟡 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.
…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]>
There was a problem hiding this comment.
🟡 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.
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]>
There was a problem hiding this comment.
🟡 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.
#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)



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.
os.symlinkwith WinError 1314 unless Developer Mode is on or the process is elevated. The newtests/host_capability.pyprobes 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 twotest_build_disttests that mix symlink and plain cases keep running their plain cases on Windows.bashresolving to WSL. A bare"bash"passed tosubprocesson 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 theread -aerrors and most of thetest_prose_lint,test_release_guardsandtest_publish_planfailures. The tests now run the firstbash.exeon PATH that is neither the launcher nor a.cmd/.batshim. Where there is none, as from a PowerShell PATH, they skip with a reason saying to run the suite from Git Bash.test_local_reviewnow quotes its script path, in POSIX form, inside itsbash -cstring, since bash consumed the Windows path's backslashes.Linux CI is unaffected. There,
can_symlink()is true, andbash_path()returns the same binaryshutil.which("bash")did.Measured on a Windows 11 host, from Git Bash
From PowerShell, the bash-driven modules (
test_configure_*,test_prose_lint,test_release_guards,test_publish_plan) now reportOKwith skips, where they failed before.Still open under #2488
test_local_review, 15. These include twoReceiptCasetests that exit 120 on a closed pipe. That is alocal_review.pyWindows 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