From 2584cdc706f6bb55cb0a7911fdc176453debcb24 Mon Sep 17 00:00:00 2001 From: betegon Date: Wed, 7 Oct 2026 20:25:47 +0200 Subject: [PATCH] test(conventions): Preserve MCP normalization semantics --- relay-event-normalization/src/eap/mod.rs | 60 ++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/relay-event-normalization/src/eap/mod.rs b/relay-event-normalization/src/eap/mod.rs index 2b9427892de..c823c933356 100644 --- a/relay-event-normalization/src/eap/mod.rs +++ b/relay-event-normalization/src/eap/mod.rs @@ -1623,6 +1623,66 @@ mod tests { ); } + #[test] + fn test_normalize_mcp_attributes_without_network_attributes() { + let mut attributes = Attributes::new(); + attributes.insert("mcp.transport", "CustomHTTPTransport"); + attributes.insert("mcp.resource.protocol", "file"); + let mut attributes = Annotated::new(attributes); + + normalize_attribute_names(&mut attributes); + + assert_annotated_snapshot!(attributes, @r#" + { + "mcp.resource.protocol": { + "type": "string", + "value": "file" + }, + "mcp.transport": { + "type": "string", + "value": "CustomHTTPTransport" + } + } + "#); + } + + #[test] + fn test_normalize_mcp_attributes_with_network_attributes() { + let mut attributes = Attributes::new(); + attributes.insert("mcp.transport", "CustomHTTPTransport"); + attributes.insert("mcp.resource.protocol", "file"); + attributes.insert("network.transport", "quic"); + attributes.insert("net.protocol.name", "http"); + let mut attributes = Annotated::new(attributes); + + normalize_attribute_names(&mut attributes); + + assert_annotated_snapshot!(attributes, @r#" + { + "mcp.resource.protocol": { + "type": "string", + "value": "file" + }, + "mcp.transport": { + "type": "string", + "value": "CustomHTTPTransport" + }, + "net.protocol.name": { + "type": "string", + "value": "http" + }, + "network.protocol.name": { + "type": "string", + "value": "http" + }, + "network.transport": { + "type": "string", + "value": "quic" + } + } + "#); + } + #[test] fn test_normalize_attributes() { fn replace_key(fragment: &str) -> String {