Skip to content

Commit c5ebbf7

Browse files
committed
Fix workspace dependency lookup to handle transitive cases
1 parent 5b5693c commit c5ebbf7

1 file changed

Lines changed: 15 additions & 18 deletions

File tree

  • crates/uv-resolver/src/lock

crates/uv-resolver/src/lock/mod.rs

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,24 +1279,6 @@ impl Lock {
12791279
}
12801280
}
12811281

1282-
// Validate that the member sources have not changed (e.g., that they've switched from
1283-
// virtual to non-virtual or vice versa).
1284-
for (name, member) in packages {
1285-
let is_dependency = requirements
1286-
.iter()
1287-
.chain(dependency_groups.values().flatten())
1288-
.any(|requirement| &requirement.name == name);
1289-
let expected = !member.is_package(is_dependency);
1290-
let actual = self
1291-
.find_by_name(name)
1292-
.ok()
1293-
.flatten()
1294-
.map(|package| matches!(package.id.source, Source::Virtual(_)));
1295-
if actual != Some(expected) {
1296-
return Ok(SatisfiesResult::MismatchedVirtual(name.clone(), expected));
1297-
}
1298-
}
1299-
13001282
// Validate that the lockfile was generated with the same requirements.
13011283
{
13021284
let expected: BTreeSet<_> = requirements
@@ -1744,6 +1726,21 @@ impl Lock {
17441726
}
17451727
}
17461728

1729+
// Validate that the member sources have not changed (e.g., that they've switched from
1730+
// virtual to non-virtual or vice versa).
1731+
for (name, member) in packages {
1732+
let is_dependency = seen.iter().any(|package_id| &package_id.name == name);
1733+
let expected = !member.is_package(is_dependency);
1734+
let actual = self
1735+
.find_by_name(name)
1736+
.ok()
1737+
.flatten()
1738+
.map(|package| matches!(package.id.source, Source::Virtual(_)));
1739+
if actual != Some(expected) {
1740+
return Ok(SatisfiesResult::MismatchedVirtual(name.clone(), expected));
1741+
}
1742+
}
1743+
17471744
Ok(SatisfiesResult::Satisfied)
17481745
}
17491746
}

0 commit comments

Comments
 (0)