Skip native frames in the third-party exception filter - #79
Closed
posthog[bot] wants to merge 1 commit into
Closed
Conversation
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
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Array.reduce, filename<anonymous>,in_app: false) matches no host and no vendor path, so it counts as unknown and keeps the whole exception.Loading chunk 7130 failed after 3 retrieslanded 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.Changes
<anonymous>,[native code], and non-in_appframes with no source).Tests
tests/analytics-third-party-filter.test.jsfor the chunk 7130 stack: five Klaviyo frames with an interleaved nativeArray.reduceframe, asserted dropped.node --test tests/analytics-third-party-filter.test.js— 14 pass.scripts/generate-seo.test.mjs(fails on a clean checkout ofmain, untouched here).Created with PostHog Desktop from this inbox report.