Request correlation - #1673
Open
Devadakene wants to merge 6 commits into
Open
Conversation
… all API v1 routes
Collaborator
|
@Devadakene tell your agent to run bun command with prettier to format the code Then check ✅ it again with bun after with bun prettier check ✅... That the case for all your issues. If you have CODEX try using it or just connect your GitHub with GPT and use chatGPT work with the GitHub mcp It should also solve it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1473
Problem
Currently, request execution and repository actions are not unified with request correlation metadata. When errors or validations fail at the repository or adapter boundaries, matching them to the originating HTTP request is difficult.
Solution
This PR introduces request-scoped tracking using
AsyncLocalStorageto store the active context (requestId,method,route). Downstream components are modified to query and link with this context seamlessly:RequestContextviaAsyncLocalStorageinsrc/server/api/context.ts.createRouteHandler(src/server/api/handler.ts) to run within the active context storage. Structured logger invocations are integrated to record metrics and logs with the request ID.getApiContextto ensure the repositories are wrapped inValidatedApiRepositoryso record boundaries are checked uniformly.ValidatedApiRepositoryto bind the activerequestIdto any repository errors.DataIntegrityErrorretrieves its correlation ID from the active context.tests/unit/api/request-correlation.test.tsto assert context propagation, error correlation, and structured logging metrics.Acceptance Criteria Verified
requestId.