Merge pull request #21964 from mvdbeek/workflow-param-not-provided-fix

[25.1] Fix optional parameter persisting ``NO_REPLACEMENT`` sentinel when not provided
This commit is contained in:
Marius van den Beek
2026-03-03 15:25:25 +01:00
committed by GitHub
3 changed files with 44 additions and 1 deletions
+5 -1
View File
@@ -517,6 +517,8 @@ class WorkflowProgress:
dependent_workflow_step_id=output_step_id,
)
)
if isinstance(replacement, NoReplacement):
return NO_REPLACEMENT
if isinstance(replacement, MutableMapping) and replacement.get("__class__") == "NoReplacement":
return NO_REPLACEMENT
if isinstance(replacement, model.HistoryDatasetCollectionAssociation):
@@ -622,7 +624,9 @@ class WorkflowProgress:
outputs["output"] = step.get_input_default_value(NO_REPLACEMENT)
if step.label and step.type == "parameter_input" and "output" in outputs:
self.runtime_replacements[step.label] = str(outputs["output"])
output_value = outputs["output"]
if output_value is not NO_REPLACEMENT:
self.runtime_replacements[step.label] = str(output_value)
invocation = invocation_step.workflow_invocation
if not invocation.has_input_for_step(step.id):
content = outputs.get("output", NO_REPLACEMENT)
@@ -0,0 +1,15 @@
- doc: |
Test that omitting an optional text parameter from the invocation does not
leak sentinel values into output renames. The rename template uses
${optional_text} which should remain unexpanded (kept as-is) when the
parameter is not provided, rather than being replaced with a stringified
NO_REPLACEMENT sentinel.
job:
required_input:
type: File
value: 1.fasta
outputs:
out:
class: File
metadata:
name: "prefix_${optional_text}_suffix"
@@ -0,0 +1,24 @@
class: GalaxyWorkflow
doc: |
Test that omitting an optional parameter_input from an invocation does not
leak NO_REPLACEMENT sentinel into runtime replacements used in post-job
actions (e.g. output renames).
Regression test for https://github.com/galaxyproject/galaxy/issues/21947
inputs:
required_input:
type: data
optional_text:
type: text
optional: true
outputs:
out:
outputSource: cat/out_file1
steps:
cat:
tool_id: cat
in:
input1:
source: required_input
outputs:
out_file1:
rename: "prefix_${optional_text}_suffix"