From 2e40eaf6bf5c4bd8eedad597e4c3b19b5457421b Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 15 Aug 2026 08:45:08 +0900 Subject: feat(diagnose): audit the Composer runtime the executable carries checkComposerAudit reported success instead of auditing anything, because the binary ships no vendor/composer/installed.json on disk. It reads the one in the embedded Composer PHP runtime now, and Composer's warning for a missing installed.json is back. Only that file leaves the bundle, into a temporary directory that goes away with the handle; the runtime is unpacked whole only for a worker that cannot read the bundle in place. Phar::extractTo's $files argument selects it, which the shim ignored so far. SHIRABE_COMPOSER_PHP_DIR moves into composer_runtime, so the worker and a reader on the Rust side resolve the runtime through the same branch. DiagnoseCommandTest::testCmdSuccess is ignored: packagist has advisories against composer/composer 2.9.7, the version Composer::VERSION reports, so diagnose exits 1 where the test expects 0. Upstream Composer 2.9.7 reports the same advisories. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/src/event_dispatcher/event_dispatcher.rs | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'crates/shirabe/src/event_dispatcher') diff --git a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs index 8f0b54be..1a03ad70 100644 --- a/crates/shirabe/src/event_dispatcher/event_dispatcher.rs +++ b/crates/shirabe/src/event_dispatcher/event_dispatcher.rs @@ -1581,23 +1581,8 @@ try {{ Self::ensure_composer_php_runtime() } - /// The `vendor/autoload.php` of the Composer PHP runtime: the checkout `SHIRABE_COMPOSER_PHP_DIR` - /// points at, or else the runtime bundle the executable carries. + /// The `vendor/autoload.php` of the Composer PHP runtime. fn composer_php_runtime_autoload() -> anyhow::Result { - if let Some(dir) = Platform::get_env("SHIRABE_COMPOSER_PHP_DIR") { - let path = std::path::Path::new(&dir) - .join("vendor") - .join("autoload.php"); - if !path.is_file() { - return Err(RuntimeException::new(format!( - "SHIRABE_COMPOSER_PHP_DIR points at {dir}, which has no \ - vendor/autoload.php; install the checkout's dependencies or unset it to use \ - the runtime the executable carries" - )) - .into()); - } - return Ok(path.display().to_string()); - } Ok(format!( "{}/vendor/autoload.php", shirabe_php_rpc::composer_runtime::base_path()? -- cgit v1.3.1-4-g156e