dify/api/services/tools
GareArc d4834ddd98
fix(tools): scope builtin tool default-credential clear to tenant
When two workspace members each set their own credential as the default
for the same provider, both rows ended up with is_default=True for the
same (tenant_id, provider). The clear UPDATE was filtered by user_id,
so it only reset the caller's own defaults and left other members'
defaults intact. The consumer (`get_builtin_provider`) is tenant-scoped
and picks an arbitrary winner via the created_at tiebreak when multiple
defaults exist, producing user-visible inconsistencies.

Drop user_id from the clear filter so default selection becomes
properly tenant-scoped, matching
`DatasourceProviderService.set_default_datasource_provider`.

Adds a regression test that asserts the clear filter_by call uses
tenant_id/provider but not user_id.

Backport of equivalent fix on main to lts/1.13.x.
2026-05-07 02:30:35 -07:00
..
api_tools_manage_service.py refactor(api): type tool service dicts with TypedDict (#33836) 2026-03-21 11:43:49 +09:00
builtin_tools_manage_service.py fix(tools): scope builtin tool default-credential clear to tenant 2026-05-07 02:30:35 -07:00
mcp_tools_manage_service.py test: add unit tests for services-part-1 (#33050) 2026-03-23 00:02:41 +08:00
tool_labels_service.py chore(api/services): apply ruff reformatting (#7599) 2024-08-26 13:43:57 +08:00
tools_manage_service.py fix(api): remove tool provider list cache to fix cache inconsistency (#30323) 2025-12-29 16:58:38 +08:00
tools_transform_service.py fix: fix mcp tool parameter extract (#33258) 2026-03-11 13:46:38 +08:00
workflow_tools_manage_service.py refactor(api): move model_runtime into dify_graph (#32858) 2026-03-02 20:15:32 +08:00