From 60f4574d172b5316fe86dab832d4104dccef544d Mon Sep 17 00:00:00 2001 From: Hugh Kaznowski Date: Sat, 5 Sep 2026 22:43:11 +0100 Subject: [PATCH] Fix ticket 041 merge conflict: update declared_value_kind for ticket 037's param shape The 041 branch was built against the pre-037 ParamRole/inline-params shape; rebase the string-kind lookup and test helper onto the unified ParamDeclaration/label_params/value_param model from ticket 037. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01XFUNZwCvz3kcod3352ZR2o --- src/engine.rs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/src/engine.rs b/src/engine.rs index 206eef2..ad6a124 100644 --- a/src/engine.rs +++ b/src/engine.rs @@ -1322,11 +1322,16 @@ fn declared_value_kind( metric_name: &str, ) -> Option { match index.get(&IndexKey::MetricDeclaration { name: metric_name.to_string() }) { - Some(DataValue::MetricDeclaration { params, .. }) => Some( - params - .iter() - .find(|param| param.role == ParamRole::Value) - .map(|param| param.kind) + Some(DataValue::MetricDeclaration { value_param, .. }) => Some( + value_param + .as_ref() + .and_then(|name| { + index.get(&IndexKey::ParamDeclaration { name: name.clone() }) + }) + .map(|value| match value { + DataValue::ParamDeclaration(param) => param.kind, + _ => MetricPrimitiveKind::Number, + }) .unwrap_or(MetricPrimitiveKind::Number), ), _ => None, @@ -2057,12 +2062,20 @@ mod tests { /// Declares a metric whose captured `status` param is `String`-kind and holds the `Value` role, /// so every bucket entry for it is a `MetricPrimitive::String` rather than the default occurrence marker. fn declare_string_valued_metric(index: &mut BTreeMap) { + declare_test_param( + index, + "status", + r"request status=(?P\S+)", + "status", + MetricPrimitiveKind::String, + ); declare_metric( index, - metric_request_with_roles( + metric_request_with_value( "statuses", r"request status=(?P\S+)", - vec![("status", "status", MetricPrimitiveKind::String, ParamRole::Value)], + vec![], + Some("status"), ), ) .unwrap();