Thread a correlation ID from the frontend through the backend so any error can be traced end-to-end, and upload source maps so Sentry stack traces point at real code.
Requirements and Context
frontend/lib/correlation.ts, frontend/components/ErrorBoundary.tsx, and the Sentry configs (sentry.client.config.ts, sentry.server.config.ts) exist, but correlation IDs are not consistently propagated through frontend/lib/api.ts to the backend, and release source maps are not uploaded, so production stack traces are minified and untraceable across services.
Objectives
- Generate a correlation ID per request and propagate it via a header through
api.ts and the SDK.
- Log/attach the correlation ID in backend request logging (pino) and error responses so frontend↔backend traces join.
- Upload Sentry source maps for production builds and tag releases.
- Add tests for correlation-ID propagation and error capture.
Suggested Execution
git checkout -b feat/correlation-tracing.
- Wire the header through
frontend/lib/api.ts and the backend request middleware.
- Configure source-map upload in the frontend build/Sentry configs.
- Add
frontend/__tests__/correlation.test.ts and run npm run type-check && npm test.
Acceptance Criteria
Guidelines
- Use the existing
correlation.ts and pino request logging; avoid new telemetry deps.
- Ensure correlation IDs are redacted from any user-facing UI.
Timeframe: 72 hours
Requirements and Context
frontend/lib/correlation.ts,frontend/components/ErrorBoundary.tsx, and the Sentry configs (sentry.client.config.ts,sentry.server.config.ts) exist, but correlation IDs are not consistently propagated throughfrontend/lib/api.tsto the backend, and release source maps are not uploaded, so production stack traces are minified and untraceable across services.Objectives
api.tsand the SDK.Suggested Execution
git checkout -b feat/correlation-tracing.frontend/lib/api.tsand the backend request middleware.frontend/__tests__/correlation.test.tsand runnpm run type-check && npm test.Acceptance Criteria
Guidelines
correlation.tsandpinorequest logging; avoid new telemetry deps.Timeframe: 72 hours