Description — what to implement and the why/impact.
Tracing asynchronous operations, database queries, and background job dispatches across the NestJS modular monolith requires a consistent request correlation ID. This task implements a middleware that extracts or generates a correlation ID for every incoming HTTP request and propagates it through AsyncLocalStorage and outbound log contexts.
Context & Requirements — background, constraints, design references, edge cases; grounded in the actual repo (real files, stack, conventions).
The repository already incorporates AsyncLocalStorage context storage. This issue ensures that incoming HTTP requests automatically populate the context with a correlation ID (from X-Request-ID or generated via UUID v4), include it in the standard response envelope requestId, and attach it to NestJS Logger outputs for every request lifecycle phase.
Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".
Implementation Guidance — likely files/modules to touch (use real paths from the repo context) and a suggested approach, without over-prescribing.
Examine src/common and existing interceptors or middleware. Implement the correlation middleware and register it globally in src/app.module.ts or via consumer configuration.
Testing & Validation — how the contributor should prove it works (tests to add/run, manual checks, screenshots for UI).
Run npm test and npm run typecheck to verify correct typing and behavior of the context storage middleware.
Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.
Wave complexity: Medium
Description — what to implement and the why/impact.
Tracing asynchronous operations, database queries, and background job dispatches across the NestJS modular monolith requires a consistent request correlation ID. This task implements a middleware that extracts or generates a correlation ID for every incoming HTTP request and propagates it through AsyncLocalStorage and outbound log contexts.
Context & Requirements — background, constraints, design references, edge cases; grounded in the actual repo (real files, stack, conventions).
The repository already incorporates AsyncLocalStorage context storage. This issue ensures that incoming HTTP requests automatically populate the context with a correlation ID (from
X-Request-IDor generated via UUID v4), include it in the standard response enveloperequestId, and attach it to NestJS Logger outputs for every request lifecycle phase.Acceptance Criteria — a checklist ("- [ ] ...") of specific, testable conditions that define "done".
X-Request-IDheaders.Implementation Guidance — likely files/modules to touch (use real paths from the repo context) and a suggested approach, without over-prescribing.
Examine
src/commonand existing interceptors or middleware. Implement the correlation middleware and register it globally insrc/app.module.tsor via consumer configuration.Testing & Validation — how the contributor should prove it works (tests to add/run, manual checks, screenshots for UI).
Run
npm testandnpm run typecheckto verify correct typing and behavior of the context storage middleware.Submission Guidelines — must open a PR that includes "Closes #"; assignment is required before starting; follow the repo's existing style and conventions.
Wave complexity: Medium