Consolidate Sentry initialization: single init, opt-in DSN, URL scrubbing - #16526
Consolidate Sentry initialization: single init, opt-in DSN, URL scrubbing#16526bodhish wants to merge 16 commits into
Conversation
Removes the duplicate eager Sentry.init from src/index.tsx (the lazy init in src/Integrations/Sentry.tsx now runs exactly once), drops the hardcoded fallback DSN so telemetry is off unless REACT_SENTRY_DSN is explicitly set, and adds a beforeSend hook that scrubs query strings and internal record identifiers from event/breadcrumb URLs before events leave the browser. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
|
Deploying care-preview with
|
| Latest commit: |
41e49ed
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://595ce966.care-preview-a7w.pages.dev |
| Branch Preview URL: | https://issues-16508-sentry-init-con.care-preview-a7w.pages.dev |
Greptile SummaryThis PR consolidates Sentry initialization to a single site (
Confidence Score: 5/5Safe to merge; the change correctly removes a hardcoded DSN and adds privacy-preserving URL scrubbing, with one breadcrumb-scrubbing detail worth verifying against the Sentry v9 runtime event shape. The consolidation is clean, the opt-in DSN change is straightforward, and the The breadcrumb-scrubbing block in Important Files Changed
Reviews (2): Last reviewed commit: "test: add combined UUID-path + query-str..." | Re-trigger Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c84f51ddf6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: abhimanyurajeesh <abhimanyurajeesh@gmail.com> Co-authored-by: rithviknishad <mail@rithviknishad.dev>
|
Conflicts have been detected against the base branch. Please merge the base branch into your branch.
|
Co-authored-by: nihal467 <57055998+nihal467@users.noreply.github.com>
|
Too many files changed for review. ( Bypass the limit by tagging |
Co-authored-by: nihal467 <57055998+nihal467@users.noreply.github.com>
Resolved the merge conflicts in commit
|
Closes #16508
Stacked on #16514 (uses the Vitest harness for the new tests). GitHub will retarget this to
developwhen that merges.What
care.config.ts:sentry.dsnno longer falls back to a hardcoded external DSN — telemetry is now opt-in (REACT_SENTRY_DSNunset → Sentry disabled).src/index.tsx: removes the eager productionSentry.init(and the@sentry/browserimport from the eager bundle). Previously both this and theIntegrations/Sentrycomponent initialized Sentry in production.src/Integrations/Sentry.tsxis now the single init, configured withsendDefaultPii: falseand abeforeSendhook that strips query strings, normalizes UUID path segments to<id>in event/breadcrumb URLs, and drops request headers/cookies. The unset-DSN case is a quiet no-op instead of aconsole.error, since that's now a supported state.Verification
npm run typecheck→ exit 0npm run test:unit→ 8/8 (3 newscrubUrltests + seed suite)grep -rn "Sentry.init" src/ care.config.ts→ exactly one siteDeployment note
Deployments that relied on the old implicit default DSN stop reporting after this — set
REACT_SENTRY_DSNexplicitly where telemetry is wanted.🤖 Generated with Claude Code