Skip to content

Commit 21b1c6a

Browse files
committed
LazyToolBox: defer to super().to_dict for in_panel=True listings
``LazyToolBox.to_dict`` returned a flat list of every index entry regardless of ``in_panel``. The eager ``to_dict(in_panel=True, view=X)`` walks ``tool_panel_contents`` which yields the Tools and ToolSections captured in ``_tool_panel_view_rendered[X]`` — the section-aware shape the UI and tests expect. ``test_only_latest_version_in_panel_fastp`` queries ``tools?in_panel=True&view=custom_13`` and expects exactly one ``ToolSection`` (test_section_multi) containing the installed fastp. Under the lazy flat-only ``to_dict``, the response was a flat list of every indexed tool with no ToolSection markers, so the ``[x for x in result if x['model_class'] == 'ToolSection']`` filter in the test came back empty. Fix: when ``in_panel=True``, defer to the parent's to_dict (which already does the right thing — and ``ToolBoxRegistry.get_tool`` inside ``apply_view`` lazy-loads only the tools the view actually references). Keep the cheap flat path for ``in_panel=False`` where no tool loading is needed.
1 parent 031c027 commit 21b1c6a

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

lib/galaxy/tools/lazy_toolbox.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,16 +1917,24 @@ def to_dict(
19171917
"""
19181918
Create a dictionary representation of the toolbox.
19191919
1920-
For LazyToolBox, this returns lightweight data directly from the index
1921-
without loading full Tool objects. This is much faster and uses less memory.
1922-
1923-
Note: tool_help is ignored since we don't load the full tool.
1920+
For the *flat* listing (``in_panel=False``) we serve straight from
1921+
the index — no Tool loading needed. For the panel listing
1922+
(``in_panel=True``, e.g. ``tools?in_panel=True&view=custom_13``)
1923+
we defer to the parent: it walks ``_tool_panel_view_rendered``
1924+
which is built by ``apply_view`` against
1925+
``_integrated_tool_panel`` and produces the section-aware
1926+
response shape (interleaved Tools and ToolSections) that the UI
1927+
and tests expect. ``ToolBoxRegistry.get_tool`` lazy-loads the
1928+
per-section tools as ``apply_view`` walks them, so this stays
1929+
cheap as long as the requested view scopes to a small section.
19241930
"""
19251931
if self._tool_index is None:
19261932
return []
19271933

1928-
rval = []
1934+
if in_panel:
1935+
return super().to_dict(trans, in_panel=True, tool_help=tool_help, view=view, **kwds)
19291936

1937+
rval = []
19301938
# Return data directly from index - no tool loading needed!
19311939
for _tool_id, entry in self._tool_index.entries.items():
19321940
# Skip hidden tools unless requested

0 commit comments

Comments
 (0)