-
-
Notifications
You must be signed in to change notification settings - Fork 8.1k
fix(core): ensure nested transient provider isolation #15815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(core): ensure nested transient provider isolation #15815
Conversation
Pull Request Test Coverage Report for Build f21074a3-8fcf-4ec1-a93c-75675d264f01Details
💛 - Coveralls |
529943f to
4ffe045
Compare
|
Would you like to add an integration test for this, too? |
|
Oooh man, i think i've been fighting with this bug for 2 days now.... My symptoms are tenant databases are getting mixed up (in a sandbox env), and they are all resolving as the same latest database initialized for our durable database providers. Update: My bad, i've isolated my bug to updating "@nestjs-cls/transactional" "2.5.1" -> "2.6". |
|
LGTM |
|
@kamilmysliwiec Hello, the bug seems not to be fixed, please see my demo https://github.com/NicChoi/nestjs-transient The |
|
Thanks for reporting this. However, after analyzing your demo repository, this appears to be a different issue from what #15689 addressed. #15689 (this PR): resolved
Your case:
The getEffectiveInquirer method specifically targets REQUEST/DURABLE scope contexts. Your scenario starts from a default-scoped controller, which is a separate issue. Could you please open a new issue with your reproduction repository? This will help the maintainers track and address it properly. |
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When a transient provider depends on another transient provider, each parent consumer should receive its own dedicated instance of the nested transient provider. However, in request/durable scoped contexts, nested transient providers are incorrectly shared across different parents, causing context pollution.
Issue Number: #15689
What is the new behavior?
Each parent now receives its own isolated instance of nested transient providers. The fix adds a
getEffectiveInquirer()helper method that uses parentInquirer instead of inquirer when resolving transient-to-transient dependency chains in non-static contexts (REQUEST/DURABLE scopes).Key changes:
Does this PR introduce a breaking change?
Other information
Similar but distinct from: #15553 / #15571: Lifecycle hook phantom instance bug (different root cause)