Skip to content

Skip native frames in the third-party exception filter - #79

Closed
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixanalytics-ignore-native-frames-in-cd12af
Closed

Skip native frames in the third-party exception filter#79
posthog[bot] wants to merge 1 commit into
mainfrom
posthog-self-driving/fixanalytics-ignore-native-frames-in-cd12af

Conversation

@posthog

@posthog posthog Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Problem

  • The third-party exception filter shipped this morning still lets vendor chunk-load errors through, so the team keeps triaging the same noise.
  • The filter drops an exception only when every frame is identifiable third-party code. One native browser frame (Array.reduce, filename <anonymous>, in_app: false) matches no host and no vendor path, so it counts as unknown and keeps the whole exception.
  • A new Loading chunk 7130 failed after 3 retries landed with five of six frames naming the Klaviyo onsite runtime and one native frame. The filter was live for ~4.5 hours before this event and still let it through.
  • Cost is triage time, not user impact — one occurrence, one user, one session. This is the fifth exception of the same third-party class in four days (chunk 532, ResizeObserver, ProgressEvent, a max-call-stack case).

Changes

  • Classify each frame as native, third-party, or first-party instead of only third-party vs unknown.
  • Skip native and anonymous frames (<anonymous>, [native code], and non-in_app frames with no source).
  • Drop the exception when at least one remaining frame is third-party and no frame is first-party.
  • Unknown and first-party frames still keep the exception, so real first-party failures stay visible. Per-entry evaluation is unchanged, so a cause chain that touches our code is retained.
Stack Before After
All vendor frames drop drop
Vendor frames + one native frame keep (bug) drop
Vendor frames + one first-party frame keep keep
Unknown or missing origin keep keep

Tests

  • Added a case to tests/analytics-third-party-filter.test.js for the chunk 7130 stack: five Klaviyo frames with an interleaved native Array.reduce frame, asserted dropped.
  • node --test tests/analytics-third-party-filter.test.js — 14 pass.
  • One unrelated pre-existing failure remains in scripts/generate-seo.test.mjs (fails on a clean checkout of main, untouched here).

Created with PostHog Desktop from this inbox report.

The before_send filter dropped an exception only when every frame was
identifiable third-party code. A single native or anonymous frame in an
otherwise vendor-only stack (for example Array.reduce with filename
<anonymous> and in_app false) counted as unknown and kept the exception.

Classify each frame as native, third-party, or first-party. Skip native
and anonymous frames. Drop the exception when at least one remaining frame
is third-party and none is first-party. Unknown frames still keep the
exception, so first-party failures stay visible.

Generated-By: PostHog Desktop
Task-Id: 7f3ad9be-e1c9-4597-ae47-1f6ad8acd0bb
@Jingxi-Polymaker

Copy link
Copy Markdown
Collaborator

Superseded by #80, now merged. Both fixes suppress the reported Klaviyo stack with native Array.reduce. #80 requires explicit in_app: false and preserves conflicting source information, retaining unknown-origin and first-party exceptions that this implementation can suppress. It also adds regression coverage for native-only stacks, mixed frames, and exception causes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant