fix(frontend): use direct parent for nested-loop test-step args

evalArg() and updateStepArgs() in stepsInputArgs.svelte.ts selected the
parent module via modules[modules.length - 1] from dfs(id, flow, true).
dfs returns [module, direct_parent, grandparent, ...] (innermost to
outermost), so that index resolved to the outermost ancestor instead of
the direct parent. For a step inside a nested for-loop, getFlowInput then
computed flow_input using only the outer loop's context, so the "Test
this step" tab showed flow_input.iter.value as the outer loop's iteration
value instead of the inner loop's. Runtime behavior was already correct.

Use modules[1] (the direct parent). For non-nested cases (length == 2)
this is identical to the previous index, so behavior is unchanged there.

Fixes WIN-2096

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-06-25 12:02:46 +02:00
co-authored by Claude Opus 4.8
parent d5388da953
commit 3dc32dd8fe
@@ -102,7 +102,10 @@ export class StepsInputArgs {
}
let parentModule: FlowModule | undefined = undefined
if (modules.length > 1) {
parentModule = modules[modules.length - 1]
// dfs returns [module, direct_parent, grandparent, ...], so the direct
// parent is modules[1]. Using the last element would pick the outermost
// ancestor and miss inner-loop iter values for nested loops.
parentModule = modules[1]
}
const stepPropPicker = getStepPropPicker(
flowState,
@@ -177,7 +180,10 @@ export class StepsInputArgs {
}
let parentModule: FlowModule | undefined = undefined
if (modules.length > 1) {
parentModule = modules[modules.length - 1]
// dfs returns [module, direct_parent, grandparent, ...], so the direct
// parent is modules[1]. Using the last element would pick the outermost
// ancestor and miss inner-loop iter values for nested loops.
parentModule = modules[1]
}
const stepPropPicker = getStepPropPicker(
flowState,