fix: Correct HttpRequestBox method_id mapping in nyash.toml

Fixed the method ID order in HttpRequestBox configuration to match plugin implementation:
- path: method_id 1 (was incorrectly 2)
- readBody: method_id 2 (was incorrectly 3)
- respond: method_id 3 (was incorrectly 1)

This resolves the 45-day debugging issue where req.respond(resp) was calling
the wrong plugin method, causing HTTP responses to have empty bodies.

All E2E tests now pass:
- e2e_http_stub_end_to_end 
- e2e_http_multiple_requests_order 
- e2e_http_post_and_headers 
- e2e_http_server_restart 
- e2e_http_server_shutdown_and_restart 

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Moe Charm
2025-08-22 12:09:06 +09:00
parent 0915815340
commit 080458d4d4
24 changed files with 694 additions and 255 deletions

View File

@ -39,14 +39,17 @@ impl NyashResultBox {
impl NyashBox for NyashResultBox {
fn clone_box(&self) -> Box<dyn NyashBox> {
match self {
NyashResultBox::Ok(val) => Box::new(NyashResultBox::Ok(val.clone_box())),
NyashResultBox::Err(err) => Box::new(NyashResultBox::Err(err.clone_box())),
NyashResultBox::Ok(val) => Box::new(NyashResultBox::Ok(val.clone_or_share())),
NyashResultBox::Err(err) => Box::new(NyashResultBox::Err(err.clone_or_share())),
}
}
/// 仮実装: clone_boxと同じ後で修正
fn share_box(&self) -> Box<dyn NyashBox> {
self.clone_box()
match self {
NyashResultBox::Ok(val) => Box::new(NyashResultBox::Ok(val.share_box())),
NyashResultBox::Err(err) => Box::new(NyashResultBox::Err(err.share_box())),
}
}
fn to_string_box(&self) -> StringBox {
@ -126,7 +129,14 @@ impl ResultBox {
/// getValue()の実装 - Ok値を取得
pub fn get_value(&self) -> Box<dyn NyashBox> {
match self {
NyashResultBox::Ok(val) => val.clone_box(),
NyashResultBox::Ok(val) => {
// Preserve identity for plugin-backed boxes
if val.as_any().downcast_ref::<crate::runtime::plugin_loader_v2::PluginBoxV2>().is_some() {
val.share_box()
} else {
val.clone_box()
}
}
NyashResultBox::Err(_) => Box::new(StringBox::new("Error: Result is Err")),
}
}