From aa2124fe5d0c96078c034a6e4044b7e81acdf692 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 16 Aug 2026 14:18:41 +0900 Subject: feat(php-rpc): replay Rust-side env writes into the PHP worker The worker is a long-lived child holding the environment it was handed at spawn, so `@putenv`, the bin dir the event dispatcher prepends to PATH, and COMPOSER_DEV_MODE never reached the PHP code running in it. The shim now journals every write to the three storages PHP exposes, and the outermost rpc_call replays the entries the worker has not seen yet through __shirabe_sync_env. Replaying the writes rather than pushing a whole snapshot keeps the worker's own $_SERVER entries intact. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs | 8 -------- 1 file changed, 8 deletions(-) (limited to 'crates/shirabe') diff --git a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs index 7a98adc8..e3f5c9a5 100644 --- a/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs +++ b/crates/shirabe/tests/event_dispatcher/event_dispatcher_test.rs @@ -740,12 +740,8 @@ fn test_dispatcher_can_execute_cli_and_php_in_same_event_script_stack() { assert_eq!(expected, io.borrow().get_output()); } -// TODO(php-runtime): `@putenv` writes the environment of the Shirabe process, while the listener -// reads `getenv()` inside the PHP worker — a long-lived child that keeps the environment it -// inherited when it was spawned. Nothing propagates the write across the boundary. #[test] #[serial] -#[ignore = "`@putenv ABC=123` does not reach the PHP worker the listener runs in"] fn test_dispatcher_can_put_env() { let _tear_down = TearDown; if !php_runtime_available() { @@ -786,12 +782,8 @@ fn test_dispatcher_can_put_env() { assert_eq!(expected, io.borrow().get_output()); } -// TODO(php-runtime): the bin dir is appended to the PATH of the Shirabe process, while the -// listeners read `getenv('PATH')` inside the PHP worker — a long-lived child that keeps the -// environment it inherited when it was spawned. Nothing propagates the append across the boundary. #[test] #[serial] -#[ignore = "the bin dir the dispatcher appends to PATH does not reach the PHP worker the listeners run in"] fn test_dispatcher_appends_dir_bin_on_path_for_every_listener() { let _tear_down = TearDown; if !php_runtime_available() { -- cgit v1.3.1-4-g156e