From 38706a6f0ceb773d473c4f5ddebf49e8e5ae46dc Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 3 May 2026 22:07:34 +0900 Subject: fix(update): apply --minimal-changes via policy preferred versions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The previous implementation pinned every resolved package back to its locked version after the resolve, which discarded the new versions the solver had to pick when a root constraint moved off the lock (e.g. a require bumped from `1.*` to `2.*`). The lock effectively never moved, so transitive cascades from a forced root-level update were lost. Mirror Composer's `Installer::createPolicy(forUpdate=true, minimalUpdate=true)` instead: thread the lock's `name → normalized version` map through the policy as `preferred_versions`. The solver now picks the locked version as a tiebreaker when it still satisfies the active constraints, but moves freely when a constraint forces a different version. Drop the post-process hook entirely. --- crates/mozart/src/commands/remove.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crates/mozart/src/commands/remove.rs') diff --git a/crates/mozart/src/commands/remove.rs b/crates/mozart/src/commands/remove.rs index f41d8b5..c52d410 100644 --- a/crates/mozart/src/commands/remove.rs +++ b/crates/mozart/src/commands/remove.rs @@ -278,6 +278,7 @@ pub async fn execute( locked_packages: Vec::new(), block_abandoned: false, root_branch_alias: None, + preferred_versions: indexmap::IndexMap::new(), }; // Print header messages @@ -565,6 +566,7 @@ async fn remove_unused( locked_packages: Vec::new(), block_abandoned: false, root_branch_alias: None, + preferred_versions: indexmap::IndexMap::new(), }; console.info("Resolving dependencies to detect unused packages..."); @@ -922,6 +924,7 @@ mod tests { locked_packages: Vec::new(), block_abandoned: false, root_branch_alias: None, + preferred_versions: indexmap::IndexMap::new(), }; let resolved = resolve(&request) .await @@ -982,6 +985,7 @@ mod tests { locked_packages: Vec::new(), block_abandoned: false, root_branch_alias: None, + preferred_versions: indexmap::IndexMap::new(), }; let resolved2 = resolve(&request2) .await -- cgit v1.3.1