Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[24.0] Fix dropped when_expression on step upgrade #18446

Merged
merged 2 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/galaxy/workflow/refactor/execute.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,6 +531,9 @@ def _patch_step(self, execution, step, step_def):
if upgrade_input["name"] == input_name:
matching_input = upgrade_input
break
elif step.when_expression and f"inputs.{input_name}" in step.when_expression:
# TODO: eventually track step inputs more formally
matching_input = upgrade_input

# In the future check parameter type, format, mapping status...
if matching_input is None:
Expand Down
29 changes: 29 additions & 0 deletions test/integration/test_workflow_refactoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,35 @@ def test_tool_version_upgrade_no_state_change(self):
assert len(action_executions[0].messages) == 0
assert self._latest_workflow.step_by_label("the_step").tool_version == "0.2"

def test_tool_version_upgrade_keeps_when_expression(self):
self.workflow_populator.upload_yaml_workflow(
"""
class: GalaxyWorkflow
inputs:
the_bool:
type: boolean
steps:
the_step:
tool_id: multiple_versions
tool_version: '0.1'
in:
when: the_bool
state:
inttest: 0
when: $(inputs.when)
"""
)
assert self._latest_workflow.step_by_label("the_step").tool_version == "0.1"
actions: ActionsJson = [
{"action_type": "upgrade_tool", "step": {"label": "the_step"}},
]
action_executions = self._refactor(actions).action_executions
assert len(action_executions) == 1
assert len(action_executions[0].messages) == 0
step = self._latest_workflow.step_by_label("the_step")
assert step.tool_version == "0.2"
assert step.when_expression

def test_tool_version_upgrade_state_added(self):
self.workflow_populator.upload_yaml_workflow(
"""
Expand Down
Loading