Conversation
Co-authored-by: Oliver Lockwood <olockwood@dalet.com>
Co-authored-by: Oliver Lockwood <olockwood@dalet.com>
There was a problem hiding this comment.
Pull Request Overview
This PR moves the AsyncLocalStorage instance from module scope to global scope and adds an integration test to verify that context values remain unique across different usage paths.
- Moves AsyncLocalStorage instance initialization to globalThis in index.js.
- Introduces an init function and supporting constants in the intermediate library.
- Adds a new integration test to ensure unique context propagation.
Reviewed Changes
Copilot reviewed 7 out of 9 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| tests/express-test-harness.js | Adds integration test to verify unique context values when the library is used both directly and transitively. |
| packages/express-http-context-intermediate-library/index.js | Introduces an init function and constants for managing request IDs via middleware. |
| packages/express-http-context-intermediate-library/README.md | Adds instructions for publishing the library to NPM. |
| index.js | Shifts AsyncLocalStorage instance creation to a global scope using globalThis. |
Files not reviewed (2)
- package.json: Language not supported
- packages/express-http-context-intermediate-library/package.json: Language not supported
Comments suppressed due to low confidence (2)
index.js:13
- [nitpick] Consider caching the global instance in the middleware, get, and set functions consistently to improve readability and avoid repeated global lookups.
const asyncLocalStorage = globalThis[STORAGE_KEY];
packages/express-http-context-intermediate-library/index.js:6
- [nitpick] Ensure that the naming for the request ID header constants is consistent and clearly distinguishes between the incoming header and the header set in the response, if appropriate.
const REQUEST_ID_HTTP_HEADER_NAME = "my-request-id";
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.
Resolves #78
Resolves #79