From 9d82f21a9a0a9392ac7577f4419a56fb94123ae6 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 26 Jun 2026 02:31:34 +0900 Subject: fix(remove-command,pool-builder): drop Composer re-entrancy and PRE_POOL_CREATE todo MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit RemoveCommand::execute held composer_full_mut across deactivate_installed_plugins and event dispatch, both of which re-enter the same RefCell (composer.rs:500/446); it only uses &self getters, so borrow it immutably. PoolBuilder dispatched PluginEvents::PRE_POOL_CREATE by building an event that required moving the (unclonable) repositories/Request — left as todo!(). The event is purely plugin-facing and its result is never read in the no-plugin path (Pool::new reads self.packages directly), so skip it with a TODO(plugin) note. Removes the composer.rs re-entrancy and two todo!()s from the remove install path; remove's tests now reach the unregistered-installers blocker (factory.rs). Co-Authored-By: Claude Opus 4.8 (1M context) --- .../src/dependency_resolver/pool_builder.rs | 32 +++++----------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'crates/shirabe/src/dependency_resolver/pool_builder.rs') diff --git a/crates/shirabe/src/dependency_resolver/pool_builder.rs b/crates/shirabe/src/dependency_resolver/pool_builder.rs index 650dd6a..3663e43 100644 --- a/crates/shirabe/src/dependency_resolver/pool_builder.rs +++ b/crates/shirabe/src/dependency_resolver/pool_builder.rs @@ -299,31 +299,13 @@ impl PoolBuilder { } } - if let Some(event_dispatcher) = &self.event_dispatcher { - // TODO(plugin): PrePoolCreateEvent::new takes Request and Vec> - // by value but neither can be cloned (PHP class shared semantics). This event is purely - // plugin-facing and nothing in the no-plugin path reads it back, so it stays deferred - // until the plugin API drives an Rc-based migration of Request/repositories. - let mut pre_pool_create_event = PrePoolCreateEvent::new( - PluginEvents::PRE_POOL_CREATE.to_string(), - todo!("share repositories with PrePoolCreateEvent without moving"), - todo!("share Request with PrePoolCreateEvent without moving"), - self.acceptable_stabilities.clone(), - self.stability_flags.clone(), - self.root_aliases.clone(), - self.root_references.clone(), - self.packages.values().cloned().collect(), - self.unacceptable_fixed_or_locked_packages.to_vec(), - ); - let pre_pool_create_event_name = pre_pool_create_event.get_name().to_string(); - event_dispatcher.borrow_mut().dispatch( - Some(&pre_pool_create_event_name), - Some(&mut pre_pool_create_event), - )?; - // PHP rebinds $this->packages to a list-style array; preserve indices via reindexing. - // TODO(plugin)/TODO(phase-c): rebind self.packages from the (handle-based) event packages - // once EventDispatcher::dispatch returns the mutated event. - let _ = &pre_pool_create_event; + if self.event_dispatcher.is_some() { + // TODO(plugin): dispatch PluginEvents::PRE_POOL_CREATE. Constructing PrePoolCreateEvent + // would move the repositories and Request (neither clonable under PHP's shared + // semantics), and the event is purely plugin-facing: its mutations to the package list + // are never read back in the no-plugin path (Pool::new below reads self.packages + // directly). Skipped until the plugin API drives an Rc-based migration of + // Request/repositories so listeners can observe and mutate them. } let mut pool = Pool::new( -- cgit v1.3.1