From 89fef8d61d54630825663f6d471f62c63ac8710b Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 01:30:57 +0000 Subject: [PATCH 1/4] Start fix for package-less PyPI tool locks Refs #1114. Assisted-by: Claude Code:claude-fable-5-2 From 410f513c73c476ba60224f5b4e9dd95bd91493a1 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 01:40:16 +0000 Subject: [PATCH 2/4] Add failing test for package-less tool lock A Poetry or PDM project whose lock resolves no packages and whose pins live in requirements.txt must vendor through requirements.txt. Today vendor routes to the tool lock and refuses the package. Refs #1114. Assisted-by: Claude Code:claude-fable-5-2 --- .../tests/mode_migration_pypi.rs | 58 +++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/crates/socket-patch-cli/tests/mode_migration_pypi.rs b/crates/socket-patch-cli/tests/mode_migration_pypi.rs index ed698da70..f8c046fcf 100644 --- a/crates/socket-patch-cli/tests/mode_migration_pypi.rs +++ b/crates/socket-patch-cli/tests/mode_migration_pypi.rs @@ -367,6 +367,64 @@ fn stage_requirements(root: &Path) -> &'static [&'static str] { &["requirements.txt"] } +/// #1114: a Poetry or PDM project that declares no dependencies has a lock +/// with no packages, and installs its pins from requirements.txt. `vendor` +/// wires requirements.txt and leaves the lock alone. Before the fix it +/// routed to the tool lock and refused the package +/// (`pypi_poetry_lock_package_missing` / `pypi_pdm_lock_package_missing`, +/// "run `poetry lock` first", which writes the same empty lock again). +#[tokio::test] +async fn packageless_tool_lock_beside_requirements_vendors_requirements() { + for (lock, content, pyproject) in [ + ( + "poetry.lock", + "package = []\n\n[metadata]\nlock-version = \"2.1\"\npython-versions = \">=3.9\"\n", + "[tool.poetry]\nname = \"proj\"\nversion = \"0.1.0\"\n", + ), + ( + "pdm.lock", + "[metadata]\ngroups = [\"default\"]\nstrategy = [\"inherit_metadata\"]\n\ + lock_version = \"4.5.0\"\n", + "[project]\nname = \"proj\"\nversion = \"0.1.0\"\n\n[tool.pdm]\n\ + distribution = false\n", + ), + ] { + let (_tmp, root) = project(); + std::fs::write(root.join(lock), content).unwrap(); + std::fs::write(root.join("pyproject.toml"), pyproject).unwrap(); + let files = stage_requirements(&root); + stage_manifest(&root); + + let (code, env) = run_cli(&root, &["vendor"], &[]); + assert_eq!(code, 0, "{lock}: vendor: {env:#}"); + let requirements = std::fs::read_to_string(root.join(files[0])).unwrap(); + assert!( + requirements.contains(&format!(".socket/vendor/pypi/{UUID}/")) + && requirements.contains("# socket-patch vendor: six==1.16.0"), + "{lock}: requirements.txt is wired: {requirements}" + ); + assert_eq!( + std::fs::read_to_string(root.join(lock)).unwrap(), + content, + "{lock}: the package-less lock is left alone" + ); + let text = env.to_string(); + assert!( + !text.contains("lock_package_missing") && !text.contains("pypi_multiple_lockfiles"), + "{lock}: {env:#}" + ); + + // The revert finds the wiring where vendor put it. + let (code, env) = run_cli(&root, &["vendor", "--revert"], &[]); + assert_eq!(code, 0, "{lock}: revert: {env:#}"); + assert_eq!( + std::fs::read_to_string(root.join(files[0])).unwrap(), + "idna==3.7\nsix==1.16.0\n", + "{lock}: revert restores the pin" + ); + } +} + /// #765: a vendored requirements.txt picks up a superseding patch. The /// manifest moves `six` from patch A to patch B (different patched bytes); /// the next `vendor` must re-wire the requirements line to B's wheel in From 2ca65d9ecb31e483e4cef7963b375d36cbe9f99e Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 01:50:10 +0000 Subject: [PATCH 3/4] Route package-less tool lock to requirements The vendored PyPI router picked a lone poetry.lock or pdm.lock by presence, while the lock inventory reads past one that resolves no packages to requirements.txt. Scan then offered a package that the Poetry or PDM backend refused, with a remedy that writes the same empty lock again. A lone poetry.lock or pdm.lock that parses and resolves no packages no longer governs beside a requirements.txt. Both sides decide that with one predicate. Without a requirements.txt, beside another tool lock, or when the lock does not parse, routing is unchanged. Two router tests used an empty lock file as a stand-in for a real lock. They now hold a package, which is what they meant to test. Refs #1114. Assisted-by: Claude Code:claude-fable-5-2 --- crates/socket-patch-cli/CLI_CONTRACT.md | 2 +- .../src/vendor/lock_inventory/pypi.rs | 11 ++ crates/socket-patch-core/src/vendor/pypi.rs | 125 +++++++++++++++++- 3 files changed, 134 insertions(+), 4 deletions(-) diff --git a/crates/socket-patch-cli/CLI_CONTRACT.md b/crates/socket-patch-cli/CLI_CONTRACT.md index bc390b2e6..11d63d196 100644 --- a/crates/socket-patch-cli/CLI_CONTRACT.md +++ b/crates/socket-patch-cli/CLI_CONTRACT.md @@ -2526,7 +2526,7 @@ command's integration tests check its output. | `redirect_unconfirmed` | `skipped` (`details.mode: "hosted"`) | hosted `scan` / `get` (v5.0, additive): the patch was granted but no lockfile entry pinning it could be rewritten. The status and exit code are unchanged for now, pending the open hosted exit-policy decision (#704); `--silent` hides the human line. | | `lockfile_unreadable` / `lockfile_unparseable` / `patched_ref_invalid` / `patched_ref_unattributable` | run-level `warnings[]` | vex (every form): lockfile-discovery diagnostics — see "Manifest-less VEX (lockfile discovery)". Never flip the exit on their own. | | `vex_npm_shrinkwrap_only` | run warning and `failed[].reason` | vex (every form, #899): the patch is wired only in a root `npm-shrinkwrap.json` with no `package-lock.json` twin, which npm >= 12 never reads; no statement until the twin exists. `list` / `rollback` / `remove` still manage the wiring. | -| `vendor_multiple_lockfiles` / `pypi_multiple_lockfiles` | `skipped` (warning) | vendor: a sibling lockfile of another package manager (for PyPI, also a root `requirements.txt` that pins the package beside the wired tool lock) will still install UNPATCHED bytes; names the wired winner + the ignored locks. Beside `Pipfile.lock`, `uv.lock` or a wired PEP 751 / script lock, an exact registry pin of the package in `requirements.txt` or an in-root `-r` include (`pipenv requirements` or `uv export` output, or the file `pip lock -r requirements.txt` read) is wired with the lock instead and never named here (#612, #1368, #1758): both files then refer to the committed wheel, the ledger entry records both, every revert restores both, a superseding patch re-wires both, and a re-run over a project whose lock is already wired (a vendor from before, or an export made since) wires the export too (`pypi_requirements_sibling_wired`). An exact pin of the package with extras (`six[foo]==1.16.0`), or a file's only line for it when that line is an unpinned extras requirement (`six[foo]`, which hosted mode also rewrites), cannot be expressed as a wheel path line. It refuses a fresh wiring of the lock `pypi_extras_unsupported`, as the requirements-only wiring does, rather than leave `pip install -r` unpatched; a hosted → vendored switch then keeps both files' hosted pins (#1794). A lock already wired re-runs in sync with the extras pin still named here. Any other pin the requirements wiring cannot rewrite (a range, an include outside the root) stays a loser. Likewise, a `pylock.toml` / `pylock..toml` that `pipenv lock` writes beside `Pipfile.lock` under `[pipenv] use_pylock = true` is wired with it (#1368), with the same ledger, revert, supersede and re-run behavior (`pypi_pipenv_pylock_wired`); a pylock the wiring cannot rewrite in place (a symlink, a non-registry source) stays a loser. | +| `vendor_multiple_lockfiles` / `pypi_multiple_lockfiles` | `skipped` (warning) | vendor: a sibling lockfile of another package manager (for PyPI, also a root `requirements.txt` that pins the package beside the wired tool lock) will still install UNPATCHED bytes; names the wired winner + the ignored locks. A `poetry.lock` or `pdm.lock` that resolves no packages (a project that declares no dependencies), with no other tool lock beside it, is not the wired lock of a project with a root `requirements.txt`: `requirements.txt` is wired, as scan's lock inventory reads it, the lock is left alone and nothing is named here (#1114); with no `requirements.txt` the lock still routes to its tool. Beside `Pipfile.lock`, `uv.lock` or a wired PEP 751 / script lock, an exact registry pin of the package in `requirements.txt` or an in-root `-r` include (`pipenv requirements` or `uv export` output, or the file `pip lock -r requirements.txt` read) is wired with the lock instead and never named here (#612, #1368, #1758): both files then refer to the committed wheel, the ledger entry records both, every revert restores both, a superseding patch re-wires both, and a re-run over a project whose lock is already wired (a vendor from before, or an export made since) wires the export too (`pypi_requirements_sibling_wired`). An exact pin of the package with extras (`six[foo]==1.16.0`), or a file's only line for it when that line is an unpinned extras requirement (`six[foo]`, which hosted mode also rewrites), cannot be expressed as a wheel path line. It refuses a fresh wiring of the lock `pypi_extras_unsupported`, as the requirements-only wiring does, rather than leave `pip install -r` unpatched; a hosted → vendored switch then keeps both files' hosted pins (#1794). A lock already wired re-runs in sync with the extras pin still named here. Any other pin the requirements wiring cannot rewrite (a range, an include outside the root) stays a loser. Likewise, a `pylock.toml` / `pylock..toml` that `pipenv lock` writes beside `Pipfile.lock` under `[pipenv] use_pylock = true` is wired with it (#1368), with the same ledger, revert, supersede and re-run behavior (`pypi_pipenv_pylock_wired`); a pylock the wiring cannot rewrite in place (a symlink, a non-registry source) stays a loser. | | `vendor_npm_shrinkwrap_only` | `skipped` (warning) | vendor / scan / get `--mode vendored` (npm, #899): the package was wired into `npm-shrinkwrap.json`, the only npm lock (also on an in-sync re-run). npm >= 12 never reads the shrinkwrap and installs the unpatched registry bytes; rename the lock to `package-lock.json` (or commit a copy under that name) and re-run. | | `vendor_npm_deno_lock` | `skipped` (warning) | vendor / scan / get `--mode vendored` (npm, every lockfile flavor, #406): the package was vendored (also on an in-sync re-run), but the project root's `deno.lock` locks the same `name@version`. `deno install` installs a `package.json` project's npm dependencies from `deno.lock` and never reads the rewired lock, so installs Deno runs keep the registry copy and `vex` omits the patch (`vex_deno_lock_copy`); npm / pnpm / yarn / bun installs are patched. To patch what Deno installs, run `deno install` and then `socket-patch scan --mode agent`. | | `vendor_workspace_member_skipped` | `skipped` (warning) | vendor / scan / get `--mode vendored` (npm, #688): a lock entry with the package's `name@version` is the project's own source (a workspace member or a `file:` directory), so it is left alone while the lock's registry copies are vendored; patch that source directly if it needs the fix. When it is the only instance, vendoring refuses instead. | diff --git a/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs b/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs index be5994858..a4d897ddb 100644 --- a/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs +++ b/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs @@ -431,6 +431,17 @@ async fn inventory_poetry_lock(view: &ProjectView<'_>) -> Option bool { + crate::utils::lock_fragments::parse_lock(text) + .is_ok_and(|document| toml_package_coords(&document).is_empty()) +} + /// `(canonical name, version, purl, table)` of every path-safe `[[package]]` /// of a poetry.lock / pdm.lock document. fn toml_package_coords(document: &Table) -> Vec<(String, String, String, &Table)> { diff --git a/crates/socket-patch-core/src/vendor/pypi.rs b/crates/socket-patch-core/src/vendor/pypi.rs index 4010f649f..94cdd34a0 100644 --- a/crates/socket-patch-core/src/vendor/pypi.rs +++ b/crates/socket-patch-core/src/vendor/pypi.rs @@ -287,6 +287,9 @@ async fn refuse_templated_pin( /// it (#1368), and with no `Pipfile.lock` it refuses /// `pypi_pipenv_pylock_unsupported` (#912); /// 3. `poetry.lock` → poetry; 4. `pdm.lock` → pdm; 5. `Pipfile.lock` → pipenv; +/// a lone `poetry.lock` / `pdm.lock` that resolves no packages, beside a +/// `requirements.txt`, is skipped: the requirements file is the install +/// source (#1114); /// 6. lock-less `[tool.uv]`/`[tool.poetry]`/`[tool.pdm]`/`Pipfile` → /// `_no_lockfile` refusal unless requirements.txt exists; /// 7. `requirements.txt` → requirements; @@ -326,6 +329,21 @@ async fn detect_pypi_flavor( tool_locks.push(lock); } } + // #1114: a lone poetry.lock / pdm.lock that resolves no packages + // installs nothing, so a `requirements.txt` beside it is the install + // source, as the lock inventory reads it. Wiring the lock refused a + // package scan had offered from `requirements.txt`. With no + // `requirements.txt` the lock still routes to its tool, whose refusal + // names it; beside another tool lock the presence order stands. + if let [lock @ ("poetry.lock" | "pdm.lock")] = tool_locks[..] { + if exists(PYPI_REQUIREMENTS).await + && read_regular_to_string(&project_root.join(lock)) + .await + .is_ok_and(|text| super::lock_inventory::pypi::tool_lock_resolves_nothing(&text)) + { + tool_locks.clear(); + } + } let governing = pypi_governing_tool_lock(|lock| tool_locks.contains(&lock)); let has_uv_lock = governing == Some("uv.lock"); let has_pipfile = exists("Pipfile").await; @@ -4073,6 +4091,10 @@ mod tests { const ORIG: &[u8] = b"class Six:\n pass\n"; const PATCHED: &[u8] = b"class Six:\n pass\n# SOCKET-PATCH-MARKER\n"; + /// A poetry.lock / pdm.lock that resolves a package: one that resolves + /// none does not govern beside a `requirements.txt` (#1114). + const TOOL_LOCK_WITH_SIX: &str = "[[package]]\nname = \"six\"\nversion = \"1.16.0\"\n"; + async fn touch(root: &Path, name: &str, content: &str) { tokio::fs::write(root.join(name), content).await.unwrap(); } @@ -4119,8 +4141,8 @@ mod tests { ); } for (lock, content, flavor) in [ - ("poetry.lock", "", PypiFlavor::Poetry), - ("pdm.lock", "", PypiFlavor::Pdm), + ("poetry.lock", TOOL_LOCK_WITH_SIX, PypiFlavor::Poetry), + ("pdm.lock", TOOL_LOCK_WITH_SIX, PypiFlavor::Pdm), ] { let tmp = tempfile::tempdir().unwrap(); touch(tmp.path(), lock, content).await; @@ -4170,7 +4192,7 @@ mod tests { ("pylock.toml", pylock.as_str()), ("uv.lock", "version = 1\n"), ("Pipfile.lock", "{}"), - ("poetry.lock", ""), + ("poetry.lock", TOOL_LOCK_WITH_SIX), ] { let tmp = tempfile::tempdir().unwrap(); // The repository every path of the fixture lives in. @@ -4471,6 +4493,103 @@ mod tests { } } + /// #1114: a `poetry.lock` or `pdm.lock` that resolves no packages (what + /// the tool writes for a project that declares no dependencies) is not + /// the install source of a package `requirements.txt` holds. The lock + /// inventory reads `requirements.txt` there, so the router must wire it + /// too: routing to the tool lock refused a package scan had offered. + #[tokio::test] + async fn packageless_tool_lock_beside_requirements_routes_to_requirements() { + for (lock, content, marker) in [ + ( + "poetry.lock", + "package = []\n\n[metadata]\nlock-version = \"2.0\"\n", + "[tool.poetry]\nname = \"app\"\n", + ), + ( + "poetry.lock", + "[metadata]\nlock-version = \"2.0\"\n", + "[tool.poetry]\nname = \"app\"\n", + ), + ( + "pdm.lock", + "[metadata]\ngroups = [\"default\"]\nlock_version = \"4.5.0\"\n", + "[tool.pdm]\ndistribution = false\n", + ), + ] { + let tmp = tempfile::tempdir().unwrap(); + touch(tmp.path(), lock, content).await; + touch(tmp.path(), "pyproject.toml", marker).await; + touch(tmp.path(), "requirements.txt", "six==1.16.0\n").await; + + let inventory = crate::vendor::lock_inventory::inventory_project(tmp.path()).await; + assert_eq!( + inventory.iter().map(|e| &*e.purl).collect::>(), + ["pkg:pypi/six@1.16.0"], + "{lock}: the inventory reads requirements.txt" + ); + for target in [Some(("six", "1.16.0")), None] { + let (selected, warnings) = detect_pypi_flavor(tmp.path(), target).await.unwrap(); + assert_eq!( + selected, + PypiFlavor::Requirements, + "{lock} {target:?}: the router must agree with the inventory" + ); + assert!( + warnings.is_empty(), + "{lock} {target:?}: nothing installs from the package-less lock: \ + {warnings:?}" + ); + } + } + } + + /// The limits of the #1114 rule: a package-less tool lock still governs + /// when `requirements.txt` is absent (the tool's own refusal names the + /// lock, where "there is no poetry.lock" would be false), when another + /// tool lock is present (the lock-over-lock order stays the presence + /// table every mode shares), and when it does not parse (it cannot be + /// shown to resolve nothing). + #[tokio::test] + async fn packageless_tool_lock_governs_without_a_requirements_fallback() { + const EMPTY: &str = "package = []\n\n[metadata]\nlock-version = \"2.0\"\n"; + for (lock, flavor) in [ + ("poetry.lock", PypiFlavor::Poetry), + ("pdm.lock", PypiFlavor::Pdm), + ] { + // Alone, beside its own marker. + let tmp = tempfile::tempdir().unwrap(); + touch(tmp.path(), lock, EMPTY).await; + touch( + tmp.path(), + "pyproject.toml", + "[tool.poetry]\nname = \"app\"\n\n[tool.pdm]\ndistribution = false\n", + ) + .await; + let (selected, _) = detect_pypi_flavor(tmp.path(), Some(("six", "1.16.0"))) + .await + .unwrap(); + assert_eq!(selected, flavor, "{lock} alone"); + + // Beside another tool lock, requirements.txt or not. + touch(tmp.path(), "Pipfile.lock", "{}").await; + touch(tmp.path(), "requirements.txt", "six==1.16.0\n").await; + let (selected, _) = detect_pypi_flavor(tmp.path(), Some(("six", "1.16.0"))) + .await + .unwrap(); + assert_eq!(selected, flavor, "{lock} beside Pipfile.lock"); + + // Unparseable, beside requirements.txt. + let tmp = tempfile::tempdir().unwrap(); + touch(tmp.path(), lock, "[[package]\nname = ").await; + touch(tmp.path(), "requirements.txt", "six==1.16.0\n").await; + let (selected, _) = detect_pypi_flavor(tmp.path(), Some(("six", "1.16.0"))) + .await + .unwrap(); + assert_eq!(selected, flavor, "unparseable {lock}"); + } + } + /// One assert per row of the routing table (locks > lock-less markers /// with requirements fallthrough > requirements > pyproject > nothing; /// the python-lock and hatch rows are covered elsewhere). From 438ba5f170680bdc09ed3bd29fe44856b1b17c9c Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 25 Nov 2026 02:10:40 +0000 Subject: [PATCH 4/4] Keep standalone locks ranked over an empty lock Review of the previous commit found that dropping the package-less lock before the standalone-lock step changed a result: with a Pipfile in the project, a pylock pinning the package was read as Pipenv's and refused, where it was wired before. The skip now applies only after the standalone locks are decided, so they rank above a tool lock whatever it holds. The package-less test also skips the parse for a lock that holds a [[package]] header, so routing a populated lock costs one substring search, and its docs say which reader it shares with the inventory. Refs #1114. Assisted-by: Claude Code:claude-fable-5-2 --- .../src/vendor/lock_inventory/pypi.rs | 14 ++++-- crates/socket-patch-core/src/vendor/pypi.rs | 46 +++++++++++++++---- .../socket-patch-core/src/vendor/pypi_pdm.rs | 4 +- .../src/vendor/pypi_poetry.rs | 4 +- 4 files changed, 51 insertions(+), 17 deletions(-) diff --git a/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs b/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs index a4d897ddb..4be169671 100644 --- a/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs +++ b/crates/socket-patch-core/src/vendor/lock_inventory/pypi.rs @@ -435,11 +435,17 @@ async fn inventory_poetry_lock(view: &ProjectView<'_>) -> Option bool { - crate::utils::lock_fragments::parse_lock(text) - .is_ok_and(|document| toml_package_coords(&document).is_empty()) + !text.contains("[[package]]") + && crate::utils::lock_fragments::parse_lock(text) + .is_ok_and(|document| toml_package_coords(&document).is_empty()) } /// `(canonical name, version, purl, table)` of every path-safe `[[package]]` diff --git a/crates/socket-patch-core/src/vendor/pypi.rs b/crates/socket-patch-core/src/vendor/pypi.rs index 94cdd34a0..7ff037695 100644 --- a/crates/socket-patch-core/src/vendor/pypi.rs +++ b/crates/socket-patch-core/src/vendor/pypi.rs @@ -334,16 +334,20 @@ async fn detect_pypi_flavor( // source, as the lock inventory reads it. Wiring the lock refused a // package scan had offered from `requirements.txt`. With no // `requirements.txt` the lock still routes to its tool, whose refusal - // names it; beside another tool lock the presence order stands. - if let [lock @ ("poetry.lock" | "pdm.lock")] = tool_locks[..] { - if exists(PYPI_REQUIREMENTS).await - && read_regular_to_string(&project_root.join(lock)) - .await - .is_ok_and(|text| super::lock_inventory::pypi::tool_lock_resolves_nothing(&text)) - { - tool_locks.clear(); + // names it; beside another tool lock the presence order stands. The + // read is of a regular file only, so a FIFO planted as the lock still + // reaches its backend's guarded load. + let packageless_lock = match tool_locks[..] { + [lock @ ("poetry.lock" | "pdm.lock")] => { + exists(PYPI_REQUIREMENTS).await + && read_regular_to_string(&project_root.join(lock)) + .await + .is_ok_and(|text| { + super::lock_inventory::pypi::tool_lock_resolves_nothing(&text) + }) } - } + _ => false, + }; let governing = pypi_governing_tool_lock(|lock| tool_locks.contains(&lock)); let has_uv_lock = governing == Some("uv.lock"); let has_pipfile = exists("Pipfile").await; @@ -480,6 +484,12 @@ async fn detect_pypi_flavor( } return Ok((PypiFlavor::PythonLocks, warnings)); } + // #1114: past the standalone locks, which rank above a tool lock + // whatever it holds, the package-less lock is no install source. + let governing = governing.filter(|_| !packageless_lock); + if packageless_lock { + present.clear(); + } if has_uv_lock { present.extend(additional_locks.iter().map(String::as_str)); } @@ -4579,6 +4589,24 @@ mod tests { .unwrap(); assert_eq!(selected, flavor, "{lock} beside Pipfile.lock"); + // A standalone lock pinning the package still outranks it, as + // it outranks a populated tool lock: a `Pipfile` beside them + // does not turn the pylock into Pipenv's. + let tmp = tempfile::tempdir().unwrap(); + touch(tmp.path(), lock, EMPTY).await; + touch(tmp.path(), "Pipfile", "[packages]\nsix = \"*\"\n").await; + touch(tmp.path(), "requirements.txt", "six==1.16.0\n").await; + touch( + tmp.path(), + "pylock.toml", + &PIPENV_PYLOCK.replace("pipenv", "pip"), + ) + .await; + let (selected, _) = detect_pypi_flavor(tmp.path(), Some(("six", "1.16.0"))) + .await + .unwrap(); + assert_eq!(selected, PypiFlavor::PythonLocks, "{lock} beside a pylock"); + // Unparseable, beside requirements.txt. let tmp = tempfile::tempdir().unwrap(); touch(tmp.path(), lock, "[[package]\nname = ").await; diff --git a/crates/socket-patch-core/src/vendor/pypi_pdm.rs b/crates/socket-patch-core/src/vendor/pypi_pdm.rs index 8c6f6309d..34fe0ded7 100644 --- a/crates/socket-patch-core/src/vendor/pypi_pdm.rs +++ b/crates/socket-patch-core/src/vendor/pypi_pdm.rs @@ -1499,8 +1499,8 @@ distribution = false } /// A FIFO planted as `pdm.lock` (or `pyproject.toml`) must not wedge the - /// load: `detect_pypi_flavor`'s routing probes are metadata-only (a FIFO - /// stats fine, and the pdm route short-circuits before detection's own + /// load: `detect_pypi_flavor`'s routing probes are metadata-only or read + /// regular files only (a FIFO stats fine, and the pdm route short-circuits before detection's own /// guarded pyproject read), so the backend's raw `read_to_string` /// open(2) is the FIRST open — it waits for a writer that never comes, /// wedging every pdm-project vendor run indefinitely. Same diff --git a/crates/socket-patch-core/src/vendor/pypi_poetry.rs b/crates/socket-patch-core/src/vendor/pypi_poetry.rs index 3becf9bdb..78661db9a 100644 --- a/crates/socket-patch-core/src/vendor/pypi_poetry.rs +++ b/crates/socket-patch-core/src/vendor/pypi_poetry.rs @@ -1908,8 +1908,8 @@ content-hash = "4b42a89b7ff7b26511b06acdc458dbd85312e5083db8f212b017482bc68cdd01 } /// A FIFO planted as `poetry.lock` (or `pyproject.toml`) must not wedge - /// the load: `detect_pypi_flavor`'s routing probes are metadata-only (a - /// FIFO stats fine, and the poetry route short-circuits before + /// the load: `detect_pypi_flavor`'s routing probes are metadata-only or + /// read regular files only (a FIFO stats fine, and the poetry route short-circuits before /// detection's own guarded pyproject read), so the backend's raw /// `read_to_string` open(2) is the FIRST open — it waits for a writer /// that never comes, wedging every poetry-project vendor run