From a7bd624b3e9d4e9493435be1e6016303830e7087 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Thu, 6 Aug 2026 20:38:08 +0900 Subject: fix(repository-manager): fail explicitly on an unknown repository class createRepository instantiates `new $class(...)` from the name registered for the type. The port dispatches over the classes it implements, and the remaining arm was a todo!(). setRepositoryClass is public API, so a plugin registering a class of its own reached it and panicked. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/repository/repository_manager.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'crates') diff --git a/crates/shirabe/src/repository/repository_manager.rs b/crates/shirabe/src/repository/repository_manager.rs index 5f74fc90..7fd2f80a 100644 --- a/crates/shirabe/src/repository/repository_manager.rs +++ b/crates/shirabe/src/repository/repository_manager.rs @@ -10,7 +10,7 @@ use crate::repository::RepositoryInterfaceHandle; use crate::util::HttpDownloader; use crate::util::ProcessExecutor; use indexmap::IndexMap; -use shirabe_php_shim::{InvalidArgumentException, PhpMixed, json_encode}; +use shirabe_php_shim::{InvalidArgumentException, PhpMixed, RuntimeException, json_encode}; use shirabe_semver::constraint::AnyConstraint; #[derive(Debug)] @@ -191,10 +191,12 @@ impl RepositoryManager { Some(self.process.clone()), )?, )), - other => todo!( - "dynamic class instantiation is not implemented for repository class {}", - other - ), + // TODO(plugin): `setRepositoryClass` lets a plugin register a repository class of + // its own, which needs a Rust-side counterpart before it can be built here. + other => Err(anyhow::anyhow!(RuntimeException { + message: format!("Repository class has no Rust implementation: {other}"), + code: 0, + })), } } -- cgit v1.3.1