Skip to content

sentry issues#2110

Merged
simo6529 merged 9 commits intomainfrom
110326-1
Mar 16, 2026
Merged

sentry issues#2110
simo6529 merged 9 commits intomainfrom
110326-1

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Mar 12, 2026

Summary by CodeRabbit

  • Bug Fixes

    • Graceful handling for read-only Ethereum providers to avoid breakage during provider setup
    • Improved Sentry filtering to reduce noise from injected-wallet collisions and Twitter-related reference errors
  • New Features

    • Enhanced event-filtering heuristics and exported checks for app-uri, wallet-collision, and Twitter contexts
  • Tests

    • Added comprehensive tests for Ethereum provider/proxy scenarios and extensive tests for the new error-filtering logic

Signed-off-by: Simo <simo@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2dc43cb9-fafa-470c-857a-ce7c296274fd

📥 Commits

Reviewing files that changed from the base of the PR and between 539fed5 and e81b4b4.

📒 Files selected for processing (1)
  • components/providers/WagmiSetup.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • components/providers/WagmiSetup.tsx

📝 Walkthrough

Walkthrough

Adds guards to avoid installing a safe Ethereum proxy when window.ethereum is not assignable, introduces two new Sentry event filters (shouldFilterTwitterConfigReferenceError, shouldFilterInjectedWalletCollision) with supporting helpers/types, integrates those filters into instrumentation, and adds comprehensive tests for both areas.

Changes

Cohort / File(s) Summary
Ethereum Proxy & Tests
components/providers/WagmiSetup.tsx, __tests__/components/providers/WagmiSetup.test.tsx
Adds canAssignProperty and a pre-check to skip proxy installation when window.ethereum is non-assignable/read-only; adjusts proxy assignment for non-configurable descriptors; adds extensive tests covering getter-only, non-configurable, inherited, writable, accessor-with-setter scenarios, logging, and state restoration across mounts.
Sentry Filtering Library & Tests
utils/sentry-client-filters.ts, __tests__/utils/sentry-client-filters.test.ts
Expands Sentry event typings and exports; adds helpers for app-uri/frame detection, breadcrumb/context accessors, and wallet-collision pattern matching; implements shouldFilterTwitterConfigReferenceError and shouldFilterInjectedWalletCollision; exposes __testing helpers; adds comprehensive unit tests for frames, breadcrumbs, tags, and filename-exception behaviors.
Instrumentation Integration
instrumentation-client.ts
Imports and invokes the two new Sentry filters in shouldFilterEvent via early-return checks; minor formatting tweaks in beforeSend condition.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~28 minutes

Possibly related PRs

  • safe wallet connect #1656 — Modifies components/providers/WagmiSetup.tsx and proxy-install logic (directly related to the proxy guard changes).
  • Sentry 2 #1657 — Extends utils/sentry-client-filters and its tests (overlaps with the new Sentry filters and helpers).
  • Sentry Client config #1628 — Updates instrumentation-client.ts to add event-filtering predicates (integration-level relation).

Suggested reviewers

  • prxt6529

Poem

🐰 I nudged the global ethereum vine,

Left read-only leaves where they align.
Through Sentry fields I sniffed and hopped,
Quieted collisions that once popped.
Tests in paw — a tidy sign. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 4.35% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'sentry issues' is vague and does not clearly summarize the specific changes made in the pull request. Use a more descriptive title that specifies the actual changes, such as 'Add Sentry filters for Twitter config and wallet collision errors' or 'Implement Sentry event filtering for injected wallet and Twitter browser errors'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 110326-1
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@components/providers/WagmiSetup.tsx`:
- Around line 59-67: The current guard uses
canAssignProperty(ethereumDescriptor) and returns early, which skips proxy
installation for descriptors that are writable only via defineProperty; change
the logic so you only skip when the descriptor is non-configurable, and for
configurable descriptors proceed to install the safe proxy by using
Object.defineProperty to replace window.ethereum with the proxy instead of
direct assignment; update the branches around
ethereumDescriptor/canAssignProperty checks in WagmiSetup (references:
ethereumDescriptor, canAssignProperty, logErrorSecurely,
w.__6529_safeEthereumProxyInstalled) and ensure the replacement uses
Object.defineProperty where the code currently assigns at the proxy installation
site so tests exercise non-configurable vs configurable cases appropriately.

In `@utils/sentry-client-filters.ts`:
- Around line 89-97: The current functions isAppUriFrame and
isInjectedAppUriFrame use filename ?? abs_path which misses cases where filename
is a non-app path but abs_path contains the app:// URI; update both to check
both fields explicitly (e.g., examine filename and abs_path separately) and
return true if either value is a string and matches the condition
(startsWith("app:///") for isAppUriFrame, includes(injectedAppUriPath) for
isInjectedAppUriFrame) so frames are classified correctly even when one field is
non-app.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8db5b659-c573-4b6b-b6e0-e7b1d260c97e

📥 Commits

Reviewing files that changed from the base of the PR and between 311ec28 and 4c7747b.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (5)
  • __tests__/components/providers/WagmiSetup.test.tsx
  • __tests__/utils/sentry-client-filters.test.ts
  • components/providers/WagmiSetup.tsx
  • instrumentation-client.ts
  • utils/sentry-client-filters.ts

Comment thread components/providers/WagmiSetup.tsx Outdated
Comment thread utils/sentry-client-filters.ts
Signed-off-by: Simo <simo@6529.io>
Signed-off-by: Simo <simo@6529.io>
Signed-off-by: Simo <simo@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@utils/sentry-client-filters.ts`:
- Around line 199-204: The current return path treats an empty frames array as
present and then calls hasOnlyAppUriFrames([]) which returns false, letting
noise through; update the logic in the block that uses getHintExceptionStack,
injectedAppUriPath, and frames so that empty arrays are treated the same as
missing frames (i.e., consider frames === undefined OR frames.length === 0 as
the "no frames" case) and return true for that case or proceed to
hasOnlyAppUriFrames(frames) only when frames is a non-empty array.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cdcff760-fa78-4b2a-84a5-e0824e84770e

📥 Commits

Reviewing files that changed from the base of the PR and between 4c7747b and 7d4976c.

📒 Files selected for processing (4)
  • __tests__/components/providers/WagmiSetup.test.tsx
  • __tests__/utils/sentry-client-filters.test.ts
  • components/providers/WagmiSetup.tsx
  • utils/sentry-client-filters.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • components/providers/WagmiSetup.tsx
  • tests/components/providers/WagmiSetup.test.tsx

Comment thread utils/sentry-client-filters.ts Outdated
Signed-off-by: Simo <simo@6529.io>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
utils/sentry-client-filters.ts (1)

211-227: Consider potential false positives from stack trace matching.

The candidates array includes getHintExceptionStack(hint) which returns the entire stack trace string. The matchesWalletCollisionPattern function then checks if any pattern is contained anywhere in this string. While the patterns are specific (e.g., "cannot set property ethereum of #"), stack traces include file paths and could theoretically match if a file were named something containing "ethereum" or "tronlinkparams".

This is likely acceptable given the specificity of the patterns and the additional hasInjectedAppUriSignature guard, but worth noting.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@utils/sentry-client-filters.ts` around lines 211 - 227, The current
hasWalletCollisionSignature builds candidates including the entire stack string
from getHintExceptionStack(hint), which can yield false positives when file
paths contain pattern substrings; change the candidates assembly to split the
stack into individual lines and only include stack lines that are likely
error/message lines (e.g., exclude lines that look like file paths or stack
frames — lines starting with "at " or matching common filepath patterns) before
calling matchesWalletCollisionPattern; update hasWalletCollisionSignature to
flatten the resulting array and run the same typeof string check and
matchesWalletCollisionPattern against those filtered lines (references:
hasWalletCollisionSignature, getHintExceptionStack,
matchesWalletCollisionPattern, getBreadcrumbMessages).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@utils/sentry-client-filters.ts`:
- Around line 211-227: The current hasWalletCollisionSignature builds candidates
including the entire stack string from getHintExceptionStack(hint), which can
yield false positives when file paths contain pattern substrings; change the
candidates assembly to split the stack into individual lines and only include
stack lines that are likely error/message lines (e.g., exclude lines that look
like file paths or stack frames — lines starting with "at " or matching common
filepath patterns) before calling matchesWalletCollisionPattern; update
hasWalletCollisionSignature to flatten the resulting array and run the same
typeof string check and matchesWalletCollisionPattern against those filtered
lines (references: hasWalletCollisionSignature, getHintExceptionStack,
matchesWalletCollisionPattern, getBreadcrumbMessages).

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2caf02e0-f34e-40f6-ae57-85ed6d9c7cae

📥 Commits

Reviewing files that changed from the base of the PR and between 7d4976c and 539fed5.

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

@sonarqubecloud
Copy link
Copy Markdown

@simo6529 simo6529 merged commit a10a937 into main Mar 16, 2026
7 checks passed
@simo6529 simo6529 deleted the 110326-1 branch March 16, 2026 07:56
@coderabbitai coderabbitai Bot mentioned this pull request Mar 16, 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.

2 participants