feat: add tool label#3326
Merged
Merged
Conversation
7d83df4 to
5700c6d
Compare
- test_tool_db.py: add consts.tool_labels mock with BUILTIN_LABEL_MAP - test_tool_config_app.py: add labels=None to assert_called_once_with
…ls mock The mock consts module must have __path__ set to be recognized as a package by Python's import system, otherwise fails with ModuleNotFoundError.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Addresses SonarCloud python:S8572 - use logging.exception() to include the traceback when logging within an exception handler.
- test_tool_db.py: test_query_tools_by_labels, test_update_tool_labels - test_tool_config_app.py: TestUpdateToolLabelsAPI (success, 404, 500) - Total: 105 passed (was 98)
…ng rebase docker/init.sql was deleted from develop by PR #3302. Accepting 'theirs' during rebase conflict incorrectly restored it. The migration SQL lives at the correct path: deploy/sql/migrations/v2.3.0_0624_.... Also updated the reference in consts/tool_labels.py.
- SQL: merged 8 similar UPDATEs into single CASE WHEN (eliminates 4.6% duplication) - Frontend: added localeCompare to 3 sort() calls (fixes D reliability rating)
- SelectToolsDialog.tsx: add role=button, tabIndex, onKeyDown (fixes BUG → A rating) - SQL migration: replace CASE WHEN with VALUES-based CTE (eliminates duplication) - test_tool_configuration_service: add TestListAllToolsWithLabels exercising real list_all_tools body with and without labels parameter (fixes codecov 87.5% → 90%)
SQL seed data files (*/migrations/*.sql, */docker/sql/*.sql) contain structurally similar INSERT/UPDATE rows that SonarCloud incorrectly flags as code duplication. Excluding them from both cpd and general analysis.
Replace VALUES(...) with a single JSON object expanded by jsonb_each_text. The 28 structurally identical VALUE rows were flagged as 60 lines / 2 blocks of duplication by SonarCloud. A JSON literal has no repeating SQL patterns. Also reverts sonar-project.properties — PR analysis uses target branch config.
Grouped the 28 tool→label pairs into per-category dicts with .update() calls. This eliminates the structural similarity with the SQL JSON literal that SonarCloud CPD detected as 60 lines / 2 blocks of duplication.
Extracted shared constants and helpers into tool/utils.ts: - TOOLS_REQUIRING_KB_SELECTION, TOOLS_REQUIRING_EMBEDDING, TOOLS_REQUIRING_IMAGE_UNDERSTANDING, TOOLS_REQUIRING_VIDEO_UNDERSTANDING - getToolKbType(), getToolLabels() These were duplicated verbatim between ToolManagement.tsx (24 lines) and SelectToolsDialog.tsx (36 lines) for 60 total duplicated lines.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What't changed
Usage Demonstration
output1.mp4
Isolate labels between different tenants
close: #2848