Files
galaxy/test/functional/tools/data_manager_select.xml
T
mvdbeek 56417baef9 Fix HDA leak in tool form for data managers (#22674)
When a user already has a ``data_manager_json`` bundle in their history
for a given tool data table, ``DynamicOptions.get_user_options`` builds
a synthetic options row from that bundle.

A 2025-02-18 refactor (172ef05f26, "Skip bundles that don't match data
table definition") moved ``field_entry.append(hda)`` from the end of the
row-building loop to the beginning. That shifted every declared column
index by one and put the HDA at position 0. ``get_options`` then reads
``fields[self.columns[<col>]]`` to find the option's name / value and
expects the HDA at ``fields[-1]`` — so it ends up wiring the raw HDA
into the option's ``value`` field. The unserialized HDA then crashed
``/api/tools/{id}/build`` for the data manager's own form with:

  TypeError: Object of type HistoryDatasetAssociation is not JSON serializable

Move the HDA append back after the column loop where get_options
expects it.

Regression covered by a new API test in a ``require_admin_user=True``
test class that runs ``data_manager_select`` in bundle mode to produce a
real ``data_manager_json`` bundle, then calls the build endpoint and
asserts the synthetic option is present.
2026-05-20 09:01:49 +02:00

20 lines
973 B
XML

<tool id="data_manager_select" name="Test Data Manager Select" tool_type="manage_data" version="0.0.1" profile="19.05">
<description>Mirrors twobit_builder shape: select sourced from a tool data table. Regression for #22674.</description>
<configfiles>
<configfile name="static_test_data">{"data_tables": {"test_fasta_indexes": [{"value": "regression_value", "dbkey": "regression_dbkey", "name": "regression_name", "path": "regression.fa"}]}}</configfile>
</configfiles>
<command detect_errors="exit_code"><![CDATA[
mkdir $out_file.files_path ;
echo "$index" > '$out_file.files_path/regression.fa';
cp '$static_test_data' '$out_file'
]]></command>
<inputs>
<param name="index" type="select" label="Source FASTA Sequence">
<options from_data_table="test_fasta_indexes"/>
</param>
</inputs>
<outputs>
<data name="out_file" format="data_manager_json"/>
</outputs>
</tool>