Skip to content

fix(core): isolate nested transient providers in static context#16258

Closed
mag123c wants to merge 1 commit intonestjs:masterfrom
mag123c:fix/static-nested-transient-isolation
Closed

fix(core): isolate nested transient providers in static context#16258
mag123c wants to merge 1 commit intonestjs:masterfrom
mag123c:fix/static-nested-transient-isolation

Conversation

@mag123c
Copy link
Contributor

@mag123c mag123c commented Jan 27, 2026

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Other... Please describe:

What is the current behavior?

When multiple DEFAULT scoped providers inject the same TRANSIENT → TRANSIENT chain, the nested TRANSIENT instances are incorrectly shared

  • DefaultParent1 → TransientService[1] → NestedTransient[1]
  • DefaultParent2 → TransientService[2] → NestedTransient[1] ← Shared!

This is because getEffectiveInquirer() has a contextId !== STATIC_CONTEXT condition that excludes STATIC context from nested TRANSIENT isolation logic.

Issue Number: #16257

What is the new behavior?

Each DEFAULT scoped parent now receives its own isolated nested TRANSIENT chain

  • DefaultParent1 → TransientService[1] → NestedTransient[1]
  • DefaultParent2 → TransientService[2] → NestedTransient[2] ← Isolated!

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

cc. @Legiew

@coveralls
Copy link

Pull Request Test Coverage Report for Build adaf2e50-9fbb-4438-b086-14d3e112471e

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage decreased (-0.01%) to 89.743%

Files with Coverage Reduction New Missed Lines %
packages/core/injector/instance-wrapper.ts 1 95.53%
Totals Coverage Status
Change from base Build d3739886-8f7f-46b1-9469-82eecbaff18b: -0.01%
Covered Lines: 7446
Relevant Lines: 8297

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants