From dbf538972987c67a824ae7b26cba16dc2e6bc532 Mon Sep 17 00:00:00 2001 From: Suliman Abdulrazzaq Date: Thu, 17 Sep 2026 13:15:05 +0000 Subject: [PATCH] test(runtime): gate the Windows extended-path boundary test to Windows accepts_equivalent_extended_path_at_workspace_boundary builds its paths with backslash separators. Backslashes only separate path components on Windows, so on Linux each path is a single component, the boundary check rejects the path, and cargo test fails. Run the test only on Windows, and call validate_workspace_boundary through super:: so non-Windows test builds do not warn about an unused import. --- rust/crates/runtime/src/file_ops.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/rust/crates/runtime/src/file_ops.rs b/rust/crates/runtime/src/file_ops.rs index dfd4c463..7ad65c99 100644 --- a/rust/crates/runtime/src/file_ops.rs +++ b/rust/crates/runtime/src/file_ops.rs @@ -800,8 +800,8 @@ mod tests { use super::{ component_contains_glob, derive_glob_walk_root, edit_file, expand_braces, glob_search, grep_search, is_symlink_escape, normalize_for_comparison, read_file, - read_file_in_workspace, validate_workspace_boundary, write_file, write_file_in_workspace, - GrepSearchInput, MAX_WRITE_SIZE, + read_file_in_workspace, write_file, write_file_in_workspace, GrepSearchInput, + MAX_WRITE_SIZE, }; fn temp_path(name: &str) -> std::path::PathBuf { @@ -948,11 +948,13 @@ mod tests { ); } + // Backslash-separated paths only parse into path components on Windows. #[test] + #[cfg(windows)] fn accepts_equivalent_extended_path_at_workspace_boundary() { let root = PathBuf::from(r"C:\workspace"); let resolved = PathBuf::from(r"\\?\C:\workspace\src\main.rs"); - validate_workspace_boundary(&resolved, &root) + super::validate_workspace_boundary(&resolved, &root) .expect("equivalent Windows path representations should be accepted"); }