Summary
Channel#runStores(context, fn[, thisArg[, ...args]]) should forward every argument after thisArg to fn. Perry currently wires the native method through a fixed five-argument entrypoint and only preserves two callback arguments, so additional arguments are dropped.
Node Behavior
Probe run with Node v25.9.0:
const { channel } = require("node:diagnostics_channel");
const { AsyncLocalStorage } = require("node:async_hooks");
const ch = channel("runstores-args");
const als = new AsyncLocalStorage();
ch.bindStore(als);
const ret = ch.runStores({ value: 1 }, function (...args) {
console.log(JSON.stringify(args), this && this.tag, JSON.stringify(als.getStore()));
return "ret";
}, { tag: "ctx" }, "a", "b", "c");
console.log(ret);
Node prints the complete callback argument list:
["a","b","c"] ctx {"value":1}
ret
Perry Behavior
docs/runtime-parity.md documents the Node signature as channel.runStores(context, fn[, thisArg[, ...args]]).
crates/perry-runtime/src/node_submodules/diagnostics.rs attaches runStores with method_closure(cast5(diag_channel_run_stores), 5, id).
diag_channel_run_stores accepts only data, fn_value, this_arg, a, and b, then calls run_store_wrapped(..., &[a, b]) when no stores are bound.
- The bound-store path allocates
store_next_thunk with captures for only a and b, and store_next_thunk also calls run_store_wrapped(..., &[a, b]).
- The granular fixture
test-parity/node-suite/diagnostics_channel/stores/bind-run-unbind.ts only exercises two forwarded arguments.
Suggested PR Cut
Batch this with related issues in:
node:diagnostics_channel: tracing and store semantics parity cut (#3242)
Good batch candidates:
Do not batch with:
node:trace_events category tracing
- broad
node:async_hooks redesign outside store binding needs
- worker/thread diagnostics subscriber policy changes
Acceptance
- parity/regression test proves
runStores() forwards at least three callback arguments with a bound store
- parity/regression test proves the same rest arguments are preserved when no stores are bound
thisArg binding and AsyncLocalStorage store behavior continue matching Node
- related known-failure/docs/manifest entries updated if touched
Summary
Channel#runStores(context, fn[, thisArg[, ...args]])should forward every argument afterthisArgtofn. Perry currently wires the native method through a fixed five-argument entrypoint and only preserves two callback arguments, so additional arguments are dropped.Node Behavior
Probe run with Node v25.9.0:
Node prints the complete callback argument list:
Perry Behavior
docs/runtime-parity.mddocuments the Node signature aschannel.runStores(context, fn[, thisArg[, ...args]]).crates/perry-runtime/src/node_submodules/diagnostics.rsattachesrunStoreswithmethod_closure(cast5(diag_channel_run_stores), 5, id).diag_channel_run_storesaccepts onlydata,fn_value,this_arg,a, andb, then callsrun_store_wrapped(..., &[a, b])when no stores are bound.store_next_thunkwith captures for onlyaandb, andstore_next_thunkalso callsrun_store_wrapped(..., &[a, b]).test-parity/node-suite/diagnostics_channel/stores/bind-run-unbind.tsonly exercises two forwarded arguments.Suggested PR Cut
Batch this with related issues in:
node:diagnostics_channel: tracing and store semantics parity cut(#3242)Good batch candidates:
Do not batch with:
node:trace_eventscategory tracingnode:async_hooksredesign outside store binding needsAcceptance
runStores()forwards at least three callback arguments with a bound storethisArgbinding and AsyncLocalStorage store behavior continue matching Node