From 971824aa15334fd12d08ae0f441f6bf6079344c3 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 7 Jun 2026 10:33:53 +0900 Subject: feat(shirabe): resolve phase-b TODOs with shared ownership Replace TODO(phase-b) placeholders (todo!() and commented-out code) with real implementations: - Share JsonFile via Rc> so JsonConfigSource and the owning command can hold the same instance (base_config_command, config_command, repository_command, require_command, create_project, remove_command, factory) - Change InstallerInterface methods (is_installed, download, prepare, cleanup, get_install_path) to &mut self so initialize_vendor_dir can run, propagated to all installer implementations - Pass io/config/filesystem/process by clone instead of moving or stubbing (auth_helper, svn_driver, curl_downloader, library_installer) - Make TransportException Clone and store it by value in VcsRepository - Clone operations in Transaction sort, root_aliases/temporary_constraints in RepositorySet::create_pool, and share CompletePackage via handle in PlatformRepository - Wire up set_option, set_requires/set_dev_requires, installation manager setters, BumpCommand::set_composer, and clean_backups/set_local_phar --- crates/shirabe/src/repository/vcs_repository.rs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'crates/shirabe/src/repository/vcs_repository.rs') diff --git a/crates/shirabe/src/repository/vcs_repository.rs b/crates/shirabe/src/repository/vcs_repository.rs index e90ac62..4c2492a 100644 --- a/crates/shirabe/src/repository/vcs_repository.rs +++ b/crates/shirabe/src/repository/vcs_repository.rs @@ -70,9 +70,7 @@ pub struct VcsRepository { /// @var list empty_references: Vec, /// @var array<'tags'|'branches', array> - // TODO(phase-b): TransportException is a PHP class; uses Rc for shared ownership. - version_transport_exceptions: - IndexMap>>, + version_transport_exceptions: IndexMap>, /// @var ?EventDispatcher (preserved for plugin events) _dispatcher: Option>>, } @@ -277,7 +275,7 @@ impl VcsRepository { /// @return array<'tags'|'branches', array> pub fn get_version_transport_exceptions( &self, - ) -> &IndexMap>> { + ) -> &IndexMap> { &self.version_transport_exceptions } @@ -543,15 +541,10 @@ impl VcsRepository { })(); if let Err(e) = result { if let Some(te) = e.downcast_ref::() { - // TODO(phase-b): TransportException is a PHP class (shared by ref). We only - // have &TransportException from downcast_ref; obtaining the Rc requires the - // anyhow::Error chain to carry an Rc. For now we insert a todo!() placeholder. - let shared_te: std::rc::Rc = - todo!("share TransportException via Rc through anyhow::Error chain"); self.version_transport_exceptions .entry("tags".to_string()) .or_insert_with(IndexMap::new) - .insert(tag.clone(), shared_te); + .insert(tag.clone(), te.clone()); if te.get_code() == 404 { self.empty_references.push(identifier.clone()); } @@ -728,14 +721,10 @@ impl VcsRepository { })(); if let Err(e) = result { if let Some(te) = e.downcast_ref::() { - // TODO(phase-b): TransportException is a PHP class (shared by ref). - // See the matching tags block above; same Rc story applies. - let shared_te: std::rc::Rc = - todo!("share TransportException via Rc through anyhow::Error chain"); self.version_transport_exceptions .entry("branches".to_string()) .or_insert_with(IndexMap::new) - .insert(branch.clone(), shared_te); + .insert(branch.clone(), te.clone()); if te.get_code() == 404 { self.empty_references.push(identifier.clone()); } -- cgit v1.3.1