From 86961b16b2f5c9c26a776193934d13ff87ab7fea Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Jun 2026 13:37:11 +0900 Subject: refactor(phase-c): resolve shared-ownership TODOs via handle/Rc clones Resolve the resolvable subset of category A (shared ownership / non-cloneable PHP class) TODOs by leaning on values that are already shared behind Rc/handle wrappers, where cloning preserves PHP reference semantics: - solver: call IgnoreListPlatformRequirementFilter::filter_constraint with a cloned AnyConstraint (a Clone enum) and propagate the Result - update_command: filter PlatformRepository out of the repository manager's handles into a CompositeRepository (array_filter equivalent) - package_discovery_trait: pass the real platform_requirement_filter (Rc clone) instead of substituting ignore_nothing() - installation_manager: pass the original full operation list (Vec> clone) as all_operations - file_downloader: swap self.io to NullIO and restore via std::mem::replace - auditor: reuse the PackageInterfaceHandle list across the advisory and abandoned-package queries - process_executor: drop the unused, lossy Clone impl - config / array_repository: demote settled RefCell-design markers to comments Remaining category A items (factory installer wiring, purge_packages handle bridge, installer cache identity, reinstall flow, plugin command discovery) stay as TODOs since correct resolution needs structural refactors. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/package_discovery_trait.rs | 6 ++---- crates/shirabe/src/command/update_command.rs | 16 +++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'crates/shirabe/src/command') diff --git a/crates/shirabe/src/command/package_discovery_trait.rs b/crates/shirabe/src/command/package_discovery_trait.rs index cd6c5a0..58361b5 100644 --- a/crates/shirabe/src/command/package_discovery_trait.rs +++ b/crates/shirabe/src/command/package_discovery_trait.rs @@ -531,8 +531,7 @@ pub trait PackageDiscoveryTrait { name, None, preferred_stability, - // TODO(phase-b): Box cannot be cloned; original PHP shares reference - Some(PlatformRequirementFilterFactory::ignore_nothing()), + Some(platform_requirement_filter.clone()), 0, None, shirabe_php_shim::PhpMixed::Null, @@ -620,8 +619,7 @@ pub trait PackageDiscoveryTrait { name, None, preferred_stability, - // TODO(phase-b): Box cannot be cloned; reusing factory result - Some(PlatformRequirementFilterFactory::ignore_nothing()), + Some(platform_requirement_filter.clone()), RepositorySet::ALLOW_UNACCEPTABLE_STABILITIES, None, shirabe_php_shim::PhpMixed::Null, diff --git a/crates/shirabe/src/command/update_command.rs b/crates/shirabe/src/command/update_command.rs index b2dab1c..e7a7437 100644 --- a/crates/shirabe/src/command/update_command.rs +++ b/crates/shirabe/src/command/update_command.rs @@ -718,19 +718,17 @@ impl UpdateCommand { IndexMap::new(), IndexMap::new(), ); - // TODO(phase-b): array_filter requires Clone on Box - // which PHP classes must not implement. Skipping the repo filter for now. - let _ = &composer + let repositories: Vec = composer .get_repository_manager() .borrow() - .get_repositories(); - let _ = |repository: &crate::repository::RepositoryInterfaceHandle| -> bool { - !repository.is::() - }; + .get_repositories() + .iter() + .filter(|repository| !repository.is::()) + .cloned() + .collect(); repository_set.add_repository(crate::repository::RepositoryInterfaceHandle::new( - CompositeRepository::new(Vec::new()), + CompositeRepository::new(repositories), ))?; - let _ = array_filter:: bool>; VersionSelector::new( std::rc::Rc::new(std::cell::RefCell::new(repository_set)), -- cgit v1.3.1