From 5d2455f6a909a328d42d1062a488ccd37b576c6c Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 1 Jun 2026 15:03:46 +0200 Subject: [PATCH 1/2] add test covering a collection input --- test/unit/app/tools/test_actions.py | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/test/unit/app/tools/test_actions.py b/test/unit/app/tools/test_actions.py index de6efdca29d..d6ec06b4412 100644 --- a/test/unit/app/tools/test_actions.py +++ b/test/unit/app/tools/test_actions.py @@ -51,6 +51,18 @@ TWO_OUTPUTS = """ """ +# Tool with a multiple="true" data parameter – used to test on_string handling for collections. +MULTIPLE_DATA_TOOL = """ + cat "$param1" < $out1 + + + + + + + +""" + def test_on_text_for_numeric_ids(): def assert_on_text_is(expected, hids): @@ -83,6 +95,27 @@ def test_on_text_for_dataset_and_collections(): class TestDefaultToolAction(TestCase, tools_support.UsesTools): + def test_on_text_multiple_true_collection(self): + # Create a collection with three datasets + hdca = model.HistoryDatasetCollectionAssociation() + hdca.id = 999 + hdca.hid = 55 + collection = model.DatasetCollection() + hdca.collection = collection + # add three datasets to the collection + hda1 = self.__add_dataset() + hda2 = self.__add_dataset() + hda3 = self.__add_dataset() + model.DatasetCollectionElement(collection=collection, element=hda1) + model.DatasetCollectionElement(collection=collection, element=hda2) + model.DatasetCollectionElement(collection=collection, element=hda3) + collection.collection_type = "list" + self.history.dataset_collections.append(hdca) + # incoming param with the collection + incoming = {"param1": hdca} + job, output = self._simple_execute(contents=MULTIPLE_DATA_TOOL, incoming=incoming) + assert output["out1"].name == f"Test Tool on collection {hdca.hid}" + def setUp(self): self.setup_app() history = model.History() From 4ed0118ebdb66c87f2c1aa80176bee90f30574cb Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 1 Jun 2026 15:04:16 +0200 Subject: [PATCH 2/2] fix --- lib/galaxy/tools/actions/__init__.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index 50429437766..3088a070043 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -941,8 +941,12 @@ class DefaultToolAction(ToolAction): for input_name in inp_data: data = inp_data[input_name] + # Skip collection inputs and any suffixed dataset names derived from them (e.g., "datasets1", "datasets2") if input_name in inp_dataset_collections: continue + # Also skip if the name starts with a collection input key and the remainder is a numeric suffix + if any(input_name.startswith(key) and input_name[len(key) :].isdigit() for key in inp_dataset_collections): + continue if getattr(data, "hid", None): input_hids.append(data.hid) return on_text_for_dataset_and_collections(dataset_hids=input_hids, collection_hids=collection_hids)