fix: Resolve MIR phi value bug and HTTP error handling

- Fix MIR builder to correctly return phi values in if-else statements
  - Add extract_assigned_var helper to handle Program blocks
  - Update variable mapping after phi node creation
  - Fixes 'Value %14 not set' error in e2e_vm_http_client_error_result

- Fix HTTP plugin error handling for connection failures
  - Return error string instead of handle on tcp_ok=false
  - Enable proper ResultBox(Err) creation for failed connections
  - Now r.isOk() correctly returns false for connection errors

- Add VM fallback for toString() on any Box type
  - Ensures error messages can be displayed even without specific implementation

- All e2e_vm_http_client_error_result tests now pass

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-23 06:51:49 +09:00
parent 3b03d001ba
commit 494a864ed2
5 changed files with 123 additions and 8 deletions

View File

@ -555,7 +555,13 @@ unsafe fn client_invoke(m: u32, id: u32, args: *const u8, args_len: usize, res:
netlog!("client.get: url={} resp_id={} tcp_ok=false", url, resp_id);
}
// No stub enqueue in TCP-only design
write_tlv_handle(T_RESPONSE, resp_id, res, res_len)
if tcp_ok {
write_tlv_handle(T_RESPONSE, resp_id, res, res_len)
} else {
// Encode error string; loader interprets returns_result=true methods' string payload as Err
let msg = format!("connect failed for {}:{}{}", host, port, if path.is_empty() { "" } else { &path });
write_tlv_string(&msg, res, res_len)
}
}
M_CLIENT_POST => {
// args: TLV String(url), Bytes body
@ -598,7 +604,12 @@ unsafe fn client_invoke(m: u32, id: u32, args: *const u8, args_len: usize, res:
netlog!("client.post: url={} resp_id={} tcp_ok=false body_len={}", url, resp_id, body.len());
}
// No stub enqueue in TCP-only design
write_tlv_handle(T_RESPONSE, resp_id, res, res_len)
if tcp_ok {
write_tlv_handle(T_RESPONSE, resp_id, res, res_len)
} else {
let msg = format!("connect failed for {}:{}{} (body_len={})", host, port, if path.is_empty() { "" } else { &path }, body_len);
write_tlv_string(&msg, res, res_len)
}
}
_ => E_INV_METHOD,
}