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/install.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'crates/mozart/src/commands/install.rs') diff --git a/crates/mozart/src/commands/install.rs b/crates/mozart/src/commands/install.rs index b303ade..5053783 100644 --- a/crates/mozart/src/commands/install.rs +++ b/crates/mozart/src/commands/install.rs @@ -422,10 +422,8 @@ pub async fn install_from_lock( vendor_dir: &Path, config: &InstallConfig, console: &mozart_core::console::Console, + executor: &mut dyn InstallerExecutor, ) -> anyhow::Result<()> { - let cache_config = mozart_registry::cache::build_cache_config(config.no_cache); - let files_cache = mozart_registry::cache::Cache::files(&cache_config); - let dev_mode = config.dev_mode; // Step 1: Determine which packages to install @@ -506,7 +504,6 @@ pub async fn install_from_lock( console.info(&console_format!(" - Would remove {}", name)); } } else { - let mut executor = FilesystemExecutor::new(files_cache); let exec_ctx = ExecuteContext { vendor_dir: vendor_dir.to_path_buf(), no_progress: config.no_progress, @@ -761,6 +758,9 @@ pub async fn execute( let vendor_dir = working_dir.join("vendor"); // Step 7: Delegate to shared install_from_lock() + 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 = FilesystemExecutor::new(files_cache); install_from_lock( &lock, &working_dir, @@ -781,6 +781,7 @@ pub async fn execute( no_cache: cli.no_cache, }, console, + &mut executor, ) .await } -- cgit v1.3.1