From 251ac943aca808905c29a53858ac924c785ff16e Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 13:25:29 +0000 Subject: [PATCH 1/2] Start Windows test path separator fix Refs #2177. Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_011f9aeSxwTj97uP4xQonHdq From 15fbac0b2093c91f40e05fb2c275eaafea1a1a7d Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 20 Nov 2026 13:35:07 +0000 Subject: [PATCH 2/2] Fix path separators in Windows test groups Three groups of tests failed on Windows in the nightly run. Each one built the path it expects from a '/'-separated string and compared it as text with a path made component by component: - gem_refresh: the rm command of a shared gem home joined "specifications/rack-1.0.0.gemspec" in one piece, where the product joins the directory and the file name. - Java gem e2e: vendor_rel kept the '/' of the strings gem_dir was joined from, where the directory walk yields '\'. - get update summary e2e: the save line names the manifest as --cwd joined with the manifest path, '.\.socket/manifest.json' on Windows. The tests now build their expected paths the way the other side does. No product code changes. Fixes #2177 Assisted-by: Claude Code:claude-fable-5-2 Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_011f9aeSxwTj97uP4xQonHdq --- .../socket-patch-cli/src/commands/gem_refresh.rs | 8 ++++---- .../tests/e2e_gem_native_ext_build.rs | 9 ++++----- .../tests/get/get_update_summary_e2e.rs | 15 +++++++++++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index 09e59f8ee..35c3df66c 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -1665,10 +1665,10 @@ mod tests { `rm -f {} {} {} {} && bundle install`; another project that still pins \ the hosted patch of them then loads the upstream code, which \ `socket-patch scan` reports there.", - shell_word(&home.join("specifications/rack-1.0.0.gemspec")), - shell_word(&home.join("cache/rack-1.0.0.gem")), - shell_word(&home.join("specifications/rexml-1.0.0.gemspec")), - shell_word(&home.join("cache/rexml-1.0.0.gem")), + shell_word(&home.join("specifications").join("rack-1.0.0.gemspec")), + shell_word(&home.join("cache").join("rack-1.0.0.gem")), + shell_word(&home.join("specifications").join("rexml-1.0.0.gemspec")), + shell_word(&home.join("cache").join("rexml-1.0.0.gem")), ), ] ); diff --git a/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs b/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs index bcf025be1..a19239eb0 100644 --- a/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs +++ b/crates/socket-patch-cli/tests/e2e_gem_native_ext_build.rs @@ -3183,11 +3183,10 @@ impl JavaGem { /// The gem file `file` as [`walk_files`] of `vendor/` names it. fn vendor_rel(&self, file: &str) -> String { - let mut path = self - .gem_dir - .strip_prefix(self.proj.join("vendor")) - .unwrap() - .to_path_buf(); + // Component by component: `gem_dir` was joined from `/` strings, + // and Windows would keep those separators where the walk has `\`. + let rel = self.gem_dir.strip_prefix(self.proj.join("vendor")).unwrap(); + let mut path: PathBuf = rel.components().collect(); path.extend(file.split('/')); path.display().to_string() } diff --git a/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs b/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs index b7f742870..60bb9bce2 100644 --- a/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs +++ b/crates/socket-patch-cli/tests/get/get_update_summary_e2e.rs @@ -88,6 +88,16 @@ async fn mount_mocks(mock: &MockServer) { .await; } +/// The manifest as the save line names it: the default `--cwd` (`.`) joined +/// with the default manifest path, so `./.socket/manifest.json` on Unix and +/// `.\.socket/manifest.json` on Windows. +fn manifest_label() -> String { + std::path::Path::new(".") + .join(".socket/manifest.json") + .display() + .to_string() +} + /// Run `get --save-only` against `mock`, returning `(code, stdout, stderr)`. fn run_get(cwd: &std::path::Path, uri: &str) -> (i32, String, String) { common::run( @@ -122,7 +132,8 @@ async fn replacing_a_manifest_entry_is_reported_as_updated_only() { assert!( stderr.ends_with(&format!( " [update] {PURL} (replacing 00000000)\n\ - Saved 1 patch to ./.socket/manifest.json (1 updated).\n" + Saved 1 patch to {} (1 updated).\n", + manifest_label() )), "the replacement must be reported as one saved patch, an update, never also an add; \ stdout={stdout}\nstderr={stderr}" @@ -148,7 +159,7 @@ async fn a_brand_new_entry_is_still_reported_as_added() { assert_eq!(code, 0, "save-only add must succeed; stderr={stderr}"); assert!( - stderr.ends_with("Saved 1 patch to ./.socket/manifest.json.\n"), + stderr.ends_with(&format!("Saved 1 patch to {}.\n", manifest_label())), "a new entry must be reported as one saved patch; stdout={stdout}\nstderr={stderr}" ); assert!(