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/dependency_resolver/problem.rs | 2 +- crates/shirabe/src/dependency_resolver/rule.rs | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/src/dependency_resolver') diff --git a/crates/shirabe/src/dependency_resolver/problem.rs b/crates/shirabe/src/dependency_resolver/problem.rs index 874d56e..47cf3b5 100644 --- a/crates/shirabe/src/dependency_resolver/problem.rs +++ b/crates/shirabe/src/dependency_resolver/problem.rs @@ -1153,7 +1153,7 @@ impl Problem { if link.get_target() == package_name { return Some(format!( "{} {}d by {}", - link.get_pretty_constraint().unwrap_or(""), + link.get_pretty_constraint(), substr(link.get_description(), 0, Some(-1)), selected.get_pretty_string() )); diff --git a/crates/shirabe/src/dependency_resolver/rule.rs b/crates/shirabe/src/dependency_resolver/rule.rs index 3d7bb2d..7804b99 100644 --- a/crates/shirabe/src/dependency_resolver/rule.rs +++ b/crates/shirabe/src/dependency_resolver/rule.rs @@ -441,7 +441,7 @@ impl Rule { conflict_target = format!( "{} {}", package1.get_pretty_name(), - link.get_pretty_constraint().unwrap_or("") + link.get_pretty_constraint(), ); } @@ -453,16 +453,14 @@ impl Rule { for provide in package1.get_provides().values() { if provide.get_target() == link.get_target() { provide_type = Some("provides"); - provided = - Some(provide.get_pretty_constraint().unwrap_or("").to_string()); + provided = Some(provide.get_pretty_constraint().to_string()); break; } } for replace in package1.get_replaces().values() { if replace.get_target() == link.get_target() { provide_type = Some("replaces"); - provided = - Some(replace.get_pretty_constraint().unwrap_or("").to_string()); + provided = Some(replace.get_pretty_constraint().to_string()); break; } } @@ -470,7 +468,7 @@ impl Rule { conflict_target = format!( "{} {} ({} {} {} {})", link.get_target(), - link.get_pretty_constraint().unwrap_or(""), + link.get_pretty_constraint(), package1.get_pretty_string(), pt, link.get_target(), -- cgit v1.3.1