Stu Mason
Stu Mason

Activity

StuMason/cleanconnect
TidyLinker.com
TypeScript
Pull Request Merged

PR #150 merged: fix: make Sentry useful — user context, noise filters, stale-chunk reloads

Summary

Triaging the 10 unresolved Sentry issues on dev.tidylinker.com surfaced three gaps in the existing setup; this PR addresses them together.

Backend — config/sentry.php

  • Default send_default_piitrue. The Sentry LaravelIntegration uses this to attach the authenticated user (id, email) to every event. Previously every event reported userCount: 0, even on authenticated admin routes, which made triage harder than it needed to be.

Frontend — resources/js/sentry.ts

  • Add ignoreErrors for known noise: extension runtime.sendMessage, the benign ResizeObserver loop notification, dynamic-import failures (now recovered client-side, see below), unactionable NetworkError / Load failed.
  • Add denyUrls for chrome-extension:// / moz-extension:// / safari-extension:// so frames from browser-injected scripts stop reaching us. Saves event quota and noise.
  • Export setSentryUser helper that maps Inertia's auth.user shape (id, email, name) into the Sentry user scope.

Frontend — resources/js/app.tsx

  • Call setSentryUser on first paint from props.initialPage.props.auth.user, then again on every router.on('navigate') event so login/logout flips Sentry's user scope without a hard reload.
  • Window-level handler for stale chunk errors after deploys: Failed to fetch dynamically imported module / Importing a module script failed / ChunkLoadError. Reload once (sessionStorage-guarded to avoid loops) instead of leaving users staring at a broken page. Addresses TIDY-LINKER-2V and TIDY-LINKER-2Q on Sentry.

Test plan

  • php artisan test tests/Feature/Config/SentryTest.php → 2 passed
  • Pint, Prettier, ESLint clean (pre-commit hook)
  • After merge + deploy: confirm a new error in Sentry shows the authenticated user
  • Manual: deploy, keep an old tab open, trigger a navigation that lazy-loads a chunk — observe the page auto-reload instead of erroring
  • Side-channel (will do separately): bulk-resolve the 9 stale issues (#36, #32, #3A, #2V, #39, #37, #2S, #2Q, #38, #3B) in the Sentry UI; they're all already fixed by prior PRs (#142, #144) or now handled client-side
+192
additions
-7
deletions
6
files changed