Skip to content

Commit 0595a11

Browse files
Revert optional-extra activation tracking in exports (#22750)
Revert #22234 after bisecting a severe `uv export` regression to that change. On the same frozen lock, the root export takes 0.44 seconds at the PR's parent, exceeds 60 seconds at the PR commit, and completes in 0.25 seconds with this revert on current main. This is a temporary mitigation while we fix the repeated propagation of extra-activation state. It also reintroduces the bug fixed by #22234: exports can include optional dependencies through incompatible environment paths. The revert removes that PR's regression test. #22751 fixes the slowdown while preserving the correctness fix.
1 parent b2eb713 commit 0595a11

2 files changed

Lines changed: 3 additions & 115 deletions

File tree

‎crates/uv-lock/src/lock/export/mod.rs‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ fn conflict_marker_reachability<'lock>(
519519
// the dependency marker as redundant when the lockfile is written.
520520
let active_marker = if let Node::Package(parent) = graph[parent_index] {
521521
let item = ConflictItem::from((parent.name().clone(), (*extra).clone()));
522-
*parent_map.entry(item).or_insert(MarkerTree::FALSE)
522+
*parent_map.entry(item).or_insert(parent_marker)
523523
} else {
524524
parent_marker
525525
};
@@ -550,15 +550,12 @@ fn conflict_marker_reachability<'lock>(
550550
parent_marker = parent_marker.and(marker);
551551

552552
// Combine the inferred conflicts with the existing conflicts on the node.
553-
let mut conflicts_changed = false;
554553
match conflict_maps.entry(child_edge.target()) {
555554
Entry::Occupied(mut existing) => {
556555
let child_map = existing.get_mut();
557556
for (key, value) in parent_map {
558557
let child_marker = child_map.entry(key).or_insert(MarkerTree::FALSE);
559-
let combined = child_marker.or(value);
560-
conflicts_changed |= combined != *child_marker;
561-
*child_marker = combined;
558+
*child_marker = child_marker.or(value);
562559
}
563560
}
564561
Entry::Vacant(vacant) => {
@@ -572,8 +569,7 @@ fn conflict_marker_reachability<'lock>(
572569
// If the marker is a subset of the existing marker (A ⊆ B exactly if
573570
// A ∪ B = A), updating the child wouldn't change child's marker.
574571
parent_marker = parent_marker.or(*existing.get());
575-
// Extra activation can change even when package reachability does not.
576-
if parent_marker != *existing.get() || conflicts_changed {
572+
if parent_marker != *existing.get() {
577573
existing.insert(parent_marker);
578574
queue.push(child_edge.target());
579575
}

‎crates/uv/tests/project/export.rs‎

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -358,114 +358,6 @@ fn requirements_txt_conditional_transitive_extra() -> Result<()> {
358358
Ok(())
359359
}
360360

361-
#[cfg(feature = "test-universal")]
362-
#[test]
363-
fn requirements_txt_does_not_activate_extra_through_incompatible_path() -> Result<()> {
364-
let context = uv_test::test_context!("3.13");
365-
366-
context.temp_dir.child("pyproject.toml").write_str(
367-
r#"
368-
[project]
369-
name = "root"
370-
version = "0.1.0"
371-
requires-python = ">=3.9"
372-
dependencies = [
373-
"shared==1.0.0 ; sys_platform == 'linux'",
374-
"shared==2.0.0 ; sys_platform != 'linux'",
375-
]
376-
377-
[project.optional-dependencies]
378-
feature = ["bridge==1.0.0 ; sys_platform == 'linux'"]
379-
"#,
380-
)?;
381-
382-
context.temp_dir.child("uv.lock").write_str(
383-
r#"
384-
version = 1
385-
revision = 3
386-
requires-python = ">=3.9"
387-
388-
[manifest]
389-
members = ["root"]
390-
391-
[[package]]
392-
name = "root"
393-
version = "0.1.0"
394-
source = { virtual = "." }
395-
dependencies = [
396-
{ name = "shared", version = "1.0.0", source = { registry = "https://example.com/simple" }, marker = "sys_platform == 'linux'" },
397-
{ name = "shared", version = "2.0.0", source = { registry = "https://other.example/simple" }, marker = "sys_platform != 'linux'" },
398-
]
399-
400-
[package.optional-dependencies]
401-
feature = [{ name = "bridge", version = "1.0.0", source = { registry = "https://example.com/simple" }, marker = "sys_platform == 'linux'" }]
402-
403-
[package.metadata]
404-
provides-extras = ["feature"]
405-
406-
[[package]]
407-
name = "bridge"
408-
version = "1.0.0"
409-
source = { registry = "https://example.com/simple" }
410-
dependencies = [
411-
{ name = "shared", version = "1.0.0", source = { registry = "https://example.com/simple" }, marker = "sys_platform == 'linux'", extra = ["a"] },
412-
{ name = "shared", version = "2.0.0", source = { registry = "https://other.example/simple" }, marker = "sys_platform != 'linux'", extra = ["a"] },
413-
]
414-
415-
[[package]]
416-
name = "shared"
417-
version = "1.0.0"
418-
source = { registry = "https://example.com/simple" }
419-
resolution-markers = ["sys_platform == 'linux'"]
420-
421-
[package.optional-dependencies]
422-
a = [{ name = "leaf-b", version = "1.0.0", source = { registry = "https://example.com/simple" } }]
423-
424-
[package.metadata]
425-
provides-extras = ["a"]
426-
427-
[[package]]
428-
name = "shared"
429-
version = "2.0.0"
430-
source = { registry = "https://other.example/simple" }
431-
resolution-markers = ["sys_platform != 'linux'"]
432-
dependencies = [{ name = "leaf-b", version = "1.0.0", source = { registry = "https://example.com/simple" } }]
433-
434-
[package.optional-dependencies]
435-
a = [{ name = "leaf-c", version = "1.0.0", source = { registry = "https://example.com/simple" } }]
436-
437-
[package.metadata]
438-
provides-extras = ["a"]
439-
440-
[[package]]
441-
name = "leaf-b"
442-
version = "1.0.0"
443-
source = { registry = "https://example.com/simple" }
444-
445-
[[package]]
446-
name = "leaf-c"
447-
version = "1.0.0"
448-
source = { registry = "https://example.com/simple" }
449-
"#,
450-
)?;
451-
452-
uv_snapshot!(context.filters(), context.export()
453-
.arg("--extra").arg("feature")
454-
.arg("--frozen")
455-
.arg("--no-header")
456-
.arg("--no-annotate")
457-
.arg("--no-hashes"), @"
458-
exit_code: 0 (success)
459-
----- stdout -----
460-
bridge==1.0.0 ; sys_platform == 'linux'
461-
leaf-b==1.0.0
462-
shared==1.0.0 ; sys_platform == 'linux'
463-
shared==2.0.0 ; sys_platform != 'linux'
464-
");
465-
466-
Ok(())
467-
}
468-
469361
#[cfg(feature = "test-universal")]
470362
#[test]
471363
fn requirements_txt_project_extra() -> Result<()> {

0 commit comments

Comments
 (0)