From 777b82c9525037994ca500d49c2ac3d55ea13012 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:23:10 +0000 Subject: [PATCH 1/7] Start fix for gem remedy tests on Windows Refs #2276. Assisted-by: Claude Code:claude-fable-5-2 From 3034869adec6ccdec2954a3b43774c464da1f5a7 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:28:38 +0000 Subject: [PATCH 2/7] Quote paths in gem remedy test expectations Two gem_refresh unit tests built the expected `rm -rf ... && bundle install` command from Path::display(), but the code renders each path of that command through shell_word, which single-quotes a path holding a character outside its safe set. A Windows temp path holds a backslash, so both tests failed on the Windows nightly. A temp dir with a space in its path fails them the same way on Linux. Build the expected commands with shell_word. The warning detail lists the paths unquoted, so its assertions stay as they are. Fixes #2276. Assisted-by: Claude Code:claude-fable-5-2 --- crates/socket-patch-cli/src/commands/gem_refresh.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index f23b3f4d8c..756998a677 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -2393,11 +2393,13 @@ mod tests { x86_64-linux/3.3.0/json-1.0.0, but the installed extension is /p/ruby/\ 3.2.0/extensions/x86_64-linux/3.2.0/json-1.0.0 (another Ruby's))"; let policy = policy(tmp.path(), true, false, false); + // The command quotes a path as `shell_word` does (a Windows path + // holds `\`); the warning's detail below lists the paths as they are. let command = format!( "`rm -rf {} {} {} && bundle install`", - dir.display(), - spec.display(), - cache.display() + shell_word(&dir), + shell_word(&spec), + shell_word(&cache) ); let pass = failed_for(&gem, reason); @@ -2473,7 +2475,7 @@ mod tests { assert!( bullet.contains(&format!( "racc 1.0.0. Run `rm -rf {} && bundle install`", - dir.display() + shell_word(&dir) )), "{bullet}" ); From ebf0df9666a56f560eeadd2f5a53047e41855077 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 26 Nov 2026 09:36:22 +0000 Subject: [PATCH 3/7] Build gem remedy test paths as the code does a_copy_no_ruby_owns_is_removed_with_its_gem_dir joined `specifications/json-1.0.0.gemspec` onto the gem home as one component. The code joins the directory and the file name apart, so on Windows the test's path kept a `/` where the remedy has a `\\`, and the expected command and detail would still not match there. the_rm_remedy_quotes_a_path_the_shell_would_split wrapped display() in literal quotes, which breaks under a temp dir with a `'` in its path. It now uses shell_word too. Refs #2276. Assisted-by: Claude Code:claude-fable-5-2 --- crates/socket-patch-cli/src/commands/gem_refresh.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/src/commands/gem_refresh.rs b/crates/socket-patch-cli/src/commands/gem_refresh.rs index 756998a677..c38d3baad6 100644 --- a/crates/socket-patch-cli/src/commands/gem_refresh.rs +++ b/crates/socket-patch-cli/src/commands/gem_refresh.rs @@ -1986,9 +1986,9 @@ mod tests { let tmp = tempfile::tempdir().unwrap(); let (proj, home) = (tmp.path().join("proj"), tmp.path().join("Jane Doe/gemhome")); std::fs::create_dir_all(&proj).unwrap(); - let file = |dir: &str, name: &str| home.join(dir).join(name).display().to_string(); + let file = |dir: &str, name: &str| shell_word(&home.join(dir).join(name)); let expected = format!( - "run `rm -f '{}' '{}' && bundle install`", + "run `rm -f {} {} && bundle install`", file("specifications", "rack-1.0.0.gemspec"), file("cache", "rack-1.0.0.gem") ); @@ -2384,8 +2384,10 @@ mod tests { let home = tmp.path().join("vendor/bundle/ruby/3.2.0"); let gem = installed("json", &home, true); let (dir, _) = gem.installed.clone().unwrap(); - let spec = home.join("specifications/json-1.0.0.gemspec"); - let cache = home.join("cache/json-1.0.0.gem"); + // Joined a component at a time, as the code builds them: on Windows + // a `/` inside a component stays a `/`. + let spec = home.join("specifications").join("json-1.0.0.gemspec"); + let cache = home.join("cache").join("json-1.0.0.gem"); std::fs::create_dir_all(home.join("cache")).unwrap(); std::fs::write(&cache, "").unwrap(); let reason = "its native extension could not be rebuilt: no Ruby owning this install \ From f3ec66913e18f25730adfa52cf666806ebf1da17 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Mon, 30 Nov 2026 11:19:43 -0500 Subject: [PATCH 4/7] Pin the PyPI Docker fixture to the tested PDM lock format --- crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs | 2 +- tests/docker/Dockerfile.pypi | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs b/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs index 64f71627e4..88d4daca9e 100644 --- a/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs +++ b/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs @@ -3,7 +3,7 @@ //! //! Each test proves the CLI_CONTRACT "Vendor command contract" pypi row end //! to end for one Python tool against the REAL tool baked into -//! `socket-patch-test-pypi:latest` (Poetry 2.x, PDM 2.27, pipenv 2026.x; +//! `socket-patch-test-pypi:latest` (Poetry 2.x, PDM 2.29.2, pipenv 2026.x; //! Python 3.11), with state carried across containers via a bind-mounted host //! tempdir (see `docker_vendor_common/mod.rs`): //! diff --git a/tests/docker/Dockerfile.pypi b/tests/docker/Dockerfile.pypi index 01e5c178ce..c7c2434e6b 100644 --- a/tests/docker/Dockerfile.pypi +++ b/tests/docker/Dockerfile.pypi @@ -14,13 +14,15 @@ # are unaffected. FROM socket-patch-test-base:latest +# PDM 2.29.2 writes lock format 4.5.1, covered by the native compatibility +# matrix. Update this pin when the rewriter supports a newer format. RUN apt-get update \ && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ python3-venv \ && rm -rf /var/lib/apt/lists/* \ - && pip3 install --break-system-packages --no-cache-dir uv poetry pdm hatch pipenv \ + && pip3 install --break-system-packages --no-cache-dir uv poetry pdm==2.29.2 hatch pipenv \ && python3 --version \ && pip3 --version \ && uv --version \ From 93161ddbf0c5389e137ae415ec40d6dc5c966998 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Mon, 30 Nov 2026 11:34:33 -0500 Subject: [PATCH 5/7] Use the compatible hishel API with the pinned PDM release --- tests/docker/Dockerfile.pypi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/docker/Dockerfile.pypi b/tests/docker/Dockerfile.pypi index c7c2434e6b..15b006b63a 100644 --- a/tests/docker/Dockerfile.pypi +++ b/tests/docker/Dockerfile.pypi @@ -15,14 +15,14 @@ FROM socket-patch-test-base:latest # PDM 2.29.2 writes lock format 4.5.1, covered by the native compatibility -# matrix. Update this pin when the rewriter supports a newer format. +# matrix. That release uses the hishel 1.x HTTP cache API. RUN apt-get update \ && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ python3-venv \ && rm -rf /var/lib/apt/lists/* \ - && pip3 install --break-system-packages --no-cache-dir uv poetry pdm==2.29.2 hatch pipenv \ + && pip3 install --break-system-packages --no-cache-dir uv poetry pdm==2.29.2 'hishel<2' hatch pipenv \ && python3 --version \ && pip3 --version \ && uv --version \ From e50e1e05104ba2687ae9a1a5211e57b6335ef4f8 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Mon, 30 Nov 2026 11:35:44 -0500 Subject: [PATCH 6/7] Use the last PDM release that writes lock format 4.5.1 --- crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs | 2 +- tests/docker/Dockerfile.pypi | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs b/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs index 88d4daca9e..43e291aaa5 100644 --- a/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs +++ b/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs @@ -3,7 +3,7 @@ //! //! Each test proves the CLI_CONTRACT "Vendor command contract" pypi row end //! to end for one Python tool against the REAL tool baked into -//! `socket-patch-test-pypi:latest` (Poetry 2.x, PDM 2.29.2, pipenv 2026.x; +//! `socket-patch-test-pypi:latest` (Poetry 2.x, PDM 2.29.7, pipenv 2026.x; //! Python 3.11), with state carried across containers via a bind-mounted host //! tempdir (see `docker_vendor_common/mod.rs`): //! diff --git a/tests/docker/Dockerfile.pypi b/tests/docker/Dockerfile.pypi index 15b006b63a..c3c92ac351 100644 --- a/tests/docker/Dockerfile.pypi +++ b/tests/docker/Dockerfile.pypi @@ -14,15 +14,15 @@ # are unaffected. FROM socket-patch-test-base:latest -# PDM 2.29.2 writes lock format 4.5.1, covered by the native compatibility -# matrix. That release uses the hishel 1.x HTTP cache API. +# PDM 2.29.7 writes lock format 4.5.1. Bump this pin when the rewriter +# supports the 4.6.0 format introduced in PDM 2.29.8. RUN apt-get update \ && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ python3-venv \ && rm -rf /var/lib/apt/lists/* \ - && pip3 install --break-system-packages --no-cache-dir uv poetry pdm==2.29.2 'hishel<2' hatch pipenv \ + && pip3 install --break-system-packages --no-cache-dir uv poetry pdm==2.29.7 hatch pipenv \ && python3 --version \ && pip3 --version \ && uv --version \ From 96b1a4709fd9b1593a95994e895c1b3f6b16d9d4 Mon Sep 17 00:00:00 2001 From: Mikola Lysenko Date: Tue, 1 Dec 2026 14:58:49 -0500 Subject: [PATCH 7/7] Install the pinned PDM with its locked dependencies, and say which PDM locks are refused The image pinned PDM but let PDM's own dependencies float, so a rebuild could still install a set that 2.29.7 never shipped with. PDM now gets its own venv and its `locked` extra. PDM_CHECK_UPDATE is off, so a log does not tell its reader to upgrade past the pin. The PDM compatibility guide said "2.8.1 - current" is supported. PDM 2.29.8 writes lock format 4.6.0, which hosted and vendored mode refuse (#2398): the guide now ends the supported range at 2.29.7 and lists the 4.6.0 row. The suite's header names the Dockerfile's pin and no longer repeats its version. Co-Authored-By: Claude Fable 5.2 --- .../tests/docker_e2e_vendor_pypi_pm.rs | 5 +++-- docs/testing/pdm-compatibility.md | 7 ++++--- tests/docker/Dockerfile.pypi | 17 ++++++++++++++--- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs b/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs index 43e291aaa5..69944b336e 100644 --- a/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs +++ b/crates/socket-patch-cli/tests/docker_e2e_vendor_pypi_pm.rs @@ -3,8 +3,9 @@ //! //! Each test proves the CLI_CONTRACT "Vendor command contract" pypi row end //! to end for one Python tool against the REAL tool baked into -//! `socket-patch-test-pypi:latest` (Poetry 2.x, PDM 2.29.7, pipenv 2026.x; -//! Python 3.11), with state carried across containers via a bind-mounted host +//! `socket-patch-test-pypi:latest` (Poetry 2.x, pipenv 2026.x and the PDM +//! release `tests/docker/Dockerfile.pypi` pins; Python 3.11), with state +//! carried across containers via a bind-mounted host //! tempdir (see `docker_vendor_common/mod.rs`): //! //! stage 1 (networked): create a real single-dep project on `six==1.16.0` diff --git a/docs/testing/pdm-compatibility.md b/docs/testing/pdm-compatibility.md index 6db236f34a..dbe04e9130 100644 --- a/docs/testing/pdm-compatibility.md +++ b/docs/testing/pdm-compatibility.md @@ -31,8 +31,9 @@ span-based edits, and produces byte-exact fragments for replay. The | PDM 1.8 – 1.15 | `3.1` | **Refused** (`unsupported PDM lock_version`): native dependency lookup loses URL/path candidate identity before install, so a rewrite would not resolve. The original registry lock still installs. | Refused for the same reason. | | PDM 2.0 – 2.7 | `4.0` / `4.1` / `4.2` | **Refused** (same identity loss). | Refused. | | PDM 2.8.0 | `4.3` | **Accepted but not installable.** 2.8.0 writes the `4.3` grammar yet still loses `url`/`path` candidate identity (fixed in 2.8.1), so `pdm sync` on the rewritten lock crashes with `KeyError`. A 2.8.0 lock is byte-identical to a 2.8.1 lock and records no PDM version, so the rewriter cannot refuse it by format — upgrade to ≥ 2.8.1. | Same crash. | -| PDM 2.8.1 – current | `4.3` / `4.4` / `4.4.1` / `4.5.0` / `4.5.1` | `url` + single `{file, hash}`; `static_urls` locks keep their `{url, hash}` file shape. | Local-file `path` + `{file, hash}`. | -| Any future `lock_version` | unknown | **Refused** until the format is tested (fail-closed). | Refused. | +| PDM 2.8.1 – 2.29.7 | `4.3` / `4.4` / `4.4.1` / `4.5.0` / `4.5.1` | `url` + single `{file, hash}`; `static_urls` locks keep their `{url, hash}` file shape. | Local-file `path` + `{file, hash}`. | +| PDM 2.29.8 and later | `4.6.0` | **Refused** (`unsupported PDM lock_version`): the format is not tested yet (#2398). The original registry lock still installs. | Refused for the same reason. | +| Any other `lock_version` | unknown | **Refused** until the format is tested (fail-closed). | Refused. | Both modes retain the package version, extras, groups, markers and the `content_hash`; no `pyproject.toml` edit is required. A repeated scan leaves the @@ -70,7 +71,7 @@ whose filename does not match the locked package. | 1.8 – 1.15 | 3.1 | refused | refused | supported | — | native install of the original registry lock is unaffected. | | 2.0 – 2.7 | 4.0–4.2 | refused | refused | supported | — | same identity-loss boundary. | | 2.8.0 | 4.3 | crashes | crashes | supported | — | rewrite accepted but `pdm sync`/`pdm install` raise `KeyError` (identity loss, fixed in 2.8.1); agent mode is unaffected. Upgrade to ≥ 2.8.1. | -| 2.8.1 – current | 4.3–4.5.1 | supported | supported | supported | yes | `pdm sync` + `pdm install --check`; static_urls, extras, markers, multi-target and PEP 735 dependency-groups all pass. | +| 2.8.1 – 2.29.7 | 4.3–4.5.1 | supported | supported | supported | yes | `pdm sync` + `pdm install --check`; static_urls, extras, markers, multi-target and PEP 735 dependency-groups all pass. | Measured details: diff --git a/tests/docker/Dockerfile.pypi b/tests/docker/Dockerfile.pypi index c3c92ac351..0fb36e595f 100644 --- a/tests/docker/Dockerfile.pypi +++ b/tests/docker/Dockerfile.pypi @@ -14,15 +14,26 @@ # are unaffected. FROM socket-patch-test-base:latest -# PDM 2.29.7 writes lock format 4.5.1. Bump this pin when the rewriter -# supports the 4.6.0 format introduced in PDM 2.29.8. +# PDM is pinned to 2.29.7, the last release that writes lock format 4.5.1. +# PDM 2.29.8 writes 4.6.0, which the rewriter refuses (#2398): lift the pin +# when that format is supported. PDM gets its own venv and its `locked` +# extra, so its dependencies are the set that release shipped with and not +# whatever is newest on the day the image is built. +# +# uv, poetry, hatch and pipenv are not pinned: the nightly rebuild installs +# their newest release, which is how a release that breaks a suite shows up. +# PDM_CHECK_UPDATE keeps PDM from printing an upgrade notice on every command. +ENV PDM_CHECK_UPDATE=false RUN apt-get update \ && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ python3-venv \ && rm -rf /var/lib/apt/lists/* \ - && pip3 install --break-system-packages --no-cache-dir uv poetry pdm==2.29.7 hatch pipenv \ + && pip3 install --break-system-packages --no-cache-dir uv poetry hatch pipenv \ + && python3 -m venv /opt/pdm \ + && /opt/pdm/bin/pip install --no-cache-dir 'pdm[locked]==2.29.7' \ + && ln -s /opt/pdm/bin/pdm /usr/local/bin/pdm \ && python3 --version \ && pip3 --version \ && uv --version \