Skip to content

test(windows): fix secret_scan + uninstall path assertions on Windows#507

Merged
Xoshbin merged 1 commit into
Xoshbin:mainfrom
dose-dot-dev:fix/secret-scan-uninstall-tests-windows
Jul 14, 2026
Merged

test(windows): fix secret_scan + uninstall path assertions on Windows#507
Xoshbin merged 1 commit into
Xoshbin:mainfrom
dose-dot-dev:fix/secret-scan-uninstall-tests-windows

Conversation

@dose-dot-dev

Copy link
Copy Markdown
Contributor

Final slice of the 38 Windows test failures surfaced once #499 made cargo test loadable on Windows (context in #498). Test-only — no product change.

The failures

  • ext_builder::secret_scan (2 tests) — the expected offending path was built with dir.join("src/config.ts"). On Windows the forward-slash suffix stays literal (backslash root + /config.ts), while the scanner walks the tree and returns a native all-backslash path, so the equality assertion differed only by separator. Build the expected with sequential .join("src").join("config.ts") so it uses the native separator.
  • application::uninstall::…::validate_data_path_rejects_missing (1 test) — it passed "/tmp/__asyar_nonexistent_data_path__", which is not absolute on Windows, so validate_data_path_under_home returned its Validation("must be absolute") error before reaching the missing-path (NotFound) branch the test asserts. Derive an absolute-but-missing path from the fake home's temp dir instead, so the missing-path check is what fires on every platform.

Verification

  • Windows 11: cargo test secret_scan and cargo test uninstall green, including the three previously-failing tests.
  • Linux (WSL): full cargo test green (known fs_watcher inotify env failure aside); cargo clippy --all-targets -- -D warnings and cargo fmt clean.

Context

This is the last of the Windows test-portability fixes. With #503#506 and this PR, cargo test passes on Windows except for the 6 agents::builtin_tools::shell_test cases, which are intentionally left alone because a separate in-flight PR reworks that area.

🤖 Generated with Claude Code

Two Windows-only test failures, both fixture-side:

- ext_builder::secret_scan: the expected offending path was built with
  dir.join("src/config.ts"), whose forward-slash suffix stays literal on
  Windows (backslash root + "/config.ts"), while the scanner returns a
  native all-backslash path. Build the expected with sequential joins so
  it uses the native separator.
- application::uninstall: validate_data_path_rejects_missing passed
  "/tmp/__asyar_nonexistent_data_path__", which is not absolute on
  Windows, so the absolute-path check rejected it before the missing-path
  check the test asserts (NotFound). Derive an absolute-but-missing path
  from the fake home's temp dir instead.

Fixes the last of the 38 Windows failures surfaced by Xoshbin#499 (see Xoshbin#498),
excluding the 6 agents::builtin_tools::shell_test cases deliberately left
for the in-flight agents rework. No product change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MGJAx66y29o33szDvVYTBH

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request improves cross-platform compatibility in the test suite by replacing hardcoded Unix-style file paths with platform-independent path constructions using PathBuf::join. Specifically, it updates tests in uninstall.rs and secret_scan.rs to ensure they run correctly on Windows as well as Unix-like systems. There are no review comments to address, and I have no additional feedback to provide.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@Xoshbin Xoshbin merged commit 2acce1b into Xoshbin:main Jul 14, 2026
1 check passed
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.

2 participants