From f07202e69b389759cebed5a203756a1c66177e37 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sat, 27 Jun 2026 04:34:46 +0900 Subject: fix(validate-command): release Composer borrow before dispatching CommandEvent Holding a RefMut across execute() conflicted with the shared borrow taken inside EventDispatcher::get_script_listeners, panicking with "RefCell already mutably borrowed". All accessors used here take &self, so a shared borrow suffices. Co-Authored-By: Claude Opus 4.8 (1M context) --- crates/shirabe/tests/command/validate_command_test.rs | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'crates/shirabe/tests/command') diff --git a/crates/shirabe/tests/command/validate_command_test.rs b/crates/shirabe/tests/command/validate_command_test.rs index 5167fc0..933a0ff 100644 --- a/crates/shirabe/tests/command/validate_command_test.rs +++ b/crates/shirabe/tests/command/validate_command_test.rs @@ -72,10 +72,15 @@ fn provide_validate_tests() -> Vec { expected: "Composer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version\nComposer could not detect the root package (test/suite) version, defaulting to '1.0.0'. See https://getcomposer.org/root-version\n./composer.json is valid", }, ValidateCase { + // WORDING NOTE: upstream asserts justinrainbow's property-prefixed strings + // "- name : The property name is required" / "- description : The property description + // is required". The jsonschema crate reports the same required violations as + // "\"name\" is a required property" (no property prefix; the property name is embedded + // in the message). Matches the divergence already accepted in json_file_test. name: "passing but with warnings", composer_json: publish_data_stripped.clone(), command: vec![], - expected: "./composer.json is valid for simple usage with Composer but has\nstrict errors that make it unable to be published as a package\nSee https://getcomposer.org/doc/04-schema.md for details on the schema\n# Publish errors\n- name : The property name is required\n- description : The property description is required\n# General warnings\n- No license specified, it is recommended to do so. For closed-source software you may use \"proprietary\" as license.", + expected: "./composer.json is valid for simple usage with Composer but has\nstrict errors that make it unable to be published as a package\nSee https://getcomposer.org/doc/04-schema.md for details on the schema\n# Publish errors\n- \"name\" is a required property\n- \"description\" is a required property\n# General warnings\n- No license specified, it is recommended to do so. For closed-source software you may use \"proprietary\" as license.", }, ValidateCase { name: "passing without publish-check", @@ -88,9 +93,6 @@ fn provide_validate_tests() -> Vec { #[test] #[serial] -#[ignore = "validate creates a Composer instance (Factory::create_composer) which panics in \ - PartialComposerHandle::borrow_partial at crates/shirabe/src/composer.rs:446 \ - ('RefCell already mutably borrowed'); source-level borrow conflict, not a test issue"] fn test_validate() { for case in provide_validate_tests() { let _tear_down = init_temp_composer(Some(&case.composer_json), None, None, true); @@ -130,9 +132,6 @@ fn test_validate_on_file_issues() { #[test] #[serial] -#[ignore = "validate with a lock file creates a Composer instance (Factory::create_composer) which \ - panics in PartialComposerHandle::borrow_partial at crates/shirabe/src/composer.rs:446 \ - ('RefCell already mutably borrowed'); source-level borrow conflict, not a test issue"] fn test_with_composer_lock() { let tear_down = init_temp_composer(Some(&minimal_valid_configuration()), None, None, true); create_composer_lock(&[], &[]); -- cgit v1.3.1