Skip to content

Test framework: buildTemplateVars flattens all Inputs blocks into one namespace #78

@josh-padnick

Description

@josh-padnick

Summary

buildTemplateVars strips the inputsID. prefix from all input keys, collapsing every Inputs block into a single flat inputs map. If two Inputs blocks define the same variable name (e.g., both clone-config and overrides define branch), one clobbers the other nondeterministically due to Go map iteration order.

The frontend handles this correctly by scoping variables per inputsId. The test framework should do the same — when a block has inputsId="clone-config", its {{ .inputs.branch }} should resolve from clone-config only, not from a global merge of all Inputs blocks.

Current workaround

In testdata/feature-demos/inputs-and-outputs/runbook_test.yml, we explicitly set overrides.branch: main in the test inputs to prevent the overrides Inputs block's branch default (feature/new-syntax) from clobbering clone-config's branch default (main). Once this bug is fixed, that workaround can be removed.

Reproduction

Remove the overrides.branch: main input from the test YAML and run:

go run main.go test testdata/feature-demos/inputs-and-outputs

The clone-from-inputs block will nondeterministically fail because it may pick up feature/new-syntax instead of main for {{ .inputs.branch }}.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions