Skip to content

fix(notifications): capture notification-click listener init failures - #2480

Merged
kushagrasarathe merged 1 commit into
mainfrom
fix/native-push-click-listener-sentry
Jul 24, 2026
Merged

fix(notifications): capture notification-click listener init failures#2480
kushagrasarathe merged 1 commit into
mainfrom
fix/native-push-click-listener-sentry

Conversation

@innolope-dev

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

Copy link
Copy Markdown
Collaborator

Small follow-up to #2473, which made native OneSignal failures visible in Sentry.

#2473 and #2470 were in flight at the same time and merged a minute apart. #2473 covered the two swallowing catches that existed in useNativePlugins.ts at the time; #2470 then added a new block to the same file — the notification-click listener — whose catch is console.warn only. So one native failure path is silent again.

It matters because launch URLs are suppressed in both the web and native SDKs (suppressLaunchURLs / OneSignal_suppress_launch_urls), which makes this listener the only thing that routes a push tap. If getOneSignalAdapter() or the listener registration throws, every notification tap silently does nothing — and today there'd be no Sentry event to explain why.

Same shape as the capture in the neighbouring app-listener catch: once per session via a module-level flag, warning level, tagged feature:onesignal and source:native_click_listener.

Verification

  • tsc --noEmit passes, eslint clean, prettier reports unchanged
  • Native-only path, so it needs an OTA bundle or binary before it can produce events

Summary by CodeRabbit

  • Bug Fixes
    • Improved error tracking when notification click handling fails to initialize.
    • Prevented duplicate reports for the same initialization failure.

The click-listener block added in #2470 lands in a console.warn-only
catch, so the native failure is invisible in Sentry — the same gap the
neighbouring app-listener catch already covers. Launch URLs are
suppressed in both SDKs, which makes this listener the only thing that
routes a push tap: if it never registers, taps silently do nothing.

Same shape as the existing capture — once per session, warning level,
tagged feature:onesignal.
@innolope-dev innolope-dev self-assigned this Jul 22, 2026
@vercel

vercel Bot commented Jul 22, 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 22, 2026 7:41pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a583069d-2611-4bd8-b4ca-2182dbc62c9a

📥 Commits

Reviewing files that changed from the base of the PR and between 5fd5969 and 0fe67d7.

📒 Files selected for processing (1)
  • src/hooks/useNativePlugins.ts

📝 Walkthrough

Walkthrough

The native plugin hook now tracks notification click listener initialization failures separately and reports the first failure through captureMessage with warning metadata while suppressing duplicate reports.

Changes

Native plugin error reporting

Layer / File(s) Summary
One-time click listener failure capture
src/hooks/useNativePlugins.ts
Adds a module-scoped failure flag and reports the first notification click listener initialization error with warning-level feature/source metadata.

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

Possibly related PRs

Suggested reviewers: kushagrasarathe

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: capturing notification-click listener initialization failures.
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.
✨ 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/native-push-click-listener-sentry

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install failed: dependency version conflict. Check your lock file or package.json.


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

@github-actions

Copy link
Copy Markdown
Contributor

Code-analysis diff

Painscore total: 6247.08 → 6247.49 (+0.41)
Findings: 0 net (+8 new, -8 resolved)

🆕 New findings (8)

  • medium high-mdd — src/hooks/useNativePlugins.ts:20 — useNativePlugins: MDD 32.1 (uses across many lines from declarations)
  • medium high-mdd — src/hooks/useNativePlugins.ts:23 — : MDD 30.8 (uses across many lines from declarations)
  • medium high-dlt — src/hooks/useNativePlugins.ts:20 — useNativePlugins: DLT 30 (calls 30 distinct functions — high context load)
  • medium complexity — src/hooks/useNativePlugins.ts — CC 28, MI 60.73, SLOC 143
  • medium high-mdd — src/hooks/useNativePlugins.ts:37 — init: MDD 25.4 (uses across many lines from declarations)
  • low high-dlt — src/hooks/useNativePlugins.ts:23 — : DLT 28 (calls 28 distinct functions — high context load)
  • low high-dlt — src/hooks/useNativePlugins.ts:37 — init: DLT 23 (calls 23 distinct functions — high context load)
  • low missing-return-type — src/hooks/useNativePlugins.ts:20 — useNativePlugins: exported fn missing return type annotation

✅ Resolved (8)

  • src/hooks/useNativePlugins.ts:19 — useNativePlugins: DLT 30 (calls 30 distinct functions — high context load)
  • src/hooks/useNativePlugins.ts:19 — useNativePlugins: MDD 29.3 (uses across many lines from declarations)
  • src/hooks/useNativePlugins.ts:22 — : MDD 27.8 (uses across many lines from declarations)
  • src/hooks/useNativePlugins.ts — CC 26, MI 61.91, SLOC 132
  • src/hooks/useNativePlugins.ts:36 — init: MDD 21.0 (uses across many lines from declarations)
  • src/hooks/useNativePlugins.ts:22 — : DLT 28 (calls 28 distinct functions — high context load)
  • src/hooks/useNativePlugins.ts:36 — init: DLT 23 (calls 23 distinct functions — high context load)
  • src/hooks/useNativePlugins.ts:19 — useNativePlugins: exported fn missing return type annotation

@github-actions

Copy link
Copy Markdown
Contributor

🧪 UI test report — ✅ all green

Suites

  • unit: 2062 ran, 0 failed, 0 skipped, 32.7s

📊 Coverage (unit)

metric %
statements 60.1%
branches 43.9%
functions 49.0%
lines 60.5%
⏱ 10 slowest test cases
time test
3.4s src/components/Card/share-asset/__tests__/shareAssetLayout.test.ts › never places two stickers in heavy overlap (broad seed sweep)
1.0s src/utils/__tests__/demo-api.test.ts › isDemoMode() is false when not running under Capacitor
0.5s 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.test.ts › should include Content-Type in validateInviteCode
0.3s src/app/actions/__tests__/api-headers-extended.test.ts › should not include apiKey in validateInviteCode body
0.2s 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__/url.utils.test.ts › uses the public BASE_URL in Capacitor, not the localhost WebView origin
0.1s src/components/Global/SupportDrawer/__tests__/SupportDrawer.test.tsx › shows the mailto fallback + retry when the proxy reports CRISP_FAILED
0.1s src/components/Global/GeneralRecipientInput/__tests__/GeneralRecipientInput.test.tsx › should handle valid 9-digit US account
📍 Inline annotations are in the **Unit test report** check above. Coverage artifact: `coverage-unit`. Generated by `.github/workflows/tests.yml`.

@kushagrasarathe kushagrasarathe 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.

Reviewed — SAFE. Approving.

Observability-only: captures failures in the notification-click listener to Sentry with a dedup guard. No behavior change to the click handling, no new data surface.

No blocking issues.

@kushagrasarathe
kushagrasarathe merged commit 4996661 into main Jul 24, 2026
23 of 25 checks passed
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.

2 participants