Repository navigation
fix(persistence): correlate 5xx responses with request ids - #1601
Merged
Merged
Conversation
wyuc
approved these changes
Sep 20, 2026
wyuc
left a comment
Contributor
There was a problem hiding this comment.
Approving — thanks @Ai-Eastern, this is exactly what #1574 asked for. Validating the inbound x-request-id against a bounded charset (and falling back to a UUID) keeps log injection out, only 5xx is logged with method/path/error-code/id, and reading the code via response.clone().json() is confined to the error path. Both behaviours are covered by tests.
Non-blocking: the echoed id is client-supplied when it passes the pattern, so without a trusted proxy in front two clients could pick the same value. Fine for correlation, worth keeping in mind if it ever feeds something stricter.
looper1126-code
pushed a commit
to looper1126-code/OpenMAIC
that referenced
this pull request
Nov 2, 2026
…1601) Co-authored-by: wyuc <[email protected]>
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.
Summary
Add correlation IDs to embedded persistence responses and log every returned 5xx with the HTTP method, request path, status, error code, and request ID.
This PR is AI-assisted. I reviewed the complete diff and verified the behavior locally before submission.
Related Issues
Fixes #1574
Changes
x-request-idor generate a UUID, then return it on every persistence response.Type of Change
Verification
Steps to reproduce / test
pnpm vitest run tests/persistence/route.test.ts.x-request-idheader.x-request-idand confirm it is replaced without an error log.What you personally verified
x-request-id.Evidence
pnpm check && pnpm lint && npx tsc --noEmit)Local checks:
pnpm check— passedpnpm lint— 0 errors (existing warnings remain in unchanged files)pnpm exec tsc --noEmit— passedpnpm vitest run tests/persistence/route.test.ts— 42 passedNo live server or UI was started; the route handlers were verified directly through route-level tests. Screenshots are not applicable.
Checklist