TestState does not report variables assigned by the state under test #49
gjoseph
started this conversation in
Bugs (AWS)
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
TestStatedoes not report variables assigned by the state under testIs there an existing issue for this?
Summary
The Step Functions
TestStateAPI returnsinspectionData.variablescontaining only thevariables supplied in the request's
variablesparameter. Variables the state under testassigns via
Assignare missing. AWS returns the post-state set — request variables mergedwith everything the state assigned.
Per the AWS API reference for
InspectionData.variables:The returned string preserves the request payload's whitespace verbatim
(
{"fromInput": "kept"}), which suggests the request parameter is echoed back rather than thepost-state environment being serialized.
Affects both JSONata and JSONPath states.
Environment
localstack/localstack-pro:latest), pro edition, licensed.Also reproduced on 2026.7.0.dev21:0e6b6e128.
Minimal reproduction
LocalStack — the assignment is absent:
Real AWS, same call:
Identical divergence with JSONPath, so it is not specific to the JSONata evaluator:
--definition '{"Type":"Pass","Assign":{"assignedHere":42},"End":true}'The same request with the value moved into
Outputreturns it correctly(
{"fromInput": "kept", "assignedHere": 42}), so the evaluation is fine — only the reporting ofassignments is not.
Scope: the assignment itself works
Only
TestState's reporting is affected — a real execution propagates the assigned variablecorrectly, so this is not a gap in
Assignsupport:Relation to existing issues
#13215 reported request
variablesnot being interpolated at all, fixed by #13827 ("Setvariables from API call parameter to test state execution environment"). That fixed the read
path —
{% $fromInput %}now resolves. This report is the write-back path, which #13827 did notcover. #13215 does note "
variablesis null ininspectionData" in passing, but its repro andfix are both about reading request variables.
Impact
It fails silently rather than erroring, which makes it worse than an unsupported feature. A test
that exercises an
Assignexpression and asserts oninspectionData.variablesreads its owninput back and passes — hiding both a broken expression and this gap.
We hit it with a JSONata expression stamping
{$states.context.State.Name: $now()}into anaccumulating variable. The probe passed against real Step Functions and "passed" against
LocalStack while reporting one key where two were expected; it only surfaced because the
assertion happened to check the key count. Every JSONata feature involved —
$now(),$states.context.State.Name, computed object keys,$merge— works correctly on LocalStack.Expected
inspectionData.variablesshould contain the workflow variables after the state executes:request-supplied variables merged with those the state assigns.
Workaround
Evaluate the expression through
Outputrather thanAssignand read the response'soutputfield; that path is correct on LocalStack.
full disclosure: this report was written by/with Claude but I believe it's correct
All reactions