From f47b9ad7e108f29f657459569b2a41f5cdf0a74a Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 25 Jul 2026 23:25:46 +0900 Subject: fix(require-command): end input borrow before asking for confirmation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `fixed` option was read as a temporary inside the argument list of update_requirements_after_resolution(), so the Ref lived until the end of the enclosing let statement — i.e. across the whole call. When the resolved version looks like a feature branch, that call asks for confirmation, and ConsoleIO takes the same input RefCell mutably, panicking with "RefCell already borrowed". Hoisting the read into its own statement ends the borrow before the call. The expected output of the un-ignored test transcribed PHP's string concatenation operator (`[y,n]? '.'`, used to keep the trailing space visible) as a literal `.`; it now matches RequireCommandTest.php. Co-Authored-By: Claude Opus 5 (1M context) --- crates/shirabe/tests/command/require_command_test.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'crates/shirabe/tests/command') diff --git a/crates/shirabe/tests/command/require_command_test.rs b/crates/shirabe/tests/command/require_command_test.rs index 2ab3989b..f23a6951 100644 --- a/crates/shirabe/tests/command/require_command_test.rs +++ b/crates/shirabe/tests/command/require_command_test.rs @@ -58,10 +58,6 @@ fn test_require_throws_if_none_matches() { #[test] #[serial] -#[ignore = "the pre-operations-exec listener bug is fixed; now fails with \"RefCell already \ - borrowed\" at console_io.rs:366 (ConsoleIO::ask_question, reached via \ - ask_confirmation from RequireCommand::update_requirements_after_resolution) — a \ - re-entrant IO RefCell borrow, unrelated to event dispatching"] fn test_require_warns_if_resolved_to_feature_branch() { let composer_json = serde_json::json!({ "repositories": { @@ -114,8 +110,8 @@ Package operations: 2 installs, 0 updates, 0 removals - Installing required/pkg (dev-foo-bar) Using version dev-foo-bar for required/pkg Version dev-foo-bar looks like it may be a feature branch which is unlikely to keep working in the long run and may be in an unstable state -Are you sure you want to use this constraint (y) or would you rather abort (n) the whole operation [y,n]? . -Installation failed, reverting ./composer.json to its original content. +Are you sure you want to use this constraint (y) or would you rather abort (n) the whole operation [y,n]? \ +\nInstallation failed, reverting ./composer.json to its original content. ", app_tester.get_display() ); -- cgit v1.3.1