Skip to content

Commit 06f01f9

Browse files
committed
LazyToolBox: order shed-installed tools before local ones in section materialisation
``test_only_latest_version_in_panel_fastp`` asserts the just-installed fastp shed tool comes first in the rendered custom_13 panel view's section, ahead of the local ``multiple_versions`` entry. Eager achieves this implicitly through ``__add_tool_to_tool_panel``'s insert/replace logic plus the integrated-panel rebuild; the lazy materialiser was iterating ``_tool_index.entries`` in insertion order, which puts boot-time local entries before any post-boot shed installs. Mirror the eager ordering: in ``_materialise_section``, walk shed-installed entries (``is_local=False``) first, then local entries. Among shed entries we keep index insertion order so ``ToolSection.copy(merge_tools=True)`` still ends up with the latest revision after dedup.
1 parent 3ef79dc commit 06f01f9

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

lib/galaxy/tools/lazy_toolbox.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,28 @@ def _materialise_section(self, section_id: Optional[str]) -> None:
142142
toolbox = self._toolbox()
143143
if toolbox is None or toolbox._tool_index is None:
144144
return
145-
loaded = 0
145+
# Order: shed-installed entries (``is_local=False``) before
146+
# local entries. The eager toolbox achieves this implicitly via
147+
# the install path's ``__add_tool_to_tool_panel`` insert/replace
148+
# logic + the integrated panel rebuild; tests like
149+
# ``test_only_latest_version_in_panel_fastp`` assert
150+
# ``tools[0]`` is the just-installed shed tool, so the lazy
151+
# materialiser needs to mirror that ordering. Among shed
152+
# entries we iterate in index insertion order (newest install
153+
# last) so version-dedup in
154+
# ``ToolSection.copy(merge_tools=True)`` keeps picking the
155+
# latest revision.
156+
shed_entries = []
157+
local_entries = []
146158
for entry in toolbox._tool_index.entries.values():
147159
if entry.panel_section_id != section_id or entry.hidden:
148160
continue
161+
if entry.is_local:
162+
local_entries.append(entry)
163+
else:
164+
shed_entries.append(entry)
165+
loaded = 0
166+
for entry in shed_entries + local_entries:
149167
if section.elems.has_tool_with_id(entry.id):
150168
continue
151169
tool = toolbox.get_tool(tool_id=entry.id)

0 commit comments

Comments
 (0)