Skip to content

Commit 82ac6bc

Browse files
committed
Tighten review findings in the python sweep
The direct-URL test's "ours" case now requires the artifact digest to replace the fixture's, since the input already held the URL. Rename rewrite_project_metadata's local that shadowed tool_uv, and keep the SourcesLayout caveat about transitive override reverts. Assisted-by: Claude Code:claude-opus-5-5
1 parent 2afd7e7 commit 82ac6bc

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

‎crates/socket-patch-core/src/utils/python_lock.rs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,13 @@ wheels = [{ url = "https://pypi.org/urllib3-2.0.0-py3-none-any.whl", hash = "sha
12641264
SHA256,
12651265
)
12661266
.unwrap();
1267-
assert!(rewritten.is_some_and(|text| text.contains(URL)), "{ours}");
1267+
// The fixture's old digest `aa` gives way to the artifact's.
1268+
assert!(
1269+
rewritten.is_some_and(|text| text.contains(SHA256)
1270+
&& !text.contains("\"aa\"")
1271+
&& !text.contains("sha256:aa")),
1272+
"{ours}"
1273+
);
12681274
}
12691275
}
12701276

‎crates/socket-patch-core/src/utils/python_script.rs‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ pub(crate) fn same_hosted_artifact(
130130
/// bytes after an out-of-order multi-package revert only when the tables we
131131
/// created vanish once empty. Only dotted keys do that after a parse round
132132
/// trip (dotted-ness is syntax; `implicit` is not), so scripts use `Dotted`.
133+
/// Transitive pairs share one `override-dependencies` array, whose restore
134+
/// flags drift once entries stop lining up, so their out-of-order revert
135+
/// stays order-dependent whatever the layout.
133136
///
134137
/// A `pyproject.toml` is reverted by text replay of the recorded original,
135138
/// so it uses uv's own layout (`Tables`): header-less `[tool]` / `[tool.uv]`
@@ -828,8 +831,8 @@ pub fn rewrite_project_metadata(
828831
{
829832
return Err("pyproject.toml has no project table".to_string());
830833
}
831-
let tool_uv = tool_uv(&document);
832-
let legacy_dev = tool_uv
834+
let uv = tool_uv(&document);
835+
let legacy_dev = uv
833836
.and_then(|uv| uv.get("dev-dependencies"))
834837
.and_then(Item::as_array)
835838
.into_iter()
@@ -844,7 +847,7 @@ pub fn rewrite_project_metadata(
844847
.chain(legacy_dev),
845848
)?;
846849
let direct = declares_directly(&document, false, &name);
847-
if tool_uv.is_some_and(|uv| uv.contains_key("workspace")) {
850+
if uv.is_some_and(|uv| uv.contains_key("workspace")) {
848851
return Err(
849852
"hosted sources for uv workspaces require a package-scoped source mapping".to_string(),
850853
);

0 commit comments

Comments
 (0)