Skip to content

: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.

fix(cymbal): include the column in node frame ids (#85524)

Aleksander Błaszkiewicz79977a5750b5
diff --git a/rust/cymbal/src/core/types/langs/node.rs b/rust/cymbal/src/core/types/langs/node.rs
index bb3b2a4a866f..5cac3bf98408 100644
--- a/rust/cymbal/src/core/types/langs/node.rs
+++ b/rust/cymbal/src/core/types/langs/node.rs
@@ -123,6 +123,10 @@ impl RawNodeFrame {
hasher.update(self.filename.as_bytes());
hasher.update(self.function.as_bytes());
hasher.update(self.lineno.unwrap_or_default().to_be_bytes());
+ // In a minified bundle every frame shares the file, the line (1), an anonymized
+ // function name, and the context line — the column is the only discriminator, so
+ // leaving it out of the id collapses distinct frames into one cached resolution.
+ hasher.update(self.colno.unwrap_or_default().to_be_bytes());
self.module
.as_ref()
.inspect(|m| hasher.update(m.as_bytes()));
@@ -323,6 +327,28 @@ fn is_dependency_source(source: &str) -> bool {
mod test {
use super::RawNodeFrame;
+ #[test]
+ fn frame_id_distinguishes_columns_on_the_same_line() {
+ // Minified bundles put every frame on line 1 of the same file with an anonymized
+ // function name and an identical context line, so the column is the only field
+ // separating distinct frames. An id that ignores it collapses them into one
+ // cached resolution.
+ let frame = |colno: u32| -> RawNodeFrame {
+ serde_json::from_value(serde_json::json!({
+ "filename": "dist/index.js",
+ "function": "?",
+ "lineno": 1,
+ "colno": colno,
+ "module": "index",
+ "context_line": "!function(){try{var e=global}catch(e){}}();(()=>{\"use strict\"})();",
+ }))
+ .unwrap()
+ };
+
+ assert_ne!(frame(1345).frame_id(), frame(1453).frame_id());
+ assert_eq!(frame(1345).frame_id(), frame(1345).frame_id());
+ }
+
#[test]
fn test_in_app_normalization() {
let cases = [