forked from 1b-agent/opencadstudio-upstream
feat(plugin): harden V4 host integration
Preserve legacy wire indices and route concurrent V4 responses and background requests by correlation and stable tab ID.
This commit is contained in:
commit
f247d15f6e
110 files changed
+32159
-1254
No files matched your search
@@ -143,6 +143,25 @@ mod tests {
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn v4_additions_preserve_legacy_discriminants() {
|
||||
fn discriminant<T: serde::Serialize>(value: &T) -> u32 {
|
||||
let bytes = bincode::serialize(value).unwrap();
|
||||
u32::from_le_bytes(bytes[..4].try_into().unwrap())
|
||||
}
|
||||
|
||||
assert_eq!(discriminant(&HostRequest::Shutdown), 6);
|
||||
assert_eq!(discriminant(&HostResponse::Error(String::new())), 5);
|
||||
assert_eq!(
|
||||
discriminant(&crate::ipc::protocol::PluginRequest::BumpGeometry),
|
||||
6
|
||||
);
|
||||
assert_eq!(
|
||||
discriminant(&crate::ipc::protocol::PluginResponse::Record(None)),
|
||||
3
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn transport_rejects_oversized_message() {
|
||||
let (mut a, _b) = connect_pair();
|
||||
|
||||
Reference in new issue
Block a user