Skip to content

fix: eliminate race condition in buildDSLDependency() for @-namespaced DSL#649

Merged
lmajano merged 1 commit intodevelopmentfrom
claude/fix-di-race-condition-bMtA1
Apr 2, 2026
Merged

fix: eliminate race condition in buildDSLDependency() for @-namespaced DSL#649
lmajano merged 1 commit intodevelopmentfrom
claude/fix-di-race-condition-bMtA1

Conversation

@lmajano
Copy link
Copy Markdown
Member

@lmajano lmajano commented Apr 2, 2026

Mutating the shared cached definition struct (arguments.definition.dsl)
under concurrent load caused double-concatenation and mis-wiring when
multiple threads resolved the same @-namespaced injection simultaneously
(e.g. inject="myService@moduleName").

Instead of writing back to the shared struct, call getInstance() directly
with the locally-computed concatenated name. The @-prefixed branch in
getModelDSL() always resolves to a plain getInstance() call (no colons
possible), so this is behaviourally identical but fully thread-safe.

https://claude.ai/code/session_015kUgi5MyDwtH2FWf5u5DDN

…d DSL

Mutating the shared cached definition struct (arguments.definition.dsl)
under concurrent load caused double-concatenation and mis-wiring when
multiple threads resolved the same @-namespaced injection simultaneously
(e.g. inject="myService@moduleName").

Instead of writing back to the shared struct, call getInstance() directly
with the locally-computed concatenated name. The @-prefixed branch in
getModelDSL() always resolves to a plain getInstance() call (no colons
possible), so this is behaviourally identical but fully thread-safe.

https://claude.ai/code/session_015kUgi5MyDwtH2FWf5u5DDN
Copilot AI review requested due to automatic review settings April 2, 2026 07:56
@lmajano lmajano merged commit 6c6c72d into development Apr 2, 2026
23 of 29 checks passed
@lmajano lmajano deleted the claude/fix-di-race-condition-bMtA1 branch April 2, 2026 07:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a concurrency bug in WireBox’s DSL dependency resolution when handling @-namespaced injections (e.g. inject="myService@moduleName"), avoiding mutation of a shared cached definition struct during concurrent resolution.

Changes:

  • Stop mutating arguments.definition.dsl for @-namespaced DSLs inside buildDSLDependency().
  • Resolve the computed namespaced mapping via a direct injector.getInstance() call using a locally concatenated name.

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.

3 participants