aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-06-28 23:34:58 +0900
committernsfisis <nsfisis@gmail.com>2026-06-28 23:34:58 +0900
commit1909f94b8f4634a7b5abef2ebf4de92b56f4091c (patch)
tree6c42919dc02c01daeeff27ddee732428a854798f /crates
parent1a85368838c1e482f2a7020ff1cbdc87fcb092cc (diff)
downloadphp-shirabe-1909f94b8f4634a7b5abef2ebf4de92b56f4091c.tar.gz
php-shirabe-1909f94b8f4634a7b5abef2ebf4de92b56f4091c.tar.zst
php-shirabe-1909f94b8f4634a7b5abef2ebf4de92b56f4091c.zip
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) <noreply@anthropic.com>
Diffstat (limited to 'crates')
-rw-r--r--crates/shirabe/src/command/show_command.rs2
-rw-r--r--crates/shirabe/src/repository/repository_utils.rs9
-rw-r--r--crates/shirabe/tests/command/show_command_test.rs16
3 files changed, 13 insertions, 14 deletions
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::<CompositeRepository>()
.map(|composite_repo| composite_repo.get_repositories().clone())
+ .or_else(|| {
+ r.as_any()
+ .downcast_ref::<InstalledRepository>()
+ .map(|installed_repo| installed_repo.get_repositories().clone())
+ })
};
if let Some(nested) = nested {
let mut repos = Vec::new();
diff --git a/crates/shirabe/tests/command/show_command_test.rs b/crates/shirabe/tests/command/show_command_test.rs
index ef23a1e..3a6196f 100644
--- a/crates/shirabe/tests/command/show_command_test.rs
+++ b/crates/shirabe/tests/command/show_command_test.rs
@@ -78,7 +78,6 @@ fn run_show_case(command: Vec<(PhpMixed, PhpMixed)>, expected: &str, requires: s
use crate::test_case::{create_composer_lock, create_installed_json};
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_default_shows_installed_with_version_and_description() {
@@ -92,7 +91,6 @@ vendor/package 1.0.0 description of installed package",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_with_installed_and_self() {
@@ -155,7 +153,6 @@ fn test_show_with_direct_shows_nothing_if_no_deps() {
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_with_direct_shows_only_root_deps() {
@@ -169,7 +166,6 @@ fn test_show_with_direct_shows_only_root_deps() {
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_outdated_deps() {
@@ -214,7 +210,6 @@ outdated/major 1.0.0 ~ 2.0.0 from today",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_outdated_deps_with_direct_only_show_direct_deps_with_updated() {
@@ -234,7 +229,6 @@ outdated/major 1.0.0 ~ 2.0.0",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_outdated_deps_with_direct_show_msg_if_all_up_to_date() {
@@ -248,7 +242,6 @@ fn test_show_outdated_deps_with_direct_show_msg_if_all_up_to_date() {
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_outdated_deps_with_major_only() {
@@ -270,7 +263,6 @@ outdated/major 1.0.0 ~ 2.0.0",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_outdated_deps_with_minor_only() {
@@ -293,7 +285,6 @@ outdated/patch 1.0.0 <highlight>! 1.0.1</highlight>",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_show_outdated_deps_with_patch_only() {
@@ -317,7 +308,7 @@ outdated/patch 1.0.0 <highlight>! 1.0.1</highlight>",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
+#[ignore = "blocked: categorization fixed, but the --latest path still resolves the wrong latest-package version (gets 1.0.0, expects 1.3.0); outdated version-resolution gap, not categorization"]
#[test]
#[serial]
fn test_outdated_filters_according_to_platform_reqs_and_warns() {
@@ -390,7 +381,7 @@ vendor/package 1.1.0 ~ 1.0.0",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
+#[ignore = "blocked: categorization fixed, but the --latest path resolves the wrong latest version (gets 1.2.0, expects 1.3.0); outdated version-resolution gap, not categorization"]
#[test]
#[serial]
fn test_outdated_filters_according_to_platform_reqs_without_warning_for_higher_versions() {
@@ -645,7 +636,6 @@ fn test_show_platform_works_without_composer_json() {
assert_eq!(0, status_code);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
#[test]
#[serial]
fn test_outdated_with_zero_major() {
@@ -749,7 +739,7 @@ zerozero/major 0.0.1 ~ 0.0.2",
);
}
-#[ignore = "blocked: package categorization is wrong - installed/locked/platform packages all land in the \"available\" bucket, which renders name+description only. The version column is therefore dropped and the per-section grouping (installed:/locked:/platform: headers, and the outdated command's \"Direct/Transitive dependencies required in composer.json\" split) never appears. Logic gap in doExecute, not an output-format issue."]
+#[ignore = "blocked: categorization fixed, but platform packages do not appear in the --all section grouping (the platform: section is empty); separate gap in platform bucket population"]
#[test]
#[serial]
fn test_show_all_shows_all_sections() {