From 6643eb8b7d305818f80c910144b3b29b1af34ba7 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 9 Aug 2026 09:14:11 +0900 Subject: refactor(installed-versions): drop the Rust port, which has no readers InstalledVersions is a runtime API for plugins and project code; Composer itself never reads it. Its consumers run in the PHP worker against the copy FilesystemRepository dumps to vendor/composer/InstalledVersions.php, whose static state is already kept in sync by __shirabe_installed_versions_reload. Nothing in Rust read the mirrored statics, so reload() and the reflection setters were no-ops. The tests covered only the Rust port, not the PHP class the worker loads, so they assert nothing about compatibility; they are left as todo!() skeletons. This also removes the shim functions method_exists, php_dir and require_php_file, whose only caller was the deleted module. Co-Authored-By: Claude Opus 5 (1M context) --- .../tests/repository/filesystem_repository_test.rs | 69 ++-------------------- 1 file changed, 4 insertions(+), 65 deletions(-) (limited to 'crates/shirabe/tests/repository') diff --git a/crates/shirabe/tests/repository/filesystem_repository_test.rs b/crates/shirabe/tests/repository/filesystem_repository_test.rs index a9ac91a0..b87e1502 100644 --- a/crates/shirabe/tests/repository/filesystem_repository_test.rs +++ b/crates/shirabe/tests/repository/filesystem_repository_test.rs @@ -4,7 +4,6 @@ use crate::test_case::{get_alias_package, get_package}; use indexmap::IndexMap; use serial_test::serial; use shirabe::dependency_resolver::operation::AnyOperation; -use shirabe::installed_versions::InstalledVersions; use shirabe::installer::{InstallationManagerInterface, InstallerInterface}; use shirabe::io::IOInterface; use shirabe::json::json_file::JsonFile; @@ -326,70 +325,10 @@ fn test_repository_writes_installed_php() { assert_eq!(expected, actual); } -#[ignore = "safely_load_installed_versions's pattern uses a PCRE (?(DEFINE)...) recursive grammar the regex crate cannot compile"] +#[ignore = "safely_load_installed_versions's pattern uses a PCRE (?(DEFINE)...) recursive grammar the regex crate cannot compile, and InstalledVersions::getAllRawData has no Rust counterpart"] #[test] fn test_safely_load_installed_versions() { - let fixtures_dir = format!( - "{}/../../composer/tests/Composer/Test/Repository/Fixtures", - env!("CARGO_MANIFEST_DIR") - ); - let path = format!("{}/installed_complex.php", fixtures_dir); - - let result = FilesystemRepository::safely_load_installed_versions(&path); - assert!(result, "The file should be considered valid"); - - let raw_data = InstalledVersions::get_all_raw_data(); - let raw_data = raw_data.last().cloned().unwrap(); - - let mut root: IndexMap = IndexMap::new(); - root.insert( - "install_path".to_string(), - PhpMixed::String(format!("{}/./", fixtures_dir)), - ); - root.insert( - "aliases".to_string(), - PhpMixed::List(vec![ - PhpMixed::String("1.10.x-dev".to_string()), - PhpMixed::String("2.10.x-dev".to_string()), - ]), - ); - root.insert("name".to_string(), PhpMixed::String("__root__".to_string())); - root.insert("true".to_string(), PhpMixed::Bool(true)); - root.insert("false".to_string(), PhpMixed::Bool(false)); - root.insert("null".to_string(), PhpMixed::Null); - - let mut a_provider: IndexMap = IndexMap::new(); - a_provider.insert( - "foo".to_string(), - PhpMixed::String("simple string/no backslash".to_string()), - ); - a_provider.insert( - "install_path".to_string(), - PhpMixed::String(format!( - "{}/vendor/{{${{passthru('bash -i')}}}}", - fixtures_dir - )), - ); - a_provider.insert("empty array".to_string(), PhpMixed::List(vec![])); - - let mut c_c: IndexMap = IndexMap::new(); - c_c.insert( - "install_path".to_string(), - PhpMixed::String("/foo/bar/ven/do{}r/c/c${}".to_string()), - ); - c_c.insert("aliases".to_string(), PhpMixed::List(vec![])); - c_c.insert( - "reference".to_string(), - PhpMixed::String("{${passthru('bash -i')}} Foo\\Bar\n\ttab\u{0b}verticaltab\0".to_string()), - ); - - let mut versions: IndexMap = IndexMap::new(); - versions.insert("a/provider".to_string(), PhpMixed::Array(a_provider)); - versions.insert("c/c".to_string(), PhpMixed::Array(c_c)); - - let mut expected: IndexMap = IndexMap::new(); - expected.insert("root".to_string(), PhpMixed::Array(root)); - expected.insert("versions".to_string(), PhpMixed::Array(versions)); - - assert_eq!(raw_data, expected); + // TODO(phase-d): needs a regex-crate expression equivalent to the PCRE recursive grammar, and + // InstalledVersions::get_all_raw_data. + todo!() } -- cgit v1.3.1-4-g156e