dify/api/tests/unit_tests
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
..
commands feat: add metrics to clean message and workflow-run task (#33143) 2026-03-17 13:55:28 +08:00
configs refactor: Unify NodeConfigDict.data and BaseNodeData (#32780) 2026-03-11 23:43:58 +08:00
controllers feat: add inner API endpoints for admin DSL import/export (#34059) 2026-03-25 19:48:53 +08:00
core fix: sync 35447 to lts (#35508) 2026-04-23 13:30:59 +08:00
dify_graph fix(api): add trigger_info to WorkflowNodeExecutionMetadataKey (#33753) 2026-03-19 17:56:49 +08:00
enterprise/telemetry feat: sync enterprise telemetry to lts (#34190) 2026-03-27 17:54:16 +08:00
events fix: fix opensearch import (#35476) 2026-04-22 12:09:23 +08:00
extensions feat: Improve SQL Comment Context for Celery Worker Queries (#33058) 2026-03-10 12:37:26 +08:00
factories refactor: move workflow package to dify_graph (#32844) 2026-03-02 18:42:30 +08:00
fields refactor: port api/fields/file_fields.py (#30638) 2026-01-06 22:55:58 +08:00
libs fix(api): fix concurrency issues in StreamsBroadcastChannel (#34061) 2026-03-25 15:47:31 +08:00
models test: replace indexing_technique string literals with IndexTechnique (#34042) 2026-03-25 12:39:58 +09:00
oss test(api): add autospec to MagicMock-based patch usage (#32752) 2026-03-01 04:30:45 +08:00
repositories refactor: migrate execution extra content repository tests from mocks to testcontainers (#33852) 2026-03-23 17:32:11 +09:00
services fix(tools): scope builtin tool default-credential clear to tenant 2026-05-07 02:30:35 -07:00
tasks feat: enterprise otel exporter (#33138) 2026-03-27 16:56:03 +08:00
tools test: Unit test cases for core.tools module (#32447) 2026-03-12 11:48:13 +08:00
utils refactor(api): move model_runtime into dify_graph (#32858) 2026-03-02 20:15:32 +08:00
__init__.py FEAT: NEW WORKFLOW ENGINE (#3160) 2024-04-08 18:51:46 +08:00
.gitignore Enhance Code Consistency Across Repository with .editorconfig (#19023) 2025-04-29 18:04:33 +08:00
conftest.py fix(api): fix the issue that workflow_runs.started_at is overwritten while resuming (#32851) 2026-03-06 15:41:30 +08:00