:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(cymbal): preserve exception relationship ids (#100394)
Manoel Aranda Netoe0363afc275e
diff --git a/rust/cymbal/src/core/types/mod.rs b/rust/cymbal/src/core/types/mod.rsindex 00c6e05831e6..db4d6f8a8533 100644--- a/rust/cymbal/src/core/types/mod.rs+++ b/rust/cymbal/src/core/types/mod.rs@@ -24,4 +24,8 @@ pub struct Mechanism {pub source: Option<String>,#[serde(skip_serializing_if = "Option::is_none")]pub synthetic: Option<bool>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub exception_id: Option<u64>,+ #[serde(skip_serializing_if = "Option::is_none")]+ pub parent_id: Option<u64>,}diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rsindex 3e5d2750f21e..ee093963385d 100644--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/resolver/retry.rs@@ -162,7 +162,7 @@ pub(super) async fn resolve_work_item(event_slot: work_item.event_slot,exception_slot: work_item.exception_slot,target: work_item.target,- exception,+ exception: *exception,release_id,});}@@ -282,7 +282,7 @@ fn single_outcome(#[derive(Debug)]enum ItemDecision {Done {- exception: Exception,+ exception: Box<Exception>,release_id: Option<Uuid>,},Overloaded(String),@@ -305,7 +305,7 @@ fn classify_outcome(match result {resolve_outcome::Result::Done(done) => {- let exception = serde_json::from_slice::<Exception>(&done.resolved_exception_json)+ let exception = serde_json::from_slice::<Box<Exception>>(&done.resolved_exception_json).map_err(|err| {terminal_item_error(work_item.token,diff --git a/rust/cymbal/src/modes/processing/types/exception_event.rs b/rust/cymbal/src/modes/processing/types/exception_event.rsindex a2a9abd6af1c..85207105aaa9 100644--- a/rust/cymbal/src/modes/processing/types/exception_event.rs+++ b/rust/cymbal/src/modes/processing/types/exception_event.rs@@ -742,6 +742,54 @@ mod tests {}}+ #[test]+ fn exception_relationship_ids_survive_processing() {+ for mechanisms in [+ serde_json::json!([+ {"type": "generic", "handled": true, "exception_id": 0},+ {"type": "chained", "source": "member", "exception_id": 1, "parent_id": 0},+ {"type": "chained", "source": "cause", "exception_id": 2, "parent_id": 1},+ {"type": "chained", "source": "member", "exception_id": 3, "parent_id": 0}+ ]),+ serde_json::json!([{"type": "generic", "handled": true}]),+ ] {+ let exceptions: Vec<Value> = mechanisms.as_array().unwrap().iter().map(|mechanism| {+ serde_json::json!({"type": "Error", "value": "example failure", "mechanism": mechanism})+ }).collect();+ let parsed = ExceptionEvent::<Parsed>::try_from(AnyEvent {+ uuid: Uuid::now_v7(),+ event: "$exception".to_string(),+ team_id: 42,+ timestamp: "2026-01-01T00:00:00Z".to_string(),+ properties: serde_json::json!({"$exception_list": exceptions}),+ others: HashMap::new(),+ })+ .unwrap();+ let issue = Issue {+ id: Uuid::now_v7(),+ team_id: 42,+ status: crate::issue_resolution::IssueStatus::Active,+ severity: None,+ name: None,+ description: None,+ created_at: chrono::Utc::now(),+ };+ let processed = parsed+ .into_resolved()+ .into_fingerprinted(SelectedFingerprint::manual("example-group".to_string()))+ .into_linked(issue)+ .into_rate_checked()+ .into_finalized()+ .into_clickhouse_properties();+ let output = processed["$exception_list"].as_array().unwrap();+ assert_eq!(output.len(), exceptions.len());+ for (index, exception) in output.iter().enumerate() {+ assert_eq!(exception["mechanism"], mechanisms[index]);+ assert!(Uuid::parse_str(exception["id"].as_str().unwrap()).is_ok());+ }+ }+ }+#[test]fn selected_fingerprint_constructors_keep_origin_coherent() {let manual = SelectedFingerprint::manual("manual-value".to_string());diff --git a/rust/cymbal/tests/event.rs b/rust/cymbal/tests/event.rsindex caac229acb3b..f97921a26579 100644--- a/rust/cymbal/tests/event.rs+++ b/rust/cymbal/tests/event.rs@@ -664,6 +664,8 @@ async fn extracts_metadata_from_exceptions(db: PgPool) {mechanism_type: None,source: None,synthetic: None,+ exception_id: None,+ parent_id: None,});let input = make_event_with_options(vec![exception], None, Some(true));