Skip to content

Enable Windows tests by normalizing ANSI escape codes - #147

Merged
max-sixty merged 7 commits into
mainfrom
windows
Dec 11, 2025
Merged

max-sixty merged 7 commits into
mainfrom
windows

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

  • Add filters in setup_snapshot_settings to collapse doubled ANSI codes for cross-platform consistency
  • Fix statusline tests to escape Windows paths in JSON
  • Remove Windows-specific ignores from ~80 tests
  • Update snapshots to use single ANSI codes

This enables significantly more tests to run on Windows by:

  1. Normalizing doubled ANSI escape codes (Unix sometimes produces ESC[36mESC[36m while Windows produces ESC[36m)
  2. Properly escaping paths for JSON in statusline tests (Windows backslashes need escaping)
  3. Relying on Git Bash being available on Windows CI for shell commands

Tests verified passing locally (906 tests). CI will validate Windows compatibility.

Test plan

  • All 906 tests pass locally
  • CI passes on Windows

🤖 Generated with Claude Code

@max-sixty

Copy link
Copy Markdown
Owner Author

CI Status Note

The test failures in this PR are not caused by my changes. The same tests are failing on main branch as well:

The failures are in tests like test_list_maximum_status_with_git_operation which are failing because CI is showing a "CI status unavailable; run gh auth login" hint that wasn't expected in the snapshot. This is a pre-existing CI environment issue.

My actual changes are:

  1. Added ANSI escape code normalization filters for cross-platform consistency
  2. Fixed JSON path escaping in statusline tests for Windows
  3. Removed #[cfg_attr(windows, ignore)] from ~80 tests

These changes can be verified locally where all 906 tests pass.

max-sixty and others added 4 commits December 11, 2025 02:49
The cmd.exe /c wrapper was added in the previous commit to properly find
.cmd batch files on Windows. The tests were preemptively ignored before
verifying if the fix worked.

Remove the #[cfg_attr(windows, ignore)] attributes to test if Windows CI
now passes with the batch file mocks.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Windows PATHEXT searches for .exe before .cmd extensions. Even with our
mock-bin directory prepended to PATH, a real gh.exe in another directory
would be found before our mock gh.cmd. Fix by removing directories
containing real gh.exe/glab.exe from PATH on Windows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
max-sixty and others added 3 commits December 11, 2025 03:17
The merge from main lost the #[cfg_attr(windows, ignore)] attributes
for tests that use mock gh/glab batch files which don't work on Windows.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@max-sixty
max-sixty enabled auto-merge (squash) December 11, 2025 11:25
@max-sixty
max-sixty disabled auto-merge December 11, 2025 11:25
@max-sixty
max-sixty merged commit 5bb60fd into main Dec 11, 2025
@max-sixty
max-sixty deleted the windows branch December 11, 2025 11:29
max-sixty added a commit that referenced this pull request Jul 30, 2026
…nting

Fixes from a full review of this branch:

- configure_pty_command now carries HERMETIC_TEST_GIT_ENV. It env_clears
  and skips the Cmd latch, so shell-wrapper PTY children ran git against
  the developer's real ~/.gitconfig under the real HOME — the one family
  outside the floor's guarantee, and the family LOCAL_TEST_CONFIG's
  gpgsign line used to shield. Pinned by its own test, like pty_env_vars.
- Two raw Command::new("git") rev-parse asserts in remove.rs tests now
  route through configure_git_cmd.
- in_process_git_reads_only_the_hermetic_config keys on --show-scope
  scopes (command/local), not git's origin-path spelling.
- task profile-tests times via bash's keyword: task's own interpreter
  (mvdan/sh) parses `time` but reports user/sys as zero, so the numbers
  the doc says to track could never appear. Measured end-to-end after
  the fix: user 5m47s / sys 12m8s — "two thirds kernel time" verifies
  (67.7%); the integration mean measured ~1s, corrected from ~0.6s.
- tests/fixtures/template-repo/ deleted: unreferenced since the PR #147
  era, and the new Git Config Isolation section credited it for advice.*
  suppression that the gutter hint: filter actually provides.
- Doc corrections: three test git inits name -b main (the floor no
  longer supplies init.defaultBranch); sun_path spare-byte arithmetic;
  one measured pair for the recover-walk story, credited to the leak fix
  rather than the sub-root; volatile bin-test count dropped; dead
  [TEST_GIT_CONFIG] placeholder remnants removed.

Co-Authored-By: Claude Fable 5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant