From 1909f94b8f4634a7b5abef2ebf4de92b56f4091c Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 28 Jun 2026 23:34:58 +0900 Subject: fix(repository): flatten InstalledRepository and unwrap filter repos in show flattenRepositories must recurse into InstalledRepository (which extends CompositeRepository in PHP) and ShowCommand must unwrap FilterRepository when categorizing repos. Without this, installed/locked/platform packages all fell through to the "available" bucket, dropping the version column and per-section grouping. Un-ignores 10 show_command tests. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/src/command/show_command.rs | 2 +- crates/shirabe/src/repository/repository_utils.rs | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'crates/shirabe/src') diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index 6e777a1..4f7403d 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -862,7 +862,7 @@ impl Command for ShowCommand { input.borrow_mut().set_option("path", PhpMixed::Bool(false)); } - for repo in RepositoryUtils::flatten_repositories(repos.clone(), false) { + for repo in RepositoryUtils::flatten_repositories(repos.clone(), true) { let r#type = if Self::same_repository(&repo, &platform_repo) { "platform" } else if locked_repo diff --git a/crates/shirabe/src/repository/repository_utils.rs b/crates/shirabe/src/repository/repository_utils.rs index 40cb4d2..c2997f3 100644 --- a/crates/shirabe/src/repository/repository_utils.rs +++ b/crates/shirabe/src/repository/repository_utils.rs @@ -3,6 +3,7 @@ use crate::package::Link; use crate::repository::CompositeRepository; use crate::repository::FilterRepository; +use crate::repository::InstalledRepository; use crate::repository::RepositoryInterfaceHandle; use indexmap::IndexMap; @@ -57,11 +58,19 @@ impl RepositoryUtils { repo }; + // PHP `InstalledRepository extends CompositeRepository`, so it must flatten too. The Rust + // port embeds the CompositeRepository instead of inheriting it, so the downcast is tried + // explicitly here. let nested = { let r = repo.borrow(); r.as_any() .downcast_ref::() .map(|composite_repo| composite_repo.get_repositories().clone()) + .or_else(|| { + r.as_any() + .downcast_ref::() + .map(|installed_repo| installed_repo.get_repositories().clone()) + }) }; if let Some(nested) = nested { let mut repos = Vec::new(); -- cgit v1.3.1