From c865a24596084eec90d10860265748c93bf7eb6a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 3 May 2026 10:54:36 +0900 Subject: fix(resolver): substitute self.version in pool link constraints Composer's ArrayLoader and AliasPackage rewrite "self.version" to the declaring package's own version when building Link objects, so a package's replace/provide/conflict/require constraints carry a concrete "= " rather than the literal string. Mozart was passing "self.version" through verbatim, which then failed to parse in Pool::matches_package and caused replace_alias.test to fail to find a provider for c/c 1.* via a/a's branch alias. Push the substitution into make_pool_links, threading the source package's normalized version through the call sites in resolver.rs (packagist/inline/composer-repo) and vcs_bridge.rs. Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/mozart-registry/src/resolver.rs | 4 ++++ crates/mozart-registry/src/vcs_bridge.rs | 4 ++++ 2 files changed, 8 insertions(+) (limited to 'crates/mozart-registry') diff --git a/crates/mozart-registry/src/resolver.rs b/crates/mozart-registry/src/resolver.rs index e8076b4..9cc0751 100644 --- a/crates/mozart-registry/src/resolver.rs +++ b/crates/mozart-registry/src/resolver.rs @@ -409,6 +409,7 @@ fn packagist_to_pool_inputs( pretty_version: version_str.to_string(), requires: make_pool_links( package_name, + version_normalized, &pv.require .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -416,6 +417,7 @@ fn packagist_to_pool_inputs( ), replaces: make_pool_links( package_name, + version_normalized, &pv.replace .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -423,6 +425,7 @@ fn packagist_to_pool_inputs( ), provides: make_pool_links( package_name, + version_normalized, &pv.provide .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -430,6 +433,7 @@ fn packagist_to_pool_inputs( ), conflicts: make_pool_links( package_name, + version_normalized, &pv.conflict .iter() .map(|(k, v)| (k.clone(), v.clone())) diff --git a/crates/mozart-registry/src/vcs_bridge.rs b/crates/mozart-registry/src/vcs_bridge.rs index 7714630..1f93a51 100644 --- a/crates/mozart-registry/src/vcs_bridge.rs +++ b/crates/mozart-registry/src/vcs_bridge.rs @@ -73,6 +73,7 @@ pub fn vcs_to_pool_inputs( pretty_version: vpkg.version.clone(), requires: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &require .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -80,6 +81,7 @@ pub fn vcs_to_pool_inputs( ), replaces: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &replace .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -87,6 +89,7 @@ pub fn vcs_to_pool_inputs( ), provides: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &provide .iter() .map(|(k, v)| (k.clone(), v.clone())) @@ -94,6 +97,7 @@ pub fn vcs_to_pool_inputs( ), conflicts: make_pool_links( &vpkg.name, + &vpkg.version_normalized, &conflict .iter() .map(|(k, v)| (k.clone(), v.clone())) -- cgit v1.3.1