From 7e31bab9ff7209c9b6d7928a581d7a449846f42e Mon Sep 17 00:00:00 2001 From: nsfisis Date: Sun, 2 Aug 2026 17:32:43 +0900 Subject: fix(json): propagate JsonFile::encode errors instead of unwrapping PHP's JsonFile::encode throws a RuntimeException when json_encode fails; the port swallowed that into an .unwrap() marked TODO(phase-c). Return anyhow::Result from encode/encode_with_options and propagate at every call site (print_table and list_repositories become Result-returning to carry it). Co-Authored-By: Claude Fable 5 --- crates/shirabe/tests/installer_test.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'crates/shirabe/tests/installer_test.rs') diff --git a/crates/shirabe/tests/installer_test.rs b/crates/shirabe/tests/installer_test.rs index b81ec7a4..d0b60ba8 100644 --- a/crates/shirabe/tests/installer_test.rs +++ b/crates/shirabe/tests/installer_test.rs @@ -707,7 +707,8 @@ fn load_integration_tests(path: &str) -> Vec { let encoded = JsonFile::encode_with_options( &composer, shirabe::json::JsonEncodeOptions::none(), - ); + ) + .unwrap(); let hash = format!("{:x}", md5::compute(encoded.as_bytes())); lock["hash"] = serde_json::Value::String(hash); } @@ -926,7 +927,8 @@ fn do_test_integration(case: &IntegrationCase, expect_output: Option<&str>) { // escaped), or the freshness check spuriously fails on any composer.json containing "/" // (e.g. any vendor/package name). let contents = - JsonFile::encode_with_options(&case.composer, shirabe::json::JsonEncodeOptions::none()); + JsonFile::encode_with_options(&case.composer, shirabe::json::JsonEncodeOptions::none()) + .unwrap(); let locker = Locker::new(io.clone(), lock_json, locker_im, &contents, process); composer .borrow_mut() -- cgit v1.3.1