fix: don't parse cap params in wit/de_wit

This commit is contained in:
dr-frmr 2024-07-04 17:57:52 +02:00
parent 9c0f1af7e5
commit c95ee099ee
No known key found for this signature in database
2 changed files with 13 additions and 4 deletions

View File

@ -143,7 +143,7 @@ async fn handle_kernel_request(
// fire an error back
t::KernelMessage::builder()
.id(km.id)
.source(("our", KERNEL_PROCESS_ID.clone()))
.source((our_name, KERNEL_PROCESS_ID.clone()))
.target(km.rsvp.unwrap_or(km.source))
.message(t::Message::Response((
t::Response {
@ -781,6 +781,10 @@ pub async fn kernel(
kernel_message.source.process
)
).send(&send_to_terminal).await;
t::Printout::new(
0,
format!("their capabilities: {:?}", proc.capabilities)
).send(&send_to_terminal).await;
throw_timeout(&our.name, &senders, kernel_message).await;
continue;
}

View File

@ -513,7 +513,12 @@ impl Capability {
impl std::fmt::Display for Capability {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}({})", self.issuer, self.params)
write!(
f,
"{}({})",
self.issuer,
serde_json::from_str::<serde_json::Value>(&self.params).unwrap_or_default()
)
}
}
@ -884,7 +889,7 @@ pub fn de_wit_capability(wit: wit::Capability) -> (Capability, Vec<u8>) {
publisher_node: wit.issuer.process.publisher_node,
},
},
params: serde_json::from_str(&wit.params).unwrap_or_default(),
params: wit.params,
},
vec![],
)
@ -901,7 +906,7 @@ pub fn de_wit_capability_v0(wit: crate::v0::wit::Capability) -> (Capability, Vec
publisher_node: wit.issuer.process.publisher_node,
},
},
params: serde_json::from_str(&wit.params).unwrap_or_default(),
params: wit.params,
},
vec![],
)