aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe/src/downloader
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-07 13:37:11 +0900
committernsfisis <nsfisis@gmail.com>2026-06-07 13:37:11 +0900
commit86961b16b2f5c9c26a776193934d13ff87ab7fea (patch)
tree5a45b3aed39a6413e126c7992a8ac6ebcd30b0ad /crates/shirabe/src/downloader
parent14138dde4a8c874bdc498edd25d1a2d7dc9022be (diff)
downloadphp-shirabe-86961b16b2f5c9c26a776193934d13ff87ab7fea.tar.gz
php-shirabe-86961b16b2f5c9c26a776193934d13ff87ab7fea.tar.zst
php-shirabe-86961b16b2f5c9c26a776193934d13ff87ab7fea.zip
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<Rc<_>> 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) <noreply@anthropic.com>
Diffstat (limited to 'crates/shirabe/src/downloader')
-rw-r--r--crates/shirabe/src/downloader/file_downloader.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/crates/shirabe/src/downloader/file_downloader.rs b/crates/shirabe/src/downloader/file_downloader.rs
index e0fc0c9..9840cef 100644
--- a/crates/shirabe/src/downloader/file_downloader.rs
+++ b/crates/shirabe/src/downloader/file_downloader.rs
@@ -621,10 +621,13 @@ impl ChangeReportInterface for FileDownloader {
package: PackageInterfaceHandle,
path: &str,
) -> Result<Option<String>> {
- // TODO(phase-b): swap self.io to NullIO and restore — needs a take/swap helper
-
- let mut null_io = NullIO::new();
- null_io.load_configuration(&mut *self.config.borrow_mut())?;
+ let prev_io = std::mem::replace(
+ &mut self.io,
+ std::rc::Rc::new(std::cell::RefCell::new(NullIO::new())),
+ );
+ self.io
+ .borrow_mut()
+ .load_configuration(&mut *self.config.borrow_mut())?;
let target_dir = Filesystem::trim_trailing_slash(path);
// PHP attaches an onRejected handler to capture the error and drives the promise via
@@ -664,7 +667,7 @@ impl ChangeReportInterface for FileDownloader {
Ok(output)
})();
- // TODO(phase-b): restore self.io = prev_io
+ self.io = prev_io;
let (e, output) = match result {
Ok(output) => (None, output),