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/package/alias_package.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'crates/shirabe/src/package/alias_package.rs') diff --git a/crates/shirabe/src/package/alias_package.rs b/crates/shirabe/src/package/alias_package.rs index 7ab1967..657b007 100644 --- a/crates/shirabe/src/package/alias_package.rs +++ b/crates/shirabe/src/package/alias_package.rs @@ -144,7 +144,7 @@ impl AliasPackage { let mut new_links: Vec = vec![]; for link in links.values() { // link is self.version, but must be replacing also the replaced version - if link.get_pretty_constraint().unwrap_or("") == "self.version" { + if link.get_pretty_constraint() == "self.version" { let constraint = SimpleConstraint::new( "=".to_string(), self.version.to_string(), @@ -155,7 +155,7 @@ impl AliasPackage { link.get_target().to_string(), constraint.into(), Some(link_type.to_string()), - Some(pretty_version.clone()), + pretty_version.clone(), ); new_links.push(new_link); } @@ -165,7 +165,7 @@ impl AliasPackage { } } else { for link in links.values_mut() { - if link.get_pretty_constraint().unwrap_or("") == "self.version" { + if link.get_pretty_constraint() == "self.version" { if link_type == Link::TYPE_REQUIRE { self.has_self_version_requires = true; } @@ -179,7 +179,7 @@ impl AliasPackage { link.get_target().to_string(), constraint.into(), Some(link_type.to_string()), - Some(pretty_version.clone()), + pretty_version.clone(), ); } } -- cgit v1.3.1