data.latest() in workflow step inputs resolved at workflow start, not at step execution time
Opened by swampadmin · 6/29/2025
Description
When a workflow uses data.latest() expressions in step inputs, these expressions are resolved at workflow start time rather than when the step actually executes. This means steps in later jobs receive stale data from previous runs instead of fresh data written by earlier jobs in the same workflow run.
Steps to Reproduce
- Create a workflow with two jobs:
- Job 1 (
create): Creates a resource (writes new data viacreatemethod) - Job 2 (
get): Gets the resource usingdata.latest()to resolve the identifier — depends on Job 1succeeded
- Job 1 (
- Run the workflow once — succeeds (no prior data, expressions deferred to runtime)
- Run the workflow again — Job 1 succeeds, but Job 2 fails because
data.latest()resolved to the OLD identifier from the previous run
Example
jobs:
- name: create-resources
steps:
- name: create-vpc
task:
type: model_method
modelIdOrName: test-vpc
methodName: create
- name: get-resources
dependsOn:
- job: create-resources
condition:
type: succeeded
steps:
- name: get-vpc
task:
type: model_method
modelIdOrName: test-vpc
methodName: get
inputs:
identifier: ${{ data.latest("test-vpc", "swamp_aws_crud_test_vpc").attributes.VpcId }}Run 1 (no prior data): data.latest() can't resolve at start → deferred to runtime → resolves to newly created vpc-0652aafe3207ce5e6 → PASS
Run 2 (stale data from run 1 exists): data.latest() resolves at start to vpc-0652aafe3207ce5e6 (old, now deleted) → create writes new vpc-0f2acbed8e5689ccb → get step uses pre-resolved old ID → FAIL:
Resource 'vpc-0652aafe3207ce5e6' was deleted at 2026-03-07T22:56:22.253Z — run a 'create' method to re-create it firstEvidence
swamp data get test-vpc swamp_aws_crud_test_vpc --jsonconfirms version 6 has the correct new VpcIdvpc-0f2acbed8e5689ccb- But the get step received the old VpcId
vpc-0652aafe3207ce5e6 get-key-pairsucceeded because its identifier (KeyName: swamp_aws_crud_test_kp) is a constant that doesn't change between runs — masking the bug for that step
Expected Behavior
data.latest() expressions in step inputs should be lazily evaluated when the step executes (after dependent jobs have completed and written new data), not eagerly at workflow start time.
Impact
Any workflow that creates resources and then references them via data.latest() in later jobs will fail on second and subsequent runs. This makes CRUD test workflows non-repeatable without manually clearing data between runs.
Summary
This bug is in the workflow runtime's expression evaluation phase. data.latest() expressions in step inputs need to be deferred until step execution time rather than resolved during the pre-run evaluation pass. The fix would involve treating data.latest() (and potentially other data-referencing expressions) as runtime-resolved rather than evaluate-time-resolved when they appear in step inputs.
Found during AWS EC2 CRUD testing in /testing/aws/.
Closed
No activity in this phase yet.
Sign in to post a ripple.