Commit 987328738c4 for nodejs

commit 987328738c47d665cdab0ece0a70b3157397a521
Author: Ilyas Shabi <ilyasshabi94@gmail.com>
Date:   Wed Dec 2 23:10:42 2026 +0100

    diagnostics_channel: skip empty DisposableStack

    Signed-off-by: ishabi <ilyasshabi94@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/67836
    Reviewed-By: James M Snell <jasnell@gmail.com>
    Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
    Reviewed-By: Gürgün Dayıoğlu <hey@gurgun.day>

diff --git a/lib/diagnostics_channel.js b/lib/diagnostics_channel.js
index 89fac3fa84e..e6241c464e8 100644
--- a/lib/diagnostics_channel.js
+++ b/lib/diagnostics_channel.js
@@ -100,10 +100,10 @@ class RunStoresScope {
   #stack;

   constructor(activeChannel, data) {
-    using stack = new DisposableStack();
+    if (activeChannel._stores?.size) {
+      using stack = new DisposableStack();

-    // Enter stores using withScope
-    if (activeChannel._stores) {
+      // Enter stores using withScope
       for (const entry of activeChannel._stores.entries()) {
         const store = entry[0];
         const transform = entry[1];
@@ -122,17 +122,19 @@ class RunStoresScope {

         DisposableStackPrototypeUse(stack, store.withScope(newContext));
       }
-    }

-    // Publish data
-    activeChannel.publish(data);
+      // Publish data
+      activeChannel.publish(data);

-    // Transfer ownership of the stack
-    this.#stack = DisposableStackPrototypeMove(stack);
+      // Transfer ownership of the stack
+      this.#stack = DisposableStackPrototypeMove(stack);
+    } else {
+      activeChannel.publish(data);
+    }
   }

   [SymbolDispose]() {
-    this.#stack[SymbolDispose]();
+    this.#stack?.[SymbolDispose]();
   }
 }