From fe0352e2db35ed559506c2b477708180768000e8 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 19 Jul 2026 18:47:48 +0900 Subject: fix(show-command): un-ignore 10 tests by fixing show-warnings typing and repo bugs Replace the PhpMixed-based `$showWarnings` hack in VersionSelector:: findBestCandidate with a typed ShowWarnings enum (Always / Predicate), letting ShowCommand::findLatestPackage pass its real closure instead of hardcoding `true`. Fix the --no-dev branch in ShowCommand::execute, which built `repos` from an empty package list instead of sharing the same InstalledRepository as `installed_repo`. Pass repository handles instead of pre-borrowed `&dyn RepositoryInterface` refs into get_package/ generate_package_tree/add_tree to stop a RefCell double-borrow panic on --all/--locked. Add the missing CompletePackage/RootPackage set_release_date setter so the outdated sorting-by-age test can set fixture dates. Resolve OutputFormatterStyleStack::pop's empty-style todo!() via clone_box(), and fix FileDownloader's cache-GC log call to pass the VERY_VERBOSE verbosity PHP uses. Co-Authored-By: Claude Sonnet 5 --- crates/shirabe/src/package/version/version_selector.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'crates/shirabe/src/package/version') diff --git a/crates/shirabe/src/package/version/version_selector.rs b/crates/shirabe/src/package/version/version_selector.rs index ff5e7586..e8539212 100644 --- a/crates/shirabe/src/package/version/version_selector.rs +++ b/crates/shirabe/src/package/version/version_selector.rs @@ -24,6 +24,13 @@ use shirabe_php_shim::{ use shirabe_semver::constraint::AnyConstraint; use shirabe_semver::constraint::SimpleConstraint; +/// PHP `$showWarnings` (`true` or a `callable(PackageInterface): bool`) as passed to +/// `VersionSelector::findBestCandidate`. +pub enum ShowWarnings { + Always, + Predicate(Box bool>), +} + #[derive(Debug)] pub struct VersionSelector { repository_set: std::rc::Rc>, @@ -66,7 +73,7 @@ impl VersionSelector { platform_requirement_filter: Option>, repo_set_flags: i64, io: Option>>, - show_warnings: shirabe_php_shim::PhpMixed, + show_warnings: ShowWarnings, ) -> anyhow::Result> { if !base_package::STABILITIES.contains_key(preferred_stability) { return Err(shirabe_php_shim::UnexpectedValueException { @@ -179,8 +186,8 @@ impl VersionSelector { already_seen_names.insert(pkg.get_name().to_string(), true); if let Some(ref io) = io { let should_warn = match &show_warnings { - shirabe_php_shim::PhpMixed::Bool(b) => *b, - _ => true, + ShowWarnings::Always => true, + ShowWarnings::Predicate(f) => f(pkg), }; if should_warn { let warn_key = format!("{}/{}", pkg.get_name(), link.get_target()); -- cgit v1.3.1