From 4c7988f2ae8e741db28059af4cf0a9bc7903361e Mon Sep 17 00:00:00 2001 From: mvdbeek Date: Sun, 29 Mar 2026 13:17:12 +0200 Subject: [PATCH] Fix HDCA shown as unavailable on tool form rerun MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After 6a9323a79 (Fix HDCA lost in tool form on rerun), visible HDCAs in the current history were incorrectly added to the job_input_values fallback section with a "(not in current history)" label. This happened because active_visible_datasets_and_roles only iterates HDAs, so HDCAs were never removed from job_input_values during matching. The HDCA then appeared twice in the form: once correctly from the dataset collections section, and once as a "keep" option with wrong state. Skip HDCAs in the fallback loop when they are active, visible, and in the current history — they are already properly handled by the active_visible_dataset_collections loop below. Fixes `lib/galaxy_test/selenium/test_tool_form.py::TestToolForm::test_rerun_dataset_collection_element - selenium.common.exceptions.TimeoutException: Message: Timeout waiting on CSS selector [.dataset-collection-panel] to become present.` --- lib/galaxy/tools/parameters/basic.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index d25d46d21f8..a60053b711d 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -2452,15 +2452,25 @@ class DataToolParameter(BaseDataToolParameter): # Route each to the correct options list by type so the client can # match them by id *and* src. for value in job_input_values: - if isinstance(value, (HistoryDatasetCollectionAssociation, HistoryDatasetAssociation)): + if isinstance(value, HistoryDatasetCollectionAssociation): + # HDCAs are handled by the dataset collections section below; + # only add here if not visible in the current history. + if value.deleted or not value.visible or value.history != history: + if value.deleted: + state = "deleted" + elif not value.visible: + state = "hidden" + else: + state = "not in current history" + append(d["options"]["hdca"], value, f"({state}) {value.name}", "hdca", True) + elif isinstance(value, HistoryDatasetAssociation): if value.deleted: state = "deleted" elif not value.visible: state = "hidden" else: state = "not in current history" - src = "hdca" if isinstance(value, HistoryDatasetCollectionAssociation) else "hda" - append(d["options"][src], value, f"({state}) {value.name}", src, True) + append(d["options"]["hda"], value, f"({state}) {value.name}", "hda", True) elif isinstance(value, DatasetCollectionElement): append_dce(value) elif isinstance(value, LibraryDatasetDatasetAssociation):