Skip to content

sentry errors#2060

Merged
simo6529 merged 3 commits intomainfrom
sentry-050326-1
Mar 5, 2026
Merged

sentry errors#2060
simo6529 merged 3 commits intomainfrom
sentry-050326-1

Conversation

@simo6529
Copy link
Copy Markdown
Collaborator

@simo6529 simo6529 commented Mar 5, 2026

Summary by CodeRabbit

  • Tests

    • Added comprehensive tests validating security probe detection and error filtering.
  • Refactor

    • Improved detection and tagging of probe-like requests in error tracking.
  • Bug Fixes

    • Early-return (404) for probe-like user slugs to prevent probe requests from reaching profile handlers.

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

coderabbitai Bot commented Mar 5, 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: 8e3d0249-93f6-4ac6-843a-4062c13bdeb7

📥 Commits

Reviewing files that changed from the base of the PR and between 07daf61 and 5645fad.

📒 Files selected for processing (5)
  • __tests__/config/sentryProbes.test.ts
  • __tests__/pages/userPages.test.tsx
  • app/[user]/_lib/userTabPageFactory.tsx
  • components/user/user-page-header/UserPageHeader.tsx
  • config/sentryProbes.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • tests/config/sentryProbes.test.ts
  • components/user/user-page-header/UserPageHeader.tsx

📝 Walkthrough

Walkthrough

Adds tests for Sentry probe utilities, enhances probe-detection/tagging for Mozilla multipart server-action probes, blocks probe-like user slugs early in page generation, and removes a "use server" directive from a user component.

Changes

Cohort / File(s) Summary
Tests — Sentry probe coverage
__tests__/config/sentryProbes.test.ts
New comprehensive test suite for filterServerActionProbeErrors, filterMalformedNextActionProbeErrors, filterWebStreamsProbeErrors, and tagSecurityProbes with helpers to build mock Sentry events.
Sentry probe config
config/sentryProbes.ts
Adds serverActionProbeTags and isMozillaMultipartProbe; extends isProbeLikeServerActionRequest and tagSecurityProbes to detect/tag Mozilla multipart server-action probes; refines web-streams probe checks.
Page-level probe handling
app/[user]/_lib/userTabPageFactory.tsx
Introduces probe slug detection (PROBE_USER_SUFFIXES, isProbeLikeUserSlug) and returns notFound() early for probe-like user slugs in Page and generateMetadata flows.
Tests — user pages
__tests__/pages/userPages.test.tsx
Adds notFound mock wiring, resets mocks in beforeEach, and adds tests ensuring probe-like slugs trigger early notFound and skip profile fetch in both Page and metadata flows.
Component tweak
components/user/user-page-header/UserPageHeader.tsx
Removed top-level "use server" directive and adjusted a couple of null-safety/property access checks.

Sequence Diagram(s)

sequenceDiagram
  participant Client as Client (browser)
  participant Router as Next.js Page Factory
  participant Probe as Probe Detection Logic
  participant Sentry as Sentry beforeSend
  participant App as App/Page Handler

  Client->>Router: HTTP request (user slug, headers, body)
  Router->>Probe: isProbeLikeUserSlug / isMozillaMultipartProbe?
  alt probe-like request
    Probe->>Router: return notFound()
    Router->>Client: 404 response
  else non-probe
    Router->>App: render or generateMetadata
    App->>Sentry: sentry event (beforeSend)
    Sentry->>Probe: filterServerActionProbeErrors / tagSecurityProbes
    Probe->>Sentry: drop or tag event
    Sentry->>App: processed event stored or ignored
    App->>Client: response
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • prxt6529

Poem

🐰 I hopped through tests both day and night,
Mozilla probes now caught in sight,
User slugs checked, false calls denied,
Sentry logs tidied, errors classified,
A little hop — the repo's delight!

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% 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 errors' is vague and generic, using non-descriptive language that fails to convey the specific nature or scope of changes made in the pull request. Revise the title to be more specific and descriptive of the main changes, such as 'Add probe detection for Sentry error filtering' or 'Implement security probe filtering and tagging for Sentry events'.
✅ 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 sentry-050326-1

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.

simo6529 added 2 commits March 5, 2026 10:38
Signed-off-by: Simo <simo@6529.io>
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 5, 2026

@simo6529 simo6529 merged commit 140d7e4 into main Mar 5, 2026
7 checks passed
@simo6529 simo6529 deleted the sentry-050326-1 branch March 5, 2026 14:56
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