trails/openspec/changes/sentry-improvements/proposal.md
Ullrich Schäfer 9a904d9f69
Sentry improvements: context, tracing, source maps, privacy manifest
- Set Sentry user context (id, username) in Journal root for all routes
- Tag Planner errors with session_id
- Use reactRouterV7BrowserTracingIntegration for route-aware traces
- Hidden source maps (no sourceMappingURL in bundles, .map deleted after
  upload to Sentry)
- Privacy manifest at /privacy documenting all data collection
- robots.txt blocking all bots on both apps
- Suppress i18next promotional console log

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 03:11:07 +01:00

1.4 KiB

Why

Sentry is deployed but errors lack context — we don't know which user or session triggered them, route-level performance is invisible, and source maps are served to clients unnecessarily. These gaps make debugging harder and leak internal details.

What Changes

  • Set Sentry user context when a Journal user is authenticated (user ID, username)
  • Tag Planner errors with the session ID for debugging
  • Replace generic browserTracingIntegration with reactRouterV7BrowserTracingIntegration for route-aware performance traces
  • Configure Vite to produce source maps as hidden (uploaded to Sentry but not referenced in the bundle, so browsers don't fetch them)
  • Wrap server-side request handlers with Sentry error capturing for unhandled exceptions

Capabilities

New Capabilities

(None — this enhances the existing Sentry integration, no new behavioral capabilities.)

Modified Capabilities

  • infrastructure: Adding Sentry context enrichment and source map handling to the deployment pipeline

Impact

  • Files: entry.client.tsx (both apps), entry.server.tsx (journal), server.ts (planner), vite.config.ts (both apps), Journal root loader or layout
  • Dependencies: No new packages — @sentry/react and @sentry/node already support all features
  • APIs: No API changes
  • Security: Source maps no longer served to clients (currently .map files are publicly accessible)