Skip to content

fix: fail loudly when a fan-out 'items' expression does not resolve to a list#2957

Open
doquanghuy wants to merge 1 commit into
github:mainfrom
doquanghuy:fix/2956-fanout-items-fail-loud
Open

fix: fail loudly when a fan-out 'items' expression does not resolve to a list#2957
doquanghuy wants to merge 1 commit into
github:mainfrom
doquanghuy:fix/2956-fanout-items-fail-loud

Conversation

@doquanghuy

Copy link
Copy Markdown
Contributor

Description

Fixes #2956.

FanOutStep.execute silently coerced any non-list items result to [], so a mis-wired or unresolvable items: expression produced a vacuous zero-instance run with no error anywhere near the cause. This PR makes the step fail loudly instead, with an error naming the expression and the resolved type. An explicit empty list remains valid input (legitimately-empty data still completes with item_count: 0).

The previous behavior was pinned by test_execute_non_list_items_resolves_empty; that test is updated to the fail-loud contract, and a new test_execute_empty_list_items_is_valid locks the empty-list-stays-valid distinction. If silent-empty was intentional for some use case, happy to rework this as an opt-in knob (allow_empty:/strict:) with fail-loud as default — see the issue for that alternative.

The failure output keeps the step's four output keys (items/max_concurrency/step_template/item_count) so downstream readers of a failed run's state don't hit missing keys.

Testing

AI Disclosure

  • I did not use AI assistance for this contribution
  • I did use AI assistance (describe below)

Code, tests, and this description were authored with AI assistance (Claude), driven by a real-pipeline failure investigation; everything was verified by running the repo's test suite and ruff locally in both red (unfixed) and green (fixed) directions.

@doquanghuy doquanghuy requested a review from mnriem as a code owner June 12, 2026 17:13
@doquanghuy

Copy link
Copy Markdown
Contributor Author

@mnriem when you have a moment, would appreciate a review — happy to adjust anything.

…o a list

A non-list result from the items expression is a wiring error (the
template did not resolve to a collection); silently fanning out over
zero items hides it until a confusing downstream failure. Fail the
step with an error naming the expression instead. An explicit empty
list remains valid input.

Fixes github#2956
@doquanghuy doquanghuy force-pushed the fix/2956-fanout-items-fail-loud branch from 485c977 to 317d347 Compare June 12, 2026 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: fan-out silently coerces a non-list 'items' to [] — zero-instance runs with no error

1 participant