From 307e66847dd5e00ad1890b6a64d3ac7192a03efc Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 18 Jul 2026 18:16:07 +0900 Subject: perf(installation-manager): fan out package downloads via Loop::wait MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit InstallationManager::downloadAndExecuteBatch now matches PHP: every update/install operation's installer->download() promise is collected and driven concurrently through waitOnPromises()/Loop::wait instead of being awaited one package at a time. Concurrency caps stay where PHP puts them (HttpDownloader 12, ProcessExecutor 10 via their semaphores). Error semantics follow PHP too: all downloads settle before the first rejection is rethrown, rather than aborting on the first failure. To let the collected futures and the cleanup closures own their installer beyond the loop iteration that created them, the installer registry becomes Vec> and get_installer hands out clones (PHP closures capture $installer the same way), with InstallerInterface methods taking &self across the six implementors — the only genuinely mutable state was LibraryInstaller.vendor_dir (canonicalized in place), now behind a RefCell. as_plugin_installer_mut/as_binary_presence_interface lose their &mut. The cleanup_promises entries are now the real thing: the PHP closure including the getInstallationSource() guard and the installer->cleanup($opType, $package, $initialPackage) call, replacing the no-op futures (drops one TODO(phase-b) and two TODO(phase-c)). Verified against the real network: create-project laravel/laravel produces a vendor tree byte-identical to real Composer's (diff -rq clean across all 109 packages including vendor/composer). Co-Authored-By: Claude Fable 5 --- crates/shirabe/tests/installer/metapackage_installer_test.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/tests/installer/metapackage_installer_test.rs') diff --git a/crates/shirabe/tests/installer/metapackage_installer_test.rs b/crates/shirabe/tests/installer/metapackage_installer_test.rs index 3380befb..3c1f0efe 100644 --- a/crates/shirabe/tests/installer/metapackage_installer_test.rs +++ b/crates/shirabe/tests/installer/metapackage_installer_test.rs @@ -19,7 +19,7 @@ fn installer() -> MetapackageInstaller { #[test] fn test_install() { let package = get_package("test/pkg", "1.0.0"); - let mut installer = installer(); + let installer = installer(); let mut repository = InstalledArrayRepository::new_with_packages(vec![]).unwrap(); run(installer.install(&mut repository, package.clone())).unwrap(); @@ -31,7 +31,7 @@ fn test_install() { fn test_update() { let initial = get_package("test/initial", "1.0.0"); let target = get_package("test/target", "1.0.1"); - let mut installer = installer(); + let installer = installer(); let mut repository = InstalledArrayRepository::new_with_packages(vec![initial.clone()]).unwrap(); @@ -47,7 +47,7 @@ fn test_update() { #[test] fn test_uninstall() { let package = get_package("test/pkg", "1.0.0"); - let mut installer = installer(); + let installer = installer(); let mut repository = InstalledArrayRepository::new_with_packages(vec![package.clone()]).unwrap(); -- cgit v1.3.1