From 43efd895d24b7ccd2853fa5bcf08ad0e621f33ce Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 2 May 2026 17:21:29 +0900 Subject: refactor(registry): plumb RepositorySet and executor through callers ResolveRequest and LockFileGenerationRequest now take Arc instead of a raw Cache. install_from_lock now accepts &mut dyn InstallerExecutor instead of constructing FilesystemExecutor internally. Both changes expose the DI injection points needed by the upcoming in-process test harness, where Packagist must be replaced with an empty RepositorySet (Composer's `'packagist' => false` test config) and filesystem install execution must be replaced with a tracing recorder (Composer's InstallationManagerMock). The eager VCS scan and inline-package preload still happen inside resolve(), so the RawRepository array is kept on ResolveRequest as raw_repositories - migrating those through RepositorySet remains a follow-up. RepositorySet gains with_packagist and empty constructors so production callers and future tests have a uniform construction shape. All 136 enabled installer fixtures + 114 mozart-registry tests + 541 mozart lib tests still green; clippy clean. Co-Authored-By: Claude Opus 4.7 (1M context) --- crates/mozart/src/commands/create_project.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'crates/mozart/src/commands/create_project.rs') diff --git a/crates/mozart/src/commands/create_project.rs b/crates/mozart/src/commands/create_project.rs index a137868..01b337e 100644 --- a/crates/mozart/src/commands/create_project.rs +++ b/crates/mozart/src/commands/create_project.rs @@ -419,9 +419,11 @@ pub async fn execute( platform: PlatformConfig::new(), ignore_platform_reqs: args.ignore_platform_reqs, ignore_platform_req_list: args.ignore_platform_req.clone(), - repo_cache: repo_cache.clone(), + repositories: std::sync::Arc::new( + mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()), + ), temporary_constraints: HashMap::new(), - repositories: raw.repositories.clone(), + raw_repositories: raw.repositories.clone(), }; console.info("Resolving dependencies..."); @@ -440,7 +442,9 @@ pub async fn execute( composer_json_content: composer_json_content.clone(), composer_json: raw.clone(), include_dev: dev_mode, - repo_cache: repo_cache.clone(), + repositories: std::sync::Arc::new( + mozart_registry::repository::RepositorySet::with_packagist(repo_cache.clone()), + ), }) .await?; @@ -497,6 +501,10 @@ pub async fn execute( .and_then(|v| v.as_bool()) .unwrap_or(false); + let cache_config = mozart_registry::cache::build_cache_config(cli.no_cache); + let files_cache = mozart_registry::cache::Cache::files(&cache_config); + let mut executor = + mozart_registry::installer_executor::FilesystemExecutor::new(files_cache); super::install::install_from_lock( &new_lock, &target_dir, @@ -517,6 +525,7 @@ pub async fn execute( no_cache: cli.no_cache, }, console, + &mut executor, ) .await?; -- cgit v1.3.1