Summary
requestContext.ts already generates per-request IDs but they are never sent back in the response. Attaching X-Request-ID to every response makes distributed tracing and client-side error reporting much easier.
Acceptance Criteria
- Every HTTP response includes
X-Request-ID: <uuid>
- The ID is either taken from the incoming
X-Request-ID header (if present) or generated fresh
- Middleware logs the request ID alongside method and path
- Works via
requestLogger.ts or a new standalone middleware
Files to touch
backend/src/lib/requestContext.ts
backend/src/middleware/requestLogger.ts
Summary
requestContext.tsalready generates per-request IDs but they are never sent back in the response. AttachingX-Request-IDto every response makes distributed tracing and client-side error reporting much easier.Acceptance Criteria
X-Request-ID: <uuid>X-Request-IDheader (if present) or generated freshrequestLogger.tsor a new standalone middlewareFiles to touch
backend/src/lib/requestContext.tsbackend/src/middleware/requestLogger.ts