Fix server loading tools - #534
Conversation
WalkthroughThe implementation of the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant ToolsetManager
participant DAL
Caller->>ToolsetManager: list_server_toolsets()
ToolsetManager->>ToolsetManager: _list_all_toolsets(dal, enable_all_toolsets=False, toolset_tags, check_prerequisites=True)
ToolsetManager->>DAL: (internal toolset retrieval)
ToolsetManager-->>Caller: [toolsets]
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🔭 Outside diff range comments (1)
holmes/core/toolset_manager.py (1)
274-290:refresh_statusis now unused and doc-string promises aren’t metThe recent refactor removed the call to
load_toolset_with_status, but kept therefresh_statusparameter (default =True).
Today the flag does absolutely nothing – we always rebuild the toolset list and prerequisites every call.
Moreover, the doc-string still claims to “refresh by default” vs “rely on cache”, and the function name says “List enabled toolsets”, yet the implementation returns all toolsets, including the disabled ones.Clean-up or wire-up is required to avoid misleading API:
-def list_server_toolsets( - self, dal: Optional[SupabaseDal] = None, refresh_status=True +) # Remove dead arg (or re-introduce cache path) +def list_server_toolsets( + self, dal: Optional[SupabaseDal] = None ) -> List[Toolset]: @@ - toolsets_with_status = self._list_all_toolsets( - dal, - check_prerequisites=True, - enable_all_toolsets=False, - toolset_tags=self.server_tool_tags, - ) - return toolsets_with_status + # Only return enabled toolsets – aligns with doc-string + return [ + ts + for ts in self._list_all_toolsets( + dal, + check_prerequisites=True, + enable_all_toolsets=False, + toolset_tags=self.server_tool_tags, + ) + if ts.enabled + ]Either drop the parameter (breaking but clearer) or pass it through to
load_toolset_with_statuswhenrefresh_status=Falseto honour the original contract.Leaving it as dead code invites confusion for callers and maintainers.
🧹 Nitpick comments (1)
tests/core/test_toolset_manager.py (1)
167-173: Strengthen the assertion – verify the patched call signatureGreat that the test now patches
_list_all_toolsets, but it would be safer to assert the method was invoked with the expected arguments:mock_list_all_toolsets.return_value = [toolset] result = toolset_manager.list_server_toolsets() assert toolset in result + + # Ensure internal call uses the intended parameters + mock_list_all_toolsets.assert_called_once_with( + toolset_manager, # self + None, # dal + check_prerequisites=True, + enable_all_toolsets=False, + toolset_tags=toolset_manager.server_tool_tags, + )This guards against future regressions where the implementation might silently change the flags.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
holmes/core/toolset_manager.py(1 hunks)tests/core/test_toolset_manager.py(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
holmes/core/toolset_manager.py (1)
holmes/core/tools.py (1)
check_prerequisites(377-432)
tests/core/test_toolset_manager.py (1)
holmes/core/tools.py (2)
Toolset(301-443)ToolsetTag(90-93)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: build (3.12)
- GitHub Check: build (3.10)
- GitHub Check: build (3.11)
- GitHub Check: Pre-commit checks
- GitHub Check: build (3.12)
|
Thanks for fixing the issue. |
No description provided.