From 1e7aabcae1b2139aa20a80fbf303c74388933f55 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 6 Jun 2026 15:16:07 +0900 Subject: fix(array-dumper): emit package links and require Link pretty constraint Resolve the phase-b TODO that left the supported-link-types loop as dead code (links were always an empty Vec), so requires/conflicts/provides/ replaces/require-dev are dumped again via PackageInterface::get_links_for_type, matching the PHP magic-call loop. Every Link in production is constructed with a pretty constraint (all ArrayLoader/AliasPackage/PlatformRepository/InstalledRepository sites pass one), so make Link::pretty_constraint a required String instead of Option. get_pretty_constraint() now returns &str directly rather than anyhow::Result<&str>, dropping the unreachable UnexpectedValueException guard, and all call sites are updated. Co-Authored-By: Claude Opus 4.8 --- crates/shirabe/src/command/show_command.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/src/command/show_command.rs') diff --git a/crates/shirabe/src/command/show_command.rs b/crates/shirabe/src/command/show_command.rs index 9592f4e..299ba1e 100644 --- a/crates/shirabe/src/command/show_command.rs +++ b/crates/shirabe/src/command/show_command.rs @@ -1811,7 +1811,7 @@ impl ShowCommand { io.write(&format!( "{} {}", link.1.get_target(), - link.1.get_pretty_constraint().unwrap_or("") + link.1.get_pretty_constraint(), )); } } @@ -2173,7 +2173,7 @@ impl ShowCommand { for link in links.iter() { m.insert( link.1.get_target().to_string(), - PhpMixed::String(link.1.get_pretty_constraint().unwrap_or("").to_string()), + PhpMixed::String(link.1.get_pretty_constraint().to_string()), ); } json.insert( @@ -2309,7 +2309,7 @@ impl ShowCommand { tree_child_desc.insert("name".to_string(), PhpMixed::String(require_name.clone())); tree_child_desc.insert( "version".to_string(), - PhpMixed::String(require.get_pretty_constraint().unwrap_or("").to_string()), + PhpMixed::String(require.get_pretty_constraint().to_string()), ); let deep_children = self @@ -2452,11 +2452,11 @@ impl ShowCommand { packages_in_tree: &[PhpMixed], ) -> anyhow::Result>> { let mut children: Vec> = Vec::new(); - let version_arg: PhpMixed = if link.get_pretty_constraint().ok() == Some("self.version") { + let version_arg: PhpMixed = if link.get_pretty_constraint() == "self.version" { // pass the ConstraintInterface object — signal via Null in this scalar shape PhpMixed::Null } else { - PhpMixed::String(link.get_pretty_constraint().unwrap_or("").to_string()) + PhpMixed::String(link.get_pretty_constraint().to_string()) }; let (package, _) = self.get_package(installed_repo, remote_repos, name, version_arg)?; if let Some(package) = package { @@ -2469,7 +2469,7 @@ impl ShowCommand { tree_child_desc.insert("name".to_string(), PhpMixed::String(require_name.clone())); tree_child_desc.insert( "version".to_string(), - PhpMixed::String(require.get_pretty_constraint().unwrap_or("").to_string()), + PhpMixed::String(require.get_pretty_constraint().to_string()), ); if !in_array( -- cgit v1.3.1