From 74c188162886755c380a4696d8b684cb28687402 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Mon, 4 May 2026 00:49:40 +0900 Subject: fix(update): preserve locked refs and aliases on partial update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partial update of a non-allow-listed dev package now resolves and emits the locked-repo entry verbatim, mirroring Composer's `PoolBuilder`. Three coordinated changes: - resolver: `lock_filter_allows` accepts the locked package's branch- alias normalized versions, not just the base. Without this, root constraints like `~2.1` against a `dev-master` locked package whose branch alias is `2.1.x-dev` failed with "no matching package found". - lockfile: new `lock_pinned_names` field on `LockFileGenerationRequest` routes non-allow-listed packages through `previous_lock_lookup` before `inline_lookup`, so the lock's source/dist references survive even when the inline metadata has moved to a newer commit. - update: `apply_partial_update` skips alias entries — re-pinning their pretty `version` to the base would collapse the alias label and emit a self-referential entry in the new lock's `aliases[]` block. Unblocks partial_update_forces_dev_reference_from_lock_for_non_updated_packages. Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/mozart/src/commands/require.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'crates/mozart/src/commands/require.rs') diff --git a/crates/mozart/src/commands/require.rs b/crates/mozart/src/commands/require.rs index b302ed9..02e5d8e 100644 --- a/crates/mozart/src/commands/require.rs +++ b/crates/mozart/src/commands/require.rs @@ -769,6 +769,7 @@ pub async fn execute( mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()), ), previous_lock: old_lock.clone(), + lock_pinned_names: indexmap::IndexSet::new(), }) .await?; @@ -1103,6 +1104,7 @@ mod tests { ), ), previous_lock: None, + lock_pinned_names: IndexSet::new(), }) .await .expect("Lock file generation should succeed"); @@ -1180,6 +1182,7 @@ mod tests { ), ), previous_lock: None, + lock_pinned_names: IndexSet::new(), }) .await .expect("Lock file generation should succeed"); -- cgit v1.3.1