From beab67e2259dc21c444d827482c4fd13b03e308d Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Tue, 15 Oct 2024 16:09:55 -0700 Subject: [PATCH] Invalid cache when adding lower bound to lockfile (#8230) ## Summary This was already properly handled, but the operation itself was in a `debug_assert!`, so it wasn't running at all in production builds... Closes https://github.com/astral-sh/uv/issues/8208. --- crates/uv/src/commands/project/add.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/uv/src/commands/project/add.rs b/crates/uv/src/commands/project/add.rs index e5d5adefc..029b409e0 100644 --- a/crates/uv/src/commands/project/add.rs +++ b/crates/uv/src/commands/project/add.rs @@ -748,7 +748,8 @@ async fn lock_and_sync( let url = Url::from_file_path(project.project_root()) .expect("project root is a valid URL"); let version_id = VersionId::from_url(&url); - debug_assert!(state.index.distributions().remove(&version_id).is_some()); + let existing = state.index.distributions().remove(&version_id); + debug_assert!(existing.is_some(), "distribution should exist"); } // If the file was modified, we have to lock again, though the only expected change is