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/dependency_resolver/solver.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'crates/shirabe/src/dependency_resolver') diff --git a/crates/shirabe/src/dependency_resolver/solver.rs b/crates/shirabe/src/dependency_resolver/solver.rs index d88d9bb..def586a 100644 --- a/crates/shirabe/src/dependency_resolver/solver.rs +++ b/crates/shirabe/src/dependency_resolver/solver.rs @@ -185,11 +185,8 @@ impl Solver { &mut self, request: &Request, platform_requirement_filter: &dyn PlatformRequirementFilterInterface, - ) { + ) -> anyhow::Result<()> { for (package_name, constraint) in request.get_requires() { - // TODO(phase-b): ConstraintInterface is a PHP class — Box - // cannot be cloned. We borrow the original constraint and only allocate a fresh - // box when the ignore filter rewrites it. let mut filtered: Option = None; let constraint_ref: &AnyConstraint = constraint; if platform_requirement_filter.is_ignored(package_name) { @@ -198,11 +195,11 @@ impl Solver { .as_any() .downcast_ref::( ) { - // TODO(phase-b): filter_constraint consumes its boxed constraint and would - // need an owned clone of the original. Skipping rewrite until Constraint - // ownership is reworked. - let _ = ignore_filter; - let _ = &mut filtered; + filtered = Some(ignore_filter.filter_constraint( + package_name, + constraint.clone(), + true, + )?); } let active_constraint: &AnyConstraint = filtered.as_ref().unwrap_or(constraint_ref); @@ -235,6 +232,8 @@ impl Solver { self.problems.push(problem); } } + + Ok(()) } pub fn solve( @@ -255,7 +254,7 @@ impl Solver { let _ = platform_requirement_filter.as_ref(); self.rules = rule_set_generator.get_rules_for(request, None)?; drop(rule_set_generator); - self.check_for_root_require_problems(request, platform_requirement_filter.as_ref()); + self.check_for_root_require_problems(request, platform_requirement_filter.as_ref())?; self.decisions = Decisions::new(self.pool.clone()); self.watch_graph = RuleWatchGraph::new(); -- cgit v1.3.1