Ministack: Free, open-source local AWS emulator - 60+ services, Terraform compatible, real databases. Free forever. MIT licensed.
Python awsaws-emulatoraws-localaws-sdkdevtoolsdockerdynamodbec2emulatorlambdalocalstacklocalstack-alternativeministackmock-awsopen-sourcepythons3sqsterraform
fix(sfn): Fix context resolution in pass parameters. (#899)
noy381d447be30e
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 39455fff..4f4acf2e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,7 @@ Versioning follows [Semantic Versioning](https://semver.org/).## [Unreleased]### Fixed+- **Step Functions — Pass state `Parameters` now resolve context object paths** — `$$.*` references resolved to `null` in Pass states because `_execute_pass` applied `Parameters` without forwarding the execution context. It now forwards the context correctly when evaluating `Parameters`, fixing context object resolution for Pass states.- **CloudFormation — `DescribeStackResources` now honors the `LogicalResourceId` filter** — The handler now reads the optional `LogicalResourceId` parameter and, when present, returns only the matching resource or a `ValidationError` if it does not exist in the stack.---diff --git a/ministack/services/stepfunctions.py b/ministack/services/stepfunctions.pyindex e9df2a5e..e4975345 100644--- a/ministack/services/stepfunctions.py+++ b/ministack/services/stepfunctions.py@@ -1328,7 +1328,7 @@ def _execute_pass(state_def, raw_input, ctx=None):return output, _next_or_end(state_def)effective = _apply_input_path(state_def, raw_input)- effective = _apply_parameters(state_def, effective)+ effective = _apply_parameters(state_def, effective, ctx)result = state_def.get("Result", effective)result = _apply_result_selector(state_def, result)diff --git a/tests/test_stepfunctions.py b/tests/test_stepfunctions.pyindex 9d74d375..40fd5be8 100644--- a/tests/test_stepfunctions.py+++ b/tests/test_stepfunctions.py@@ -282,6 +282,41 @@ def test_sfn_intrinsic_string_to_json(sfn, sfn_sync):output = json.loads(resp["output"])assert output["parsed"] == {"a": 1, "b": 2}+def test_sfn_pass_parameters_resolve_context_object(sfn):+ """Pass state Parameters can resolve Step Functions context object paths."""+ unique = str(time.time_ns())+ execution_name = f"pass-context-{unique}"+ definition = json.dumps({+ "StartAt": "Build",+ "States": {+ "Build": {+ "Type": "Pass",+ "Parameters": {+ "executionName.$": "$$.Execution.Name",+ "inputValue.$": "$.value",+ },+ "End": True,+ }+ },+ })+ sm = sfn.create_state_machine(+ name=f"sfn-pass-context-{unique}",+ definition=definition,+ roleArn="arn:aws:iam::000000000000:role/R",+ )+ ex = sfn.start_execution(+ stateMachineArn=sm["stateMachineArn"],+ name=execution_name,+ input=json.dumps({"value": "from-input"}),+ )++ desc = _wait_sfn(sfn, ex["executionArn"])+ assert desc["status"] == "SUCCEEDED"+ assert json.loads(desc["output"]) == {+ "executionName": execution_name,+ "inputValue": "from-input",+ }+def test_sfn_intrinsic_json_merge(sfn, sfn_sync):"""States.JsonMerge shallow-merges two objects."""definition = json.dumps({