Skip to content

Serialize complex variables used in for_each_task.inputs - #7067

Open
yuri-rod wants to merge 3 commits into
databricks:mainfrom
yuri-rod:fix-6901-foreach-inputs-complex-vars
Open

yuri-rod wants to merge 3 commits into
databricks:mainfrom
yuri-rod:fix-6901-foreach-inputs-complex-vars

Conversation

@yuri-rod

@yuri-rod yuri-rod commented Oct 14, 2026 •

Copy link
Copy Markdown

Complex variables substituted into for_each_task.inputs were dropped by normalization with expected string, found sequence, leaving the required field unset. The Jobs API never saw a value.

This serializes complex values at for_each_task.inputs inside variable resolution, right after substitution and before normalization, into the JSON string the Jobs API expects. That covers both direct references (inputs: ${var.table_list}) and inputs nested inside variable-defined tasks (tasks: ${var.job_tasks}). Values that still contain references are skipped and keep the existing diagnostics, since baking them into JSON would change substitution into text interpolation. Validation in unrelated fields is unchanged.

Tests: unit coverage for the serializer and the resolution pipeline (serialization, empty arrays, escaping, passthrough cases, preserved validation errors, variable-defined tasks), plus an acceptance test running both reference shapes through bundle validate.

Fixes #6901.

A complex variable substituted into for_each_task.inputs was dropped by
normalization with 'expected string, found sequence', leaving the required
field unset. Serialize pure variable references to complex values into the
JSON string the Jobs API expects, before variable resolution runs.

Fixes databricks#6901.
@yuri-rod
yuri-rod requested review from a team as code owners October 14, 2026 18:59
@yuri-rod
yuri-rod requested review from pietern and a balanced review from Copilot October 14, 2026 18:59
@github-actions github-actions Bot added the DABs DABs related issues label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the contribution! This pull request was opened from a fork.

If you're a member of the Databricks organization, please request access to the cli-contrib team and open your pull request from a branch in this repository instead of a fork — fork PRs don't run integration tests automatically and have reduced CI access.

If you're an external contributor, no action is needed; a maintainer will review your pull request.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved serialization and reference-resolution interactions can still drop inputs or alter literal data.

3 open findings
What changed in this PR

Adds JSON serialization for complex variables referenced by for_each_task.inputs, addressing the local type mismatch reported in #6901.

Changes:

  • Adds a field-specific serializer before resource variable resolution.
  • Adds unit tests and an acceptance reproduction.
  • Documents the behavior in a changelog entry.
File Description
bundle/​config/​mutator/​resourcemutator/​serialize_for_each_task_inputs.go Implements serialization.
bundle/​config/​mutator/​resourcemutator/​serialize_for_each_task_inputs_test.go Tests serialization and passthrough behavior.
bundle/​config/​mutator/​resourcemutator/​resource_mutator.go Integrates serialization into normalization.
bundle/​config/​mutator/​resourcemutator/​process_static_resources.go Integrates serialization into static processing.
acceptance/​bundle/​variables/​complex-foreach-inputs/​test.toml Configures ignored test artifacts.
acceptance/​bundle/​variables/​complex-foreach-inputs/​script Validates serialized inputs.
acceptance/​bundle/​variables/​complex-foreach-inputs/​output.txt Records expected command output.
acceptance/​bundle/​variables/​complex-foreach-inputs/​out.validate.json Records expected configuration.
acceptance/​bundle/​variables/​complex-foreach-inputs/​out.test.toml Records test execution settings.
acceptance/​bundle/​variables/​complex-foreach-inputs/​hello.py Supplies the task fixture.
acceptance/​bundle/​variables/​complex-foreach-inputs/​databricks.yml Defines the reproduction bundle.
.nextchanges/​bundles/​6901.md Announces the fix.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bundle/config/mutator/resourcemutator/serialize_for_each_task_inputs.go Outdated
Comment thread bundle/config/mutator/resourcemutator/serialize_for_each_task_inputs.go Outdated
Comment thread bundle/config/mutator/resourcemutator/serialize_for_each_task_inputs.go Outdated
Serializing before resolution missed inputs nested inside variable-defined
tasks, and the reference guard did not cover map keys. Serialize after
substitution in resolveOnce instead, and scan keys too.
@github-actions

Copy link
Copy Markdown
Contributor

An authorized user can trigger integration tests manually by following the instructions below:

Trigger:
go/deco-tests-run/cli

Inputs:

  • PR number: 7067
  • Commit SHA: 5c9491a7eb89ee240820e359f41018b93f8c9f9f

Checks will be approved automatically on success.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Previously reported variable-resolution defects remain unresolved and can still drop required inputs.

0 open findings

3 resolved since last review

🧠 Review effort: Balanced

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DABs DABs related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

type: complex variable fails in for_each_task.inputs -- auto-serialize needed

3 participants