#7719 Don't drop shared inputs when switching task versions in the launch form
Pull request opened by
ursucarina
Why are the changes needed?
When rerunning a run in the launch form and switching to a different task version, the form re-converts the original run's inputs against the selected version's interface via LiteralsToLaunchFormJson. That function returned an error the moment it hit a literal whose variable didn't exist in the target interface — which failed the entire conversion, so every input got dropped rather than just the one that no longer applies.
This produced an asymmetry when the two versions declare different inputs. For example, v3 has {name, count} and v17 has {name}:
• v17 → v3: name is preserved and count is left empty to fill in — as expected.
• v3 → v17: both clear, even though name exists in both versions.
The sibling conversion (JSONValuesToLiterals) already handles the analogous mismatch gracefully by ignoring unmapped fields with a warning. This change makes LiteralsToLaunchFormJson consistent: it skips literals that have no corresponding variable in the target interface (logging a warning) instead of erroring, so inputs shared between the two versions survive the switch in both directions.
What changes were proposed in this pull request?
LiteralsToLaunchFormJson no longer errors when a literal has no corresponding variable in the target VariableMap. Instead of returning CodeInvalidArgument and failing the whole conversion, it now skips that literal (logging a warning) and continues, so the literals that do map are still converted. This mirrors the existing unmapped-field handling in JSONValuesToLiterals.
Added a regression test that converts {name, count} against a {name}-only interface and asserts name is preserved with its value while count is dropped.
How was this patch tested?
Unit test in runs/service/converter/literal_json_converter_test.go — a new TestLiteralsToJsonSchema subtest converts a run's {name, count} literals against a target interface that only declares {name}, and asserts the call succeeds, name is preserved with its value, and the unmapped count is dropped. Ran go test ./runs/service/converter/..., all passing.
Also verified manually in the launch form: rerunning a run and switching from a higher-input version to a lower-input version now keeps the values for the shared inputs instead of clearing everything.
Labels
Please add one or more of the following labels to categorize your PR:
•
added: For new features.
•
changed: For changes in existing functionality.
•
deprecated: For soon-to-be-removed features.
•
removed: For features being removed.
•
fixed: For any bug fixed.
•
security: In case of vulnerabilities
This is important to improve the readability of release notes.
Setup process
Screenshots
Check all the applicable boxes
• I updated the documentation accordingly.
• All new and existing tests passed.
• All commits are signed-off.
Related PRs
Stack
If you do use
git town
to manage PR Stacks, the stack relevant to this PR
will show below. Otherwise, you can ignore this section.
Docs link
flyteorg/flyte