fix(windows): native Windows correctness fixes + green CLI test suite - #823
Open
hashbender wants to merge 1 commit into
Open
fix(windows): native Windows correctness fixes + green CLI test suite#823hashbender wants to merge 1 commit into
hashbender wants to merge 1 commit into
Conversation
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 does this PR do?
Running the test suite natively on Windows (not WSL) surfaced 16 failures across
tests/cli,tests/gateway, andtests/tools. Triaging them found 4 real product bugs plus a handful of POSIX assumptions in the tests themselves. With this PR,pytest tests/cli tests/gateway/test_status.py tests/tools/test_windows_native_support.py tests/test_windows_subprocess_no_window_flags.pyis fully green on native Windows (1180 passed, 5 legitimately skipped) and stays green on POSIX.Product fixes
gateway/status.py,hermes_cli/gateway.py):_command_line_belongs_to_profilecomparedstr(Path)(backslashes on Windows) againstHERMES_HOME=argv values that may carry forward slashes (wmic/CIM output, Git Bash, JSON configs) — a live named-profile gateway could be reported not-running by the dashboard's cross-profile check. Both sides now normalize to forward slashes.cprintcrashes when stdout has no console (hermes_cli/banner.py): prompt_toolkit'sWin32OutputraisesNoConsoleScreenBufferErrorunderpythonw.exe, CI, or redirected stdout. A display helper should never crash its caller — it now degrades to plainprint, matching the fallbackcli._cprintalready has.file:///C:/...drops don't resolve (cli.py): urlparse keeps the leading slash (/C:/...); it is now stripped for drive-letter paths so dragging a file into the CLI works on Windows.os.path.join(cli.pytermux hint,hermes_cli/browser_connect.pyWSL chrome candidates): produced/sdcard\Pictures\cat.pngon native Windows. Joined with literal forward slashes /posixpath.join.Test-suite fixes
tests/cli/conftest.py: 9 test modules build a CLI viaimportlib.reload(cli)with prompt_toolkit stubbed insys.modules.reload()re-executes into the same module dict, so the MagicMock bindings (_pt_print,_PT_ANSI, ...) survive thepatch.dictcontext and silently swallow_cprintoutput in any later test (this is what madetest_resume_quiet_stderrorder-dependent). An autouse module-scoped fixture restores the real bindings when the pollution is detected._can_symlink()convention fromtest_symlink_prefix_confusion.py.USERPROFILEalongsideHOME(ntpath.expanduserignoresHOMEsince Python 3.8).test_windows_native_support.py: two tests violated the file's own "every test mocks the platform" contract — the no-op test now mocksis_windows(), and the real-SIGKILL assertion is skipped on win32.Related Issue
Follow-up to the native-Windows work in NousResearch#43933 and NousResearch#54565.
Type of Change
Changes Made
gateway/status.py,hermes_cli/gateway.py— separator-normalized profile matchinghermes_cli/banner.py— cprint console fallbackcli.py— file URI drive-letter fix, termux hint posix joinhermes_cli/browser_connect.py— posixpath.join for WSL candidatestests/cli/conftest.py(new) — un-polluteclimodule after stubbed reloadstests/cli/*,tests/gateway/test_status.py,tests/tools/test_windows_native_support.py— Windows-safe tests + regression coverageHow to Test
python -m pytest tests/cli tests/gateway/test_status.py tests/tools/test_windows_native_support.py tests/test_windows_subprocess_no_window_flags.py→ previously 16 failures, now green (1180 passed, 5 skipped).python scripts/check-windows-footguns.py --all→ clean.🤖 Generated with Claude Code
Mirror-of: NousResearch#57016
NousResearch#57016