Skip to content

fix(sentry): match ignore patterns per-field in shouldIgnoreError#2450

Open
innolope-dev wants to merge 3 commits into
mainfrom
fix/suppress-ios-iframe-plugin-noise
Open

fix(sentry): match ignore patterns per-field in shouldIgnoreError#2450
innolope-dev wants to merge 3 commits into
mainfrom
fix/suppress-ios-iframe-plugin-noise

Conversation

@innolope-dev

@innolope-dev innolope-dev commented Jul 18, 2026

Copy link
Copy Markdown
Collaborator

Problem

shouldIgnoreError in sentry.utils.ts matched ignore patterns against one concatenated blob of independent event fields (message + exception value + exception type + culprit). A pattern could therefore match across a field boundary — e.g. a message ending in ... User plus an exception value starting with rejected ... would hit the 'User rejected' pattern and silently suppress an unrelated, legitimate error. The ignore list also had zero test coverage.

Fix

  • Match each field independently: every candidate string is tested on its own (case-insensitive contains), so a pattern must occur entirely within a single field to suppress an event.
  • No changes to the pattern list itself.

Note on PEANUT-UI-QV3 ("StatusBar" plugin is not implemented on ios), which this PR originally filtered: per the rationale accepted in #2448, the /crisp-proxy iframe source was already fixed in 972f354 and the residual 2,211 events (6 users, last seen 6 days ago) come from stale binaries. A message-regex filter would permanently mask a top-frame "plugin not implemented" on a fresh binary — a genuinely broken native build we'd want paged on. So no new filter is added; QV3 is resolved in the Sentry dashboard instead, which is reversible (it reopens flagged as regressed if it recurs).

Impact

  • Hardened suppression correctness: cross-field false positives can no longer swallow real errors.
  • Existing suppression behavior is otherwise unchanged — every current pattern still matches within its field.
  • Zero user-facing change.

Testing

  • New unit suite src/utils/__tests__/sentry-ignore.test.ts for the previously untested shouldIgnoreError: per-field matching in message and exception values, case-insensitivity, the cross-boundary regression case (a pattern split across two fields must NOT match), unrelated errors still reported, and extension-stack-frame filtering intact.
  • pnpm jest src/utils/__tests__/sentry-ignore.test.ts src/utils/__tests__/sentry.utils.test.ts — 27/27 pass.
  • pnpm typecheck — clean.
  • pnpm prettier --check on touched files — clean.

Capacitor plugin calls executing inside the /crisp-proxy iframe on native
throw '"<Plugin>" plugin is not implemented on ios' because the bridge is
not injected into iframes. Pure noise, not a broken binary (PEANUT-UI-QV3:
2,211 events in 14 days from 6 users). Filter the whole message family
(StatusBar, Keyboard, App, ...) in shouldIgnoreError via a regex pattern,
and add unit coverage for the ignore rules.
@innolope-dev innolope-dev self-assigned this Jul 18, 2026
@vercel

vercel Bot commented Jul 18, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
peanut-wallet Ready Ready Preview, Comment Jul 18, 2026 11:08am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Changes

Sentry noise filtering

Layer / File(s) Summary
Pattern configuration and matching
sentry.utils.ts
IGNORED_ERRORS accepts strings and regular expressions, including a regex for iframe plugin-not-implemented messages; matching now checks error fields separately.
Ignored-error behavior tests
src/utils/__tests__/sentry-ignore.test.ts
Tests cover Capacitor plugin variants, exception payloads, split-field nonmatches, unrelated errors, rejected requests, and browser-extension stack frames.

Estimated code review effort: 2 (Simple) | ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: per-field ignore matching in shouldIgnoreError for Sentry noise filtering.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/suppress-ios-iframe-plugin-noise

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6208.86 → 6208.86 (0)
Findings: 0 net (+0 new, -0 resolved)

@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2007 ran, 0 failed, 0 skipped, 34.8s

📊 Coverage (unit)

metric %
statements 59.4%
branches 43.3%
functions 48.3%
lines 59.7%
⏱ 10 slowest test cases
time test
3.8s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
1.2s src/utils/__tests__/demo-api.test.ts › isDemoMode() is false when not running under Capacitor
0.4s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › every sticker stays within canvas at any count
0.3s src/app/(mobile-ui)/withdraw/__tests__/withdraw-states.test.tsx › Bank withdrawal keeps the $1 minimum for sub-$1 amounts
0.3s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.3s src/app/actions/__tests__/api-headers.test.ts › should include Content-Type in validateInviteCode
0.3s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › keeps stickers off the username pill (final pass respects the keep-out)
0.2s src/utils/__tests__/demo-balance.test.ts › starts at the full balance on a fresh install and stamps a timestamp
0.2s src/utils/__tests__/demo-balance.test.ts › auto-refills a wallet older than the TTL on cold start
0.2s src/utils/__tests__/demo-balance.test.ts › auto-refills a stored balance that has no timestamp (legacy install)
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@sentry.utils.ts`:
- Around line 70-71: Update the matching logic around the searchText
construction and pattern check so each independent Sentry field is evaluated
separately, rather than searching a combined string that can create cross-field
matches. Apply regex patterns to each field’s original text without lowercasing,
while retaining case-insensitive handling for string patterns; add a regression
test covering a match split between event.message and an exception value.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4ce20a7a-f0df-4770-900e-d55155dd2ee4

📥 Commits

Reviewing files that changed from the base of the PR and between f9ab02d and c77c738.

📒 Files selected for processing (2)
  • sentry.utils.ts
  • src/utils/__tests__/sentry-ignore.test.ts

Comment thread sentry.utils.ts Outdated
… fields

Matching against one concatenated blob of message + exception value/type +
culprit let a pattern match across field boundaries and suppress an
unrelated event. Test each field independently; regexes now also run
against the original (non-lowercased) text with their own flags.
The /crisp-proxy iframe source of the plugin-not-implemented events was
already fixed (972f354); residual events come from stale binaries, and
a message filter would permanently mask a top-frame plugin failure on a
fresh binary — a genuinely broken build we want reported. The Sentry
issue is resolved in the dashboard instead (reopens as regressed if it
recurs).

Keep the per-field matching in shouldIgnoreError: the old concatenated
blob let a pattern match across unrelated fields and suppress legitimate
events. Tests now cover per-field matching, the cross-boundary case, and
the previously untested ignore list.
@innolope-dev innolope-dev changed the title fix(sentry): suppress Capacitor plugin-not-implemented iframe noise fix(sentry): match ignore patterns per-field in shouldIgnoreError Jul 18, 2026
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