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) --- .../src/repository/filesystem_repository.rs | 23 ++++++---------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'crates/shirabe/src/repository') diff --git a/crates/shirabe/src/repository/filesystem_repository.rs b/crates/shirabe/src/repository/filesystem_repository.rs index d9085bfd..b39fe829 100644 --- a/crates/shirabe/src/repository/filesystem_repository.rs +++ b/crates/shirabe/src/repository/filesystem_repository.rs @@ -1,7 +1,6 @@ //! ref: composer/src/Composer/Repository/FilesystemRepository.php use crate::config::is_php_integer_key; -use crate::installed_versions::InstalledVersions; use crate::installer::InstallationManagerInterface; use crate::json::JsonFile; use crate::package::BasePackageHandle; @@ -338,30 +337,20 @@ impl FilesystemRepository { ); // make sure the in memory state is up to date with on disk - // The upstream in-process reload/selfDir/installedIsLocalDir tail is mirrored - // twice: into the Rust-side statics below, and into the PHP worker where the real - // observers (plugins) live. The push is skipped when no worker is running — with no - // child there is nothing that could observe the state; the glue skips it only when - // the class is not even autoloadable there (no Composer PHP runtime = no observer - // code either). + // The upstream in-process reload/selfDir/installedIsLocalDir tail is pushed to the + // PHP worker, where the real observers (plugins) live. The push is skipped when no + // worker is running — with no child there is nothing that could observe the state; + // the glue skips it only when the class is not even autoloadable there (no Composer + // PHP runtime = no observer code either). if shirabe_php_rpc::worker_is_running() { crate::event_dispatcher::unwrap_php_result(shirabe_php_rpc::call_function( "__shirabe_installed_versions_reload", vec![ - shirabe_php_rpc::PluginValue::from_php_mixed(&PhpMixed::Array( - versions.clone(), - )), + shirabe_php_rpc::PluginValue::from_php_mixed(&PhpMixed::Array(versions)), shirabe_php_rpc::PluginValue::string(repo_dir.clone()), ], ))?; } - InstalledVersions::reload(versions); - - // make sure the selfDir matches the expected data at runtime if the class was loaded from the vendor dir, as it may have been - // loaded from the Composer sources, causing packages to appear twice in that case if the installed.php is loaded in addition to the - // in memory loaded data from above - InstalledVersions::set_self_dir(repo_dir.replace('\\', "/")); - InstalledVersions::set_installed_is_local_dir(true); } Ok(()) -- cgit v1.3.1-4-g156e