Skip to content

fix(compose): pass through when field mapping input already matches target type#976

Open
barry3406 wants to merge 1 commit intocloudwego:mainfrom
barry3406:fix/stream-field-mapping-converter
Open

fix(compose): pass through when field mapping input already matches target type#976
barry3406 wants to merge 1 commit intocloudwego:mainfrom
barry3406:fix/stream-field-mapping-converter

Conversation

@barry3406
Copy link
Copy Markdown

What type of PR is this?

fix

Check the PR title.

  • This PR title match the format: <type>(optional scope): <description>
  • The description of this PR title is user-oriented and clear enough for others to understand.

(Optional) More detailed description for this PR:

en:
buildFieldMappingConverter panics when the incoming value is not a map[string]any, but in some workflow topologies the upstream node can emit a value that is already the converter's target type I (see #957 for the repro). @nswodewy-code also noted buildStreamFieldMappingConverter has the same asymmetry on the stream path.

This PR treats the "already the target type" case as a pass-through in both the sync and stream variants, so the workflow no longer panics when a node happens to emit its successor's declared input type directly. If the input is neither map[string]any nor I, the original panic is preserved.

(Optional) Which issue(s) this PR fixes:

Fixes #957

Test plan

Added compose/field_mapping_test.go with six table-style cases covering:

  1. buildFieldMappingConverter: target-type input passes through, map[string]any input still converts, unrelated input still panics.
  2. buildStreamFieldMappingConverter: stream of target type passes through, stream of map[string]any still converts, stream of an unrelated type still panics.

Full suite: go test ./... -count=1 -race -timeout=300s — all packages green.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 19, 2026

CLA assistant check
All committers have signed the CLA.

…arget type

buildFieldMappingConverter and buildStreamFieldMappingConverter panic when
the incoming value is not a map[string]any, but in some workflow topologies
the upstream node can emit a value that is already the converter's target
type I (or a stream of I). Treat that case as a pass-through instead of a
panic, mirroring the fix suggested in cloudwego#957 and applying it to the stream
variant as well.

Fixes cloudwego#957
@barry3406 barry3406 force-pushed the fix/stream-field-mapping-converter branch from f3f87f1 to 135a804 Compare April 19, 2026 20:10
@shentongmartin shentongmartin added C-bugfix Category: This is a PR that fixes a bug. D-compose Domain: this issue relates to eino's compose package labels Apr 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-bugfix Category: This is a PR that fixes a bug. D-compose Domain: this issue relates to eino's compose package

Development

Successfully merging this pull request may close these issues.

buildFieldMappingConverter logic is incomplete

3 participants