Skip to content

Sentry Issues#1629

Merged
prxt6529 merged 18 commits intomainfrom
sentry-03-12-2
Dec 3, 2025
Merged

Sentry Issues#1629
prxt6529 merged 18 commits intomainfrom
sentry-03-12-2

Conversation

@prxt6529
Copy link
Copy Markdown
Collaborator

@prxt6529 prxt6529 commented Dec 3, 2025

Summary by CodeRabbit

  • Documentation

    • Added Sentry error-handling guidance (workflows, silencing rules, examples) and a React imports guideline preferring named imports.
  • Bug Fixes

    • Improved animation/list rendering stability via stable keys and memoization.
    • Prevented keyboard-handler errors by validating key input.
    • Enhanced Sentry filtering to suppress noisy/tunnel/network errors.
    • Improved API/network error and abort/parse reporting.
    • Fixed storm-mode submission to finalize edits and avoid placeholder parts.
  • Tests

    • Consolidated and improved mocks for notification and component tests.

✏️ Tip: You can customize this high-level summary in your review settings.

Signed-off-by: prxt6529 <prxt@6529.io>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Dec 3, 2025

Warning

Rate limit exceeded

@prxt6529 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 0 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between ed12adb and 3d83e72.

📒 Files selected for processing (3)
  • config/sentryProbes.ts (2 hunks)
  • instrumentation-client.ts (2 hunks)
  • sentry.edge.config.ts (2 hunks)

Walkthrough

Added Sentry tunnel/monitoring error suppression and moved filtering into typed probe helpers; centralized client instrumentation network/error normalization; hardened fetch + JSON error handling; stabilized per-part keys and animation container in drop components; adjusted drop finalization to avoid placeholder parts; small defensive clipboard fix; tests and docs updated.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md
Added "Sentry Error Handling" workflow (root-cause-first, fix-first, silencing fallback with client/server/edge examples) and React imports guideline to prefer direct named imports (e.g., useMemo, FC) over React.*.
Drop components & tests
components/waves/CreateDropStormParts.tsx, components/waves/CreateDropContent.tsx, __tests__/components/waves/CreateDropStormParts.test.tsx
Removed top-level React namespace import in favor of named imports; introduced stable per-part IDs (ref + map + pruning) and partKeys for list keys; wrapped AnimatePresence; adjusted part-finalization flow to avoid placeholder parts; test imports/mocks and framer-motion mock updated.
Clipboard handler
components/waves/drops/wave-drops-all/hooks/useWaveDropsClipboard.ts
Added defensive check that event.key is a string before calling toLowerCase() in the keydown handler.
Sentry probes & configs
config/sentryProbes.ts, sentry.edge.config.ts, sentry.server.config.ts
Added filterTunnelRouteErrors<T>(event, hint) to detect/suppress tunnel/monitoring route errors; tightened tagSecurityProbes typing; wired filter into beforeSend(event, hint) in edge/server configs to drop filtered events before tagging.
Client instrumentation
instrumentation-client.ts
Moved noisy patterns and helpers to top-level utilities; added shouldFilterEvent, isNetworkError, handleNetworkError, and related helpers to normalize network TypeErrors, embed URLs, set levels/tags/fingerprint, and early-filter noisy/reference errors in beforeSend.
API error handling
services/api/common-api.ts
Wrapped fetch + JSON parse in try/catch; explicit non-OK handling via handleApiError; guarded JSON parse errors; preserve AbortError semantics; provide clearer TypeError/network messages including request URL.
Notifications tests / mocks
__tests__/components/notifications/NotificationsContext.test.tsx
Centralized and expanded Jest mocks for Capacitor and Next router; added waitFor usage and runtime requires to assert listener behavior and navigation.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant App as App (Sentry SDK)
  participant ServerConfig as sentry.server/edge.config
  participant Probe as config/sentryProbes
  participant Before as instrumentation-client.beforeSend

  Note over App: Error/event emitted
  App->>ServerConfig: beforeSend(event, hint)
  ServerConfig->>Probe: filterTunnelRouteErrors(event, hint)
  alt Filtered out
    Probe-->>ServerConfig: null
    ServerConfig-->>App: null
  else Not filtered
    Probe-->>ServerConfig: filteredEvent
    ServerConfig->>Before: pass filteredEvent
    Before->>Before: shouldFilterEvent / handleNetworkError / fingerprinting
    Before-->>ServerConfig: processedEvent
    ServerConfig-->>App: processedEvent
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Review stable ID generation, pruning logic, and key assignment in CreateDropStormParts.tsx for reconciliation and concurrency edge cases.
  • Verify CreateDropContent.tsx finalization path (storm-mode) to avoid duplicate/missing parts.
  • Validate filterTunnelRouteErrors and shouldFilterEvent ordering and pattern matching to ensure no actionable events are dropped.
  • Confirm services/api/common-api.ts preserves AbortError semantics and parseJson = false behavior.

Possibly related PRs

  • 6529-Collections/6529seize-frontend#1622 — Overlaps Sentry instrumentation and beforeSend changes across instrumentation-client.ts and sentry configs.
  • 6529-Collections/6529seize-frontend#1628 — Related adjustments to instrumentation-client.ts noisy-filtering and helpers.
  • 6529-Collections/6529seize-frontend#1623 — Related Sentry probe/tagging work and config/sentryProbes.ts changes.

Suggested reviewers

  • GelatoGenesis
  • simo6529
  • ragnep

Poem

🐇 I hopped through logs and quieted the din,
I stitched up keys and let the parts begin,
I filtered noise and dressed each trace,
I nudged the drops to find their place,
A tiny hop — the code feels kin.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'Sentry Issues' is vague and generic, providing minimal context about the specific changes made beyond mentioning Sentry. Use a more descriptive title that specifies the key improvement, such as 'Refactor Sentry error handling with filtering and network error detection' or 'Add Sentry tunnel route filtering and improve error categorization'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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: 0

🧹 Nitpick comments (1)
components/waves/CreateDropStormParts.tsx (1)

31-39: Stable partKeys improve list rendering; consider intrinsic IDs

The memoized partKeys and updated key={partKeys[partIndex]} give more predictable keys for Framer Motion than ad‑hoc content keys. This assumes parts is updated immutably; otherwise partKeys can drift from parts.length. If CreateDropPart already exposes a stable identifier (e.g. id or tempId), using that directly for keys would be even more robust than index/media.length.

Please verify:

  • parts is always replaced, not mutated in place, when adding/removing parts.
  • Whether CreateDropPart has a stable id property you could use instead of index/length for keys.

Also applies to: 73-92

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ba9f239 and 9beff86.

📒 Files selected for processing (5)
  • AGENTS.md (1 hunks)
  • components/waves/CreateDropStormParts.tsx (4 hunks)
  • components/waves/drops/wave-drops-all/hooks/useWaveDropsClipboard.ts (1 hunks)
  • instrumentation-client.ts (2 hunks)
  • services/api/common-api.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • components/waves/drops/wave-drops-all/hooks/useWaveDropsClipboard.ts
  • instrumentation-client.ts
  • services/api/common-api.ts
  • components/waves/CreateDropStormParts.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • components/waves/drops/wave-drops-all/hooks/useWaveDropsClipboard.ts
  • instrumentation-client.ts
  • services/api/common-api.ts
  • components/waves/CreateDropStormParts.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{tsx,jsx}: Use FontAwesome for icons in React components
Use TailwindCSS for styling in React components
Use react-query for data fetching
Always add readonly before props in React components

Files:

  • components/waves/CreateDropStormParts.tsx
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : Catch `UrlGuardError` explicitly if returning a tailored response; otherwise let it bubble so the caller can surface the correct status code.

Applied to files:

  • services/api/common-api.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : When needing custom headers or timeouts for external requests, pass them via `@/lib/security/urlGuard` helper options rather than re-implementing your own wrapper.

Applied to files:

  • services/api/common-api.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : Never call `fetch` directly with user-controlled or scraped URLs. Use helpers from `@/lib/security/urlGuard` (`parsePublicUrl`, `assertPublicUrl`, `fetchPublicUrl`, `fetchPublicJson`) to validate URLs against host/IP allowlists and DNS checks before making network requests.

Applied to files:

  • services/api/common-api.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : Follow the project default responses (`NextResponse.json`) and reuse existing util modules instead of duplicating logic.

Applied to files:

  • services/api/common-api.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx} : Use TypeScript types for request parameters and responses; avoid `any` unless a 3rd-party payload truly has no shape guarantees.

Applied to files:

  • services/api/common-api.ts
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed

Applied to files:

  • components/waves/CreateDropStormParts.tsx
  • AGENTS.md
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Use TypeScript and React functional components with hooks

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: All changes must pass the same commands listed in the top-level AGENTS.md: `npm run test`, `npm run lint`, and `npm run type-check` (or the targeted `test:cov:changed` when appropriate).

Applied to files:

  • AGENTS.md
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Applies to {middleware,proxy}.ts : Request boundary logic using `middleware.ts` should be renamed to `proxy.ts` with exported `proxy` function (Node runtime); legacy `middleware.ts` is only for edge-only cases

Applied to files:

  • AGENTS.md
🧬 Code graph analysis (1)
components/waves/CreateDropStormParts.tsx (1)
__mocks__/react-use.js (1)
  • React (2-2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
components/waves/drops/wave-drops-all/hooks/useWaveDropsClipboard.ts (1)

1124-1150: Defensive key check in handleKeyDown is sound

The added typeof event.key === "string" guard safely prevents .toLowerCase from throwing while preserving existing behavior for normal keyboard events.

services/api/common-api.ts (1)

58-113: Improved error handling in executeApiRequest looks correct

The new try/catch keeps HTTP semantics (non‑OK via handleApiError), preserves abort behavior, adds guarded JSON parsing, and surfaces clearer network errors while respecting parseJson === false. No functional regressions evident.

Please ensure you have tests (or add them) covering:

  • parseJson: false (no JSON parsing),
  • invalid JSON bodies (new “Failed to parse response as JSON…” error),
  • aborted requests vs real network failures (TypeError mapping).
instrumentation-client.ts (1)

16-25: Sentry noise filters are well‑scoped and consistent

Centralizing noisyPatterns, referenceErrors, and filenameExceptions and using them in beforeSend to drop known noisy events (e.g. ResizeObserver, Firefox/inpage.js/extension noise) is consistent with the new AGENTS.md Sentry guidance, while preserving IndexedDB tagging behavior.

Please double‑check against Sentry docs for beforeSend in @sentry/nextjs that:

  • returning null still reliably drops events,
  • these same filters (patterns/filenames) are mirrored in sentry.server.config.ts and sentry.edge.config.ts where appropriate.

Also applies to: 52-79

AGENTS.md (1)

96-137: Sentry error‑handling playbook is clear and aligned with code

The new section establishes a fix‑first workflow, defines where silencing belongs, and matches the filtering patterns added in instrumentation-client.ts. Good central reference for future Sentry work.

Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@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: 0

🧹 Nitpick comments (2)
components/waves/CreateDropStormParts.tsx (2)

31-55: Stable key generation works but is still index-coupled; also easy Sonar clean-up

The partIdCounterRef / partIdsRef + useMemo approach gives stable keys for non-quoted parts across content edits and re-renders, and uses deterministic IDs for quoted drops, which is a solid improvement.

Two points to consider:

  1. Index-coupled behavior on insertion/removal in the middle
    Keys for non-quoted parts are effectively tied to their array index. If a part is removed or inserted anywhere except at the end, subsequent parts inherit different keys than before (e.g., removing index 0 shifts keys for all following items). That can cause React to reuse DOM/state between logically different parts. If the UI allows middle insertions/reordering, you may want a per-part stable identifier on CreateDropPart (e.g., localId) and use that as the key source instead of positional refs.

  2. Assumption about immutable parts updates
    useMemo is keyed only on the parts reference. If a parent mutates the existing array in place (same reference, different contents), partKeys will not recompute and partKeys[partIndex] may become undefined or stale. This is fine if parts is always updated immutably (new array on change), but worth double‑checking upstream.

You can also satisfy the Sonar warning and slightly simplify the control flow by turning the nested if in the else into an else if:

-    parts.forEach((part, index) => {
-      if (part.quoted_drop) {
-        const quotedKey = `quoted-${part.quoted_drop.drop_id}-${part.quoted_drop.drop_part_id}`;
-        keys.push(quotedKey);
-      } else {
-        if (index < partIdsRef.current.length) {
-          keys.push(partIdsRef.current[index]);
-        } else {
-          const newId = `part-${partIdCounterRef.current++}`;
-          partIdsRef.current[index] = newId;
-          keys.push(newId);
-        }
-      }
-    });
+    parts.forEach((part, index) => {
+      if (part.quoted_drop) {
+        const quotedKey = `quoted-${part.quoted_drop.drop_id}-${part.quoted_drop.drop_part_id}`;
+        keys.push(quotedKey);
+      } else if (index < partIdsRef.current.length) {
+        keys.push(partIdsRef.current[index]);
+      } else {
+        const newId = `part-${partIdCounterRef.current++}`;
+        partIdsRef.current[index] = newId;
+        keys.push(newId);
+      }
+    });

Please confirm that parts is always updated immutably (new array instance on any change) and that you don’t support arbitrary reordering/middle insertions for non‑quoted parts. If either of those assumptions doesn’t hold, we should revisit the keying strategy.


90-91: AnimatePresence wrapper and key usage are consistent; just ensure key array stays in sync

Wrapping the mapped motion.divs in <AnimatePresence mode="popLayout"> is appropriate, and using key={partKeys[partIndex]} cleanly applies the precomputed stable keys.

Two small follow‑ups:

  • Because partKeys is derived from parts, it should always have the same length as parts. If upstream ever mutates parts in place (same reference), partKeys[partIndex] could become undefined. This ties back to the immutability assumption noted in the key-generation block.
  • mode="popLayout" relies on the framer‑motion version supporting this prop/value; worth quickly confirming your installed version to avoid runtime warnings.

If you’d like, I can sketch an alternative where partKeys is recomputed every render (dropping useMemo) but still backed by the same refs, which would make it robust even if parts is mutated in place.

Also applies to: 94-94, 108-109

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9beff86 and 919494b.

📒 Files selected for processing (1)
  • components/waves/CreateDropStormParts.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • components/waves/CreateDropStormParts.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{tsx,jsx}: Use FontAwesome for icons in React components
Use TailwindCSS for styling in React components
Use react-query for data fetching
Always add readonly before props in React components

Files:

  • components/waves/CreateDropStormParts.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • components/waves/CreateDropStormParts.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Use TypeScript and React functional components with hooks

Applied to files:

  • components/waves/CreateDropStormParts.tsx
🪛 GitHub Check: SonarCloud Code Analysis
components/waves/CreateDropStormParts.tsx

[warning] 42-42: 'If' statement should not be the only statement in 'else' block

See more on https://sonarcloud.io/project/issues?id=6529-Collections_6529seize-frontend&issues=AZrkJsQn31AsCI1R_R87&open=AZrkJsQn31AsCI1R_R87&pullRequest=1629

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
components/waves/CreateDropStormParts.tsx (1)

7-9: Imports and Next.js usage look correct

Link from next/link, the React default import, AuthContext, and CreateDropStormPart are wired correctly and align with the Next.js/React setup. No issues here.

Also applies to: 13-13

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: 0

🧹 Nitpick comments (1)
components/waves/CreateDropStormParts.tsx (1)

34-55: Refactor nested if to else if and verify key stability for mid-list removals.

The SonarCloud warning about nested if in else can be addressed by flattening to else if. Additionally, the index-based ID reuse may cause key instability when parts are removed from the middle—subsequent parts would inherit incorrect keys, potentially causing unexpected remounts or animation glitches.

Apply this diff to address the SonarCloud hint:

     parts.forEach((part, index) => {
       if (part.quoted_drop) {
         const quotedKey = `quoted-${part.quoted_drop.drop_id}-${part.quoted_drop.drop_part_id}`;
         keys.push(quotedKey);
-      } else {
-        if (index < partIdsRef.current.length) {
-          keys.push(partIdsRef.current[index]);
-        } else {
-          const newId = `part-${partIdCounterRef.current++}`;
-          partIdsRef.current[index] = newId;
-          keys.push(newId);
-        }
+      } else if (index < partIdsRef.current.length) {
+        keys.push(partIdsRef.current[index]);
+      } else {
+        const newId = `part-${partIdCounterRef.current++}`;
+        partIdsRef.current[index] = newId;
+        keys.push(newId);
       }
     });

Please verify that parts are typically only added/removed from the end, or consider whether a WeakMap-based approach (mapping part objects to stable IDs) would better handle mid-list mutations.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 919494b and f6626bd.

📒 Files selected for processing (2)
  • AGENTS.md (2 hunks)
  • components/waves/CreateDropStormParts.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • AGENTS.md
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • components/waves/CreateDropStormParts.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{tsx,jsx}: Use FontAwesome for icons in React components
Use TailwindCSS for styling in React components
Use react-query for data fetching
Always add readonly before props in React components

Files:

  • components/waves/CreateDropStormParts.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • components/waves/CreateDropStormParts.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Use TypeScript and React functional components with hooks

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components

Applied to files:

  • components/waves/CreateDropStormParts.tsx
🧬 Code graph analysis (1)
components/waves/CreateDropStormParts.tsx (2)
components/auth/Auth.tsx (1)
  • AuthContext (83-93)
helpers/Helpers.ts (1)
  • cicToType (485-503)
🪛 GitHub Check: SonarCloud Code Analysis
components/waves/CreateDropStormParts.tsx

[warning] 42-42: 'If' statement should not be the only statement in 'else' block

See more on https://sonarcloud.io/project/issues?id=6529-Collections_6529seize-frontend&issues=AZrkJsQn31AsCI1R_R87&open=AZrkJsQn31AsCI1R_R87&pullRequest=1629

🔇 Additional comments (3)
components/waves/CreateDropStormParts.tsx (3)

7-9: LGTM!

The switch to named imports (FC, memo, useContext, useMemo, useRef) and direct hook usage aligns well with React 19.2 conventions and removes unnecessary namespace references.

Also applies to: 22-22, 28-28


90-109: LGTM!

The wrapper div with spacing classes and the switch to precomputed partKeys is a cleaner approach than the previous content-based key. The AnimatePresence configuration is preserved correctly.


117-117: LGTM!

Consistent use of the named memo import.

Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@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: 2

🧹 Nitpick comments (1)
components/waves/CreateDropContent.tsx (1)

877-879: Eliminate duplicated storm-mode logic.

The logic at lines 877-879 duplicates the same computation from createCurrentDrop (lines 612-614). This violates the DRY principle and increases maintenance burden.

Extract this logic into a helper function or use the prop directly if appropriate:

+const hasExistingParts = (drop: CreateDropConfig | null): boolean => 
+  (drop?.parts.length ?? 0) > 0;

Then reference it in both locations:

-    const isStormMode = (drop?.parts.length ?? 0) > 0;
-    const hasCurrentContent = !!(getMarkdown?.trim().length || files.length);
+    const hasParts = hasExistingParts(drop);
+    const hasContent = !!(getMarkdown?.trim().length || files.length);
     
-    if (isStormMode && hasCurrentContent) {
+    if (hasParts && hasContent) {
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f6626bd and 0fed907.

📒 Files selected for processing (2)
  • components/waves/CreateDropContent.tsx (2 hunks)
  • components/waves/CreateDropStormParts.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{tsx,jsx}: Use FontAwesome for icons in React components
Use TailwindCSS for styling in React components
Use react-query for data fetching
Always add readonly before props in React components

Files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Use TypeScript and React functional components with hooks

Applied to files:

  • components/waves/CreateDropStormParts.tsx
🧬 Code graph analysis (1)
components/waves/CreateDropStormParts.tsx (2)
components/auth/Auth.tsx (1)
  • AuthContext (83-93)
helpers/Helpers.ts (1)
  • cicToType (485-503)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
components/waves/CreateDropStormParts.tsx (1)

7-9: LGTM: Import modernization aligns with React 19.2 conventions.

The changes to use named imports (FC, memo, useContext) instead of the React namespace align with the project's modernization goals and coding guidelines. This makes the code more explicit and compatible with React 19.2 conventions.

Based on learnings, this aligns with the guidance to modernize code for React 19.2, React Compiler, and Next.js 16 conventions.

Also applies to: 13-13, 22-22, 28-28, 115-115

Comment thread components/waves/CreateDropContent.tsx Outdated
Comment thread components/waves/CreateDropStormParts.tsx Outdated
Signed-off-by: prxt6529 <prxt@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: 0

🧹 Nitpick comments (1)
components/waves/CreateDropStormParts.tsx (1)

42-66: Ref mutation moved out of render phase - good fix!

The previous review correctly identified that mutating partIdCounterRef.current inside useMemo violates React's rendering contract. Moving the mutation to useEffect is the right approach.

However, the index-based ID mapping (newMap.has(index)) may cause key instability if parts are removed from the middle of the array. For example:

  • Parts: [A, B, C] with IDs at indices {0: "part-0", 1: "part-1", 2: "part-2"}
  • Remove B: [A, C] → index 1 now maps to "part-1" but refers to part C
  • Part C's key changes from "part-2" to "part-1"

This could cause unexpected re-mounts. Consider tracking IDs by a stable part identity (e.g., content hash or a generated ID stored on the part object itself) rather than by array index.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0fed907 and 496a9ee.

📒 Files selected for processing (2)
  • components/waves/CreateDropContent.tsx (2 hunks)
  • components/waves/CreateDropStormParts.tsx (4 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{tsx,jsx}: Use FontAwesome for icons in React components
Use TailwindCSS for styling in React components
Use react-query for data fetching
Always add readonly before props in React components

Files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
🧠 Learnings (4)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed

Applied to files:

  • components/waves/CreateDropStormParts.tsx
  • components/waves/CreateDropContent.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Use TypeScript and React functional components with hooks

Applied to files:

  • components/waves/CreateDropStormParts.tsx
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components

Applied to files:

  • components/waves/CreateDropStormParts.tsx
🧬 Code graph analysis (1)
components/waves/CreateDropStormParts.tsx (2)
components/auth/Auth.tsx (1)
  • AuthContext (83-93)
helpers/Helpers.ts (1)
  • cicToType (485-503)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
components/waves/CreateDropContent.tsx (2)

612-632: LGTM! The variable shadowing issue has been resolved.

The renaming from isStormMode to hasPartsInDrop addresses the previous review concern about shadowing the component prop. The two-flag approach (hasPartsInDrop and hasCurrentContent) clearly expresses intent and the conditional logic for part construction is sound.


876-883: Verify intended UX: submit button finalizes content instead of submitting.

When the user has existing parts and new content, clicking submit will finalize the current content into a new part but won't actually submit the drop. The user must click submit again to send.

This may be intentional for storm mode workflow, but consider whether users might expect a single submit action. If this is the desired behavior, a UI indicator or toast message could help clarify that content was added to the storm rather than submitted.

components/waves/CreateDropStormParts.tsx (3)

7-17: LGTM! Import style aligns with React 19 conventions.

Direct named imports from react instead of namespace imports is the recommended approach per the project's modernization guidelines.


68-75: LGTM! Key computation is now side-effect free.

The useMemo hook correctly only reads from state (partIdsMap) without any mutations, which is safe for React's concurrent rendering model.


110-128: LGTM! Stable keys improve animation behavior.

Using computed partKeys for the motion.div key ensures stable identity across renders. The wrapper div around AnimatePresence maintains proper layout structure.

Signed-off-by: prxt6529 <prxt@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

🧹 Nitpick comments (3)
__tests__/components/notifications/NotificationsContext.test.tsx (1)

71-86: Consider grouping this test for better organization.

This test is at the same level as the describe blocks rather than nested within one. For consistency and better test organization, consider moving it inside the "NotificationsContext" describe block.

instrumentation-client.ts (1)

93-134: Network TypeError normalization is solid; consider tiny regex tweak for Sonar

The new block that:

  • Detects TypeError network failures (load failed / failed to fetch / network),
  • Derives a best-effort URL from the message, fetch breadcrumbs, or event.request.url,
  • Rewrites the message, downgrades level to "warning", and tags/fingerprints as a "network" error,

is coherent and should significantly reduce noisy network exceptions while keeping them observable.

Sonar’s warning about String.match can be resolved with a minimal change if you want a clean report:

-        const urlMatch = error.message.match(/\(([^)]+)\)/);
+        const urlMatch = /\(([^)]+)\)/.exec(error.message);

Functionally this is equivalent but satisfies the rule.

config/sentryProbes.ts (1)

19-67: Tunnel/monitoring abort filtering works; consider light refactors for types & complexity

The logic here correctly targets noisy aborted/ECONNRESET/socket‑hang‑up errors originating from monitoring/tunnel routes (via URL and stack frame checks) and returns null only in those narrow cases, which matches how it is used in the server/edge beforeSend hooks.

If you’d like to address the Sonar feedback and tighten things up:

  1. Simplify the return type to avoid any | null

Since callers already treat the result as “Sentry event or null”, the union with any doesn’t buy much and is what Sonar is complaining about. Two options:

  • Minimal change (keeps current behavior, silences the union rule):

    export function filterTunnelRouteErrors(event: any, hint?: any): any {
      // keep returning either an event object or null at runtime
    }

    (Callers still explicitly check filtered === null.)

  • Or, better, replace any with the appropriate Sentry event/hint types from the Sentry TS API so the signature reflects Event | null instead of any. Please confirm the exact type names/paths for @sentry/nextjs in your version before changing this.

  1. Reduce cognitive complexity by extracting predicates

You can make filterTunnelRouteErrors much flatter and easier to scan by pushing the nested checks into small helpers, e.g.:

function isMonitoringAbortByMessage(event: any, value: any, message: string): boolean { /* current first block */ }

function isMonitoringAbortByHint(event: any, message: string, errorType: string, hint?: any): boolean { /* current second block */ }

export function filterTunnelRouteErrors(event: any, hint?: any): any {
  const value = event.exception?.values?.[0];
  const message = value?.value || "";
  const errorType = value?.type || "";

  if (isMonitoringAbortByMessage(event, value, message)) return null;
  if (isMonitoringAbortByHint(event, message, errorType, hint)) return null;

  return event;
}

This should bring the Cognitive Complexity of the main function below Sonar’s threshold without changing behavior.

Please re-run your static analysis (SonarCloud, npm run lint, and npm run type-check) after any signature or control-flow changes here to ensure the updated types align with @sentry/nextjs’s beforeSend contract and no new issues are introduced.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 496a9ee and 0e7c424.

📒 Files selected for processing (6)
  • __tests__/components/notifications/NotificationsContext.test.tsx (2 hunks)
  • __tests__/components/waves/CreateDropStormParts.test.tsx (3 hunks)
  • config/sentryProbes.ts (1 hunks)
  • instrumentation-client.ts (3 hunks)
  • sentry.edge.config.ts (2 hunks)
  • sentry.server.config.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • config/sentryProbes.ts
  • instrumentation-client.ts
  • sentry.server.config.ts
  • sentry.edge.config.ts
  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
{.env*,*.env,**/config/**}

📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)

Configure Task Master behavior via environment variables: ANTHROPIC_API_KEY (required), MODEL, MAX_TOKENS, TEMPERATURE, DEBUG, LOG_LEVEL, DEFAULT_SUBTASKS, DEFAULT_PRIORITY, PROJECT_NAME, PROJECT_VERSION, PERPLEXITY_API_KEY, and PERPLEXITY_MODEL

Files:

  • config/sentryProbes.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • config/sentryProbes.ts
  • instrumentation-client.ts
  • sentry.server.config.ts
  • sentry.edge.config.ts
  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{tsx,jsx}: Use FontAwesome for icons in React components
Use TailwindCSS for styling in React components
Use react-query for data fetching
Always add readonly before props in React components

Files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
**/__tests__/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Tests should live in __tests__/ directory or be named ComponentName.test.tsx

Files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Applies to {middleware,proxy}.ts : Request boundary logic using `middleware.ts` should be renamed to `proxy.ts` with exported `proxy` function (Node runtime); legacy `middleware.ts` is only for edge-only cases

Applied to files:

  • config/sentryProbes.ts
  • sentry.server.config.ts
  • sentry.edge.config.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : Catch `UrlGuardError` explicitly if returning a tailored response; otherwise let it bubble so the caller can surface the correct status code.

Applied to files:

  • config/sentryProbes.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : When needing custom headers or timeouts for external requests, pass them via `@/lib/security/urlGuard` helper options rather than re-implementing your own wrapper.

Applied to files:

  • sentry.server.config.ts
  • sentry.edge.config.ts
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Fix issues with modernization aligned to React 19.2, React Compiler, and Next.js 16 conventions; do not add `// eslint-disable` comments unless explicitly instructed

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:37:36.725Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:36.725Z
Learning: Applies to __tests__/**/__tests__/**/*.{ts,tsx,js,jsx} : Organize test files in `__tests__` directory mirroring source folder structure (components, contexts, hooks, utils) to keep structure familiar

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:37:36.725Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:36.725Z
Learning: Applies to __tests__/**/__tests__/**/*.{ts,tsx,js,jsx} : Use the Arrange – Act – Assert pattern for test structure, keeping assertions focused on behaviour, not implementation details

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:37:36.725Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:36.725Z
Learning: Applies to __tests__/**/__tests__/**/*.{ts,tsx,js,jsx} : Give each test a clear, descriptive name that conveys the scenario and expected outcome

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Applies to **/__tests__/**/*.{ts,tsx,js,jsx} : Tests should live in `__tests__/` directory or be named `ComponentName.test.tsx`

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:37:36.725Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:36.725Z
Learning: Use testing-library/react and testing-library/user-event for React component tests

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Use TypeScript and React functional components with hooks

Applied to files:

  • __tests__/components/notifications/NotificationsContext.test.tsx
  • __tests__/components/waves/CreateDropStormParts.test.tsx
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components

Applied to files:

  • __tests__/components/waves/CreateDropStormParts.test.tsx
🧬 Code graph analysis (1)
sentry.server.config.ts (1)
config/sentryProbes.ts (2)
  • filterTunnelRouteErrors (19-67)
  • tagSecurityProbes (69-85)
🪛 GitHub Check: SonarCloud Code Analysis
config/sentryProbes.ts

[warning] 19-19: 'any' overrides all other types in this union type.

See more on https://sonarcloud.io/project/issues?id=6529-Collections_6529seize-frontend&issues=AZrkbx4n4gucqPsgwxEu&open=AZrkbx4n4gucqPsgwxEu&pullRequest=1629


[failure] 19-19: Refactor this function to reduce its Cognitive Complexity from 18 to the 15 allowed.

See more on https://sonarcloud.io/project/issues?id=6529-Collections_6529seize-frontend&issues=AZrkbx4n4gucqPsgwxEt&open=AZrkbx4n4gucqPsgwxEt&pullRequest=1629

instrumentation-client.ts

[warning] 101-101: Use the "RegExp.exec()" method instead.

See more on https://sonarcloud.io/project/issues?id=6529-Collections_6529seize-frontend&issues=AZrkbx-J4gucqPsgwxEw&open=AZrkbx-J4gucqPsgwxEw&pullRequest=1629

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (8)
__tests__/components/waves/CreateDropStormParts.test.tsx (1)

11-16: LGTM!

The framer-motion mock correctly simplifies AnimatePresence and motion.div for testing purposes, rendering children without animation complexity.

__tests__/components/notifications/NotificationsContext.test.tsx (3)

1-6: LGTM! Imports are appropriate for test requirements.

The React import is necessary for the type annotations (React.FC and React.ReactNode) used in the wrapper component, and all testing utilities are correctly imported.


27-45: LGTM! Excellent refactoring to centralized mocks.

The centralized jest.mock() declarations for Capacitor plugins improve test maintainability and make the mock setup clear and reusable. All methods are properly mocked with appropriate resolved values.


88-133: LGTM! Test structure and async handling are correct.

The test properly uses waitFor for async assertions, extracts and invokes the notification callback, and verifies the navigation behavior. The hardcoded 100ms timeout on line 124 is followed by waitFor, which mitigates potential flakiness concerns.

instrumentation-client.ts (2)

16-25: Centralized noise/reference/filename filters look good

Moving these magic strings into top-level noisyPatterns, referenceErrors, and filenameExceptions improves readability and reuse; the usage below is straightforward and correct.


52-79: Message / stack-frame based suppression is safe and targeted

Using errorType plus noisyPatterns/referenceErrors to short‑circuit benign client errors, and then filtering by stack frame filenames/paths, is a reasonable way to drop known-noise (e.g., inpage.js) without impacting unrelated events. No functional issues stand out here.

sentry.server.config.ts (1)

6-9: Server beforeSend filter‑then‑tag pipeline is correct and consistent

Importing filterTunnelRouteErrors and routing beforeSend(event, hint) through filter → drop‑if‑null → tagSecurityProbes(filtered) cleanly centralizes monitoring/tunnel suppression while preserving existing probe tagging. This aligns with the edge config and keeps Sentry DSN/PII settings unchanged.

Also applies to: 32-38

sentry.edge.config.ts (1)

8-11: Edge beforeSend now mirrors server-side filtering/tagging

Using beforeSend(event, hint) to first call filterTunnelRouteErrors and only then tagSecurityProbes gives edge routes the same monitoring/tunnel suppression semantics as the server config, which should make Sentry behavior easier to reason about across environments.

Also applies to: 32-38

Comment thread __tests__/components/waves/CreateDropStormParts.test.tsx Outdated
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@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: 2

🧹 Nitpick comments (1)
config/sentryProbes.ts (1)

21-105: Harden stacktrace handling to ensure filterTunnelRouteErrors never throws

The two-path suppression logic is reasonable, but checkFirstErrorPath assumes value.stacktrace.frames is always an array; if it’s ever a non‑array truthy value, isMonitoringRoute will receive it and stacktrace.some will throw.

You can guard the frames extraction to keep this path safe:

   const url = event.request?.url || "";
-  const stacktrace = value?.stacktrace?.frames || [];
-
-  return isMonitoringRoute(url, stacktrace);
+  const frames = Array.isArray(value?.stacktrace?.frames)
+    ? value.stacktrace.frames
+    : [];
+
+  return isMonitoringRoute(url, frames);

This keeps the behavior for well‑formed events while preventing instrumentation failures on unexpected shapes.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0e7c424 and 5c12de9.

📒 Files selected for processing (3)
  • __tests__/components/waves/CreateDropStormParts.test.tsx (2 hunks)
  • config/sentryProbes.ts (2 hunks)
  • instrumentation-client.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • tests/components/waves/CreateDropStormParts.test.tsx
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • instrumentation-client.ts
  • config/sentryProbes.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • instrumentation-client.ts
  • config/sentryProbes.ts
{.env*,*.env,**/config/**}

📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)

Configure Task Master behavior via environment variables: ANTHROPIC_API_KEY (required), MODEL, MAX_TOKENS, TEMPERATURE, DEBUG, LOG_LEVEL, DEFAULT_SUBTASKS, DEFAULT_PRIORITY, PROJECT_NAME, PROJECT_VERSION, PERPLEXITY_API_KEY, and PERPLEXITY_MODEL

Files:

  • config/sentryProbes.ts
🧠 Learnings (2)
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Applies to {middleware,proxy}.ts : Request boundary logic using `middleware.ts` should be renamed to `proxy.ts` with exported `proxy` function (Node runtime); legacy `middleware.ts` is only for edge-only cases

Applied to files:

  • config/sentryProbes.ts
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use NextJS features that match the current version

Applied to files:

  • config/sentryProbes.ts
🧬 Code graph analysis (1)
instrumentation-client.ts (1)
utils/error-sanitizer.ts (1)
  • isIndexedDBError (67-110)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (2)
instrumentation-client.ts (1)

16-86: Centralized noise/reference/filename filtering looks solid

The extraction of noisy/reference/filename-based suppression into shouldFilterEvent is clear and defensive (good use of optional chaining and narrow checks); no issues from a correctness or robustness standpoint.

config/sentryProbes.ts (1)

1-14: Typed Sentry imports and extended probe patterns look good

Importing Event/EventHint from @sentry/nextjs and updating tagSecurityProbes to accept a typed Event improves clarity and type safety. The added probe URL patterns (/manager/html, /admin/login.jsp) integrate cleanly with the existing lower‑cased URL check; no issues found.

Also applies to: 130-146

Comment thread instrumentation-client.ts
Comment thread instrumentation-client.ts
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@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: 0

♻️ Duplicate comments (1)
instrumentation-client.ts (1)

115-153: Consider slightly widening isNetworkError to catch NetworkError‑only messages

The tightened heuristic avoids incidental "network" matches, which is good, but it can now miss browser messages that only contain NetworkError (e.g. "NetworkError when attempting to fetch resource.") and neither "failed to fetch" nor "load failed".

You can keep the strictness while covering these common cases:

 function isNetworkError(errorMessage: string): boolean {
   const normalized = errorMessage.toLowerCase();
   return (
-    normalized.includes("failed to fetch") ||
-    normalized.includes("load failed") ||
-    /\bnetwork\b/.test(normalized)
+    normalized.includes("failed to fetch") ||
+    normalized.includes("load failed") ||
+    normalized.includes("networkerror") ||
+    normalized.includes("network error") ||
+    normalized.includes("network request failed") ||
+    /\bnetwork\b/.test(normalized)
   );
 }

This preserves the word‑boundary safeguard while ensuring Firefox‑style NetworkError messages are still normalized through handleNetworkError.

Please verify against a couple of real Sentry payloads (Chrome/Safari/Firefox) that the messages you expect are still being classified as network errors and that you are not reintroducing the earlier false‑positive issue.

🧹 Nitpick comments (2)
config/sentryProbes.ts (1)

21-37: Make isConnectionError case‑insensitive to better match Node error messages

isConnectionError currently does a case‑sensitive includes, which may miss variants like "Aborted" or "socket hang up" with different casing.

You can normalize once and keep the pattern list readable:

 const CONNECTION_ERROR_PATTERNS = [
   "aborted",
   "ECONNRESET",
   "socket hang up",
 ];
 
 function isConnectionError(message: string): boolean {
-  return CONNECTION_ERROR_PATTERNS.some((pattern) =>
-    message.includes(pattern)
-  );
+  const normalized = message.toLowerCase();
+  return CONNECTION_ERROR_PATTERNS.some((pattern) =>
+    normalized.includes(pattern.toLowerCase())
+  );
 }

This should make the first suppression path more robust across environments without broadening it beyond the specific connection errors you already target.

After this change, re‑run npm run type-check and whatever tests cover tunnel error suppression to confirm that expected /monitoring connection resets are still being dropped and no unrelated errors are silently filtered.

sentry.edge.config.ts (1)

8-11: Edge beforeSend correctly composes tunnel filtering and probe tagging; consider typing hint

Wiring beforeSend as filterTunnelRouteErrors(event, hint) followed by tagSecurityProbes(filtered) is a clean separation of responsibilities and ensures tunnel/monitoring noise is suppressed before security probe tagging runs.

For a bit more type safety and self‑documentation, you could type the hint parameter explicitly:

-  beforeSend(event: Sentry.ErrorEvent, hint) {
+  beforeSend(event: Sentry.ErrorEvent, hint: Sentry.EventHint) {

This keeps usage aligned with Sentry’s expected beforeSend signature and with the EventHint usage in config/sentryProbes.ts.

Please confirm that Sentry.EventHint is available in your version of @sentry/nextjs (or alternatively import EventHint as a type from the package) and that npm run type-check continues to pass with this annotation.

Also applies to: 32-38

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5c12de9 and ed12adb.

📒 Files selected for processing (3)
  • config/sentryProbes.ts (2 hunks)
  • instrumentation-client.ts (2 hunks)
  • sentry.edge.config.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version

**/*.{ts,tsx,js,jsx}: Enforce ≥ 80% line coverage for files changed since main via npm run test
All code must pass ESLint (Next's Core Web Vitals + React Hooks rules) via npm run lint
Use <Link> from Next.js for internal navigation instead of <a> tags or HTML anchors
Use <Image> from next/image instead of HTML <img> elements

Files:

  • sentry.edge.config.ts
  • config/sentryProbes.ts
  • instrumentation-client.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: All code must pass TypeScript type checking via npm run type-check (tsc --noEmit)
Use 'use cache' directive at the top of Server Components or functions to explicitly opt-in to caching in Next.js 16

Files:

  • sentry.edge.config.ts
  • config/sentryProbes.ts
  • instrumentation-client.ts
{.env*,*.env,**/config/**}

📄 CodeRabbit inference engine (.cursor/rules/dev_workflow.mdc)

Configure Task Master behavior via environment variables: ANTHROPIC_API_KEY (required), MODEL, MAX_TOKENS, TEMPERATURE, DEBUG, LOG_LEVEL, DEFAULT_SUBTASKS, DEFAULT_PRIORITY, PROJECT_NAME, PROJECT_VERSION, PERPLEXITY_API_KEY, and PERPLEXITY_MODEL

Files:

  • config/sentryProbes.ts
🧠 Learnings (3)
📚 Learning: 2025-11-25T08:37:14.950Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:14.950Z
Learning: Applies to {middleware,proxy}.ts : Request boundary logic using `middleware.ts` should be renamed to `proxy.ts` with exported `proxy` function (Node runtime); legacy `middleware.ts` is only for edge-only cases

Applied to files:

  • sentry.edge.config.ts
  • config/sentryProbes.ts
📚 Learning: 2025-11-25T08:37:44.688Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: app/api/AGENTS.md:0-0
Timestamp: 2025-11-25T08:37:44.688Z
Learning: Applies to app/api/**/*.{ts,tsx,js,jsx} : When needing custom headers or timeouts for external requests, pass them via `@/lib/security/urlGuard` helper options rather than re-implementing your own wrapper.

Applied to files:

  • sentry.edge.config.ts
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use NextJS features that match the current version

Applied to files:

  • config/sentryProbes.ts
🧬 Code graph analysis (2)
sentry.edge.config.ts (1)
config/sentryProbes.ts (2)
  • filterTunnelRouteErrors (107-128)
  • tagSecurityProbes (130-146)
instrumentation-client.ts (1)
utils/error-sanitizer.ts (1)
  • isIndexedDBError (67-110)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (3)
instrumentation-client.ts (2)

16-85: Client-side noise filtering helpers look robust and defensive

The new noisyPatterns/referenceErrors/filenameExceptions plus shouldFilterEvent pipeline is structured cleanly, uses optional chaining throughout, and should avoid beforeSend throwing even for message-only or frame-less events. This is a good centralization of client filtering logic.

Please ensure npm run lint and npm run type-check both pass for this file after these structural changes, and that your Sentry tests (if any) cover a couple of representative noisy events.


171-185: beforeSend is now safely guarded and composes the specialized handlers correctly

Using hint?.originalException ?? hint?.syntheticException avoids the earlier potential crash when hint is undefined, and the flow shouldFilterEvent → handleIndexedDBError → handleNetworkError is straightforward and side‑effect‑only (always returning event or null), which is appropriate for Sentry hooks.

Please run npm run type-check to ensure the EventHint typing from @sentry/nextjs still aligns with how hint is used here, especially in cases where Sentry may omit originalException and only provide syntheticException.

config/sentryProbes.ts (1)

70-128: Tunnel route filtering logic and typing look sound

The two‑path structure in filterTunnelRouteErrors (checkFirstErrorPath for generic connection errors on monitoring routes and checkSecondErrorPath for "aborted" with an HTTP server stack) is clear, guarded against missing request/stacktrace, and the generic signature filterTunnelRouteErrors<T extends Event>(event: T) preserves the concrete event type when used (e.g. ErrorEvent).

isFrameWithPaths plus the unknown[] stacktrace handling also defensively avoid assuming Sentry’s frame shape.

Please ensure npm run lint and npm run type-check both pass with these new type imports from @sentry/nextjs, and that your Sentry integration tests cover at least one event per suppression path so future refactors don’t accidentally regress this behavior.

Signed-off-by: prxt6529 <prxt@6529.io>
Signed-off-by: prxt6529 <prxt@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Dec 3, 2025

@prxt6529 prxt6529 merged commit 4cd6b69 into main Dec 3, 2025
8 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Dec 17, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Mar 5, 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