From b280e5bca8d989f5270a375496bd9d8a87d78ff9 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Tue, 17 Mar 2026 05:39:37 -0400 Subject: [PATCH] Fix PJAs corrupting skipped pick_value outputs _apply_post_job_actions ran unconditionally, changing the datatype of skipped HDAs (expression.json) away from expression.json. This broke downstream skip detection. Guard with _is_null_or_skipped check. Adds framework test: pick_value_skip_pja verifies skipped output retains expression.json when ChangeDatatypeAction is configured. Co-Authored-By: Claude Opus 4.6 (1M context) --- lib/galaxy/workflow/modules.py | 4 ++- .../pick_value_skip_pja.gxwf-tests.yml | 16 +++++++++++ .../workflow/pick_value_skip_pja.gxwf.yml | 28 +++++++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 lib/galaxy_test/workflow/pick_value_skip_pja.gxwf-tests.yml create mode 100644 lib/galaxy_test/workflow/pick_value_skip_pja.gxwf.yml diff --git a/lib/galaxy/workflow/modules.py b/lib/galaxy/workflow/modules.py index 7979491f616..a4aac395402 100644 --- a/lib/galaxy/workflow/modules.py +++ b/lib/galaxy/workflow/modules.py @@ -2163,8 +2163,10 @@ class PickValueModule(WorkflowModule): """Apply post job actions directly to module output via ActionBox. Uses execute_on_mapped_over which operates on step_outputs dict - rather than requiring a Job object. + rather than requiring a Job object. Skipped outputs are left untouched. """ + if self._is_null_or_skipped(output): + return step_outputs = {"output": output} step_inputs = {} for pja in step.post_job_actions: diff --git a/lib/galaxy_test/workflow/pick_value_skip_pja.gxwf-tests.yml b/lib/galaxy_test/workflow/pick_value_skip_pja.gxwf-tests.yml new file mode 100644 index 00000000000..333ff8ebbdf --- /dev/null +++ b/lib/galaxy_test/workflow/pick_value_skip_pja.gxwf-tests.yml @@ -0,0 +1,16 @@ +- doc: | + Test that PJAs are NOT applied to skipped outputs. When all inputs are + null, first_or_skip produces a skipped HDA (expression.json). The + ChangeDatatypeAction should not corrupt it. + job: + input_data: + type: File + value: 1.bed + file_type: bed + when: + type: raw + value: false + outputs: + picked: + class: File + ftype: expression.json diff --git a/lib/galaxy_test/workflow/pick_value_skip_pja.gxwf.yml b/lib/galaxy_test/workflow/pick_value_skip_pja.gxwf.yml new file mode 100644 index 00000000000..242217a9a43 --- /dev/null +++ b/lib/galaxy_test/workflow/pick_value_skip_pja.gxwf.yml @@ -0,0 +1,28 @@ +class: GalaxyWorkflow +inputs: + input_data: + type: data + when: + type: boolean +outputs: + picked: + outputSource: pick/output +steps: + branch: + tool_id: cat + in: + input1: + source: input_data + when: + source: when + when: $(inputs.when) + pick: + type: pick_value + in: + input_0: + source: branch/out_file1 + state: + mode: first_or_skip + out: + output: + change_datatype: txt