Skip to content

feat: optimize integrations initial loading - #40118

Merged
hjlarry merged 9 commits into
mainfrom
codex/integrations-initial-load-performance-pr
Aug 7, 2026
Merged

hjlarry merged 9 commits into
mainfrom
codex/integrations-initial-load-performance-pr

Conversation

@Jingyi-Dify

Copy link
Copy Markdown
Contributor

Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

  • Paginate and retain installed Integration data while deferring Marketplace and provider-detail requests until those views are needed.
  • Add lightweight installed-plugin IDs, model-provider summary/binding, and focused credit contracts so the initial screen no longer depends on full plugin, provider-detail, or workspace payloads.
  • Scope plugin cache invalidation by category, preserve main's provider identity and installation-scope behavior, and require verified hosted bindings before enabling system providers.
  • Keep the change focused on Integration initial-load behavior; unrelated Home, Explore, workspace custom-config, and button-loading changes are excluded.

Screenshots

Before After
N/A — data-loading and cache behavior changes N/A — no intentional visual change

Verification

  • Backend focused unit tests: 298 passed.
  • Frontend focused Vitest suites: 375 passed.
  • Generated contracts type-check passed.
  • Ruff passed for every changed Python file.
  • vp check passed with 0 errors for every changed frontend file (existing warnings remain).
  • Full web tsc was attempted but is currently blocked by stale generated .next validator errors outside this PR's files.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the generated API contract and console OpenAPI documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

From Codex

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Aug 7, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 57.85% 57.87% +0.02%
Strict coverage 57.42% 57.44% +0.02%
Typed symbols 37,582 37,639 +57
Untyped symbols 27,585 27,602 +17
Modules 3129 3130 +1

@Jingyi-Dify
Jingyi-Dify marked this pull request as draft August 7, 2026 00:54
@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-08-07 01:31:30.318922876 +0000
+++ /tmp/pyrefly_pr.txt	2026-08-07 01:31:17.189817691 +0000
@@ -4687,33 +4687,33 @@
 ERROR Argument `None` is not assignable to parameter `project` with type `str` in function `core.ops.utils.validate_project_name` [bad-argument-type]
    --> tests/unit_tests/core/ops/test_utils.py:174:40
 ERROR Missing required key `content` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:472:19
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:485:19
 ERROR Missing required key `content_type` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:472:19
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:485:19
 ERROR Key `type` is not defined in TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:472:20
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:485:20
 ERROR Key `value` is not defined in TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:472:36
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:485:36
 ERROR Missing required key `content` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:473:19
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:486:19
 ERROR Missing required key `content_type` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:473:19
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:486:19
 ERROR Key `type` is not defined in TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:473:20
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:486:20
 ERROR Key `value` is not defined in TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:473:37
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:486:37
 ERROR Missing required key `content` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:492:17
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:505:17
 ERROR Missing required key `content_type` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:492:17
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:505:17
 ERROR Key `type` is not defined in TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:492:18
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:505:18
 ERROR Missing required key `content` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:493:18
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:506:18
 ERROR Missing required key `content_type` for TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:493:18
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:506:18
 ERROR Key `type` is not defined in TypedDict `MultimodalRerankInput` [bad-typed-dict-key]
-   --> tests/unit_tests/core/plugin/impl/test_model_client.py:493:19
+   --> tests/unit_tests/core/plugin/impl/test_model_client.py:506:19
 ERROR Argument `werkzeug.wrappers.request.Request` is not assignable to parameter `request` with type `flask.wrappers.Request` in function `core.plugin.impl.trigger.PluginTriggerClient.invoke_trigger_event` [bad-argument-type]
    --> tests/unit_tests/core/plugin/impl/test_trigger_client.py:127:21
 ERROR Argument `werkzeug.wrappers.request.Request` is not assignable to parameter `request` with type `flask.wrappers.Request` in function `core.plugin.impl.trigger.PluginTriggerClient.invoke_trigger_event` [bad-argument-type]
@@ -4739,27 +4739,27 @@
 ERROR Argument `TestPluginDaemonEntities.test_credential_type_helpers._FakeCredential` is not assignable to parameter `self` with type `CredentialType` in function `core.plugin.entities.plugin_daemon.CredentialType.get_name` [bad-argument-type]
    --> tests/unit_tests/core/plugin/test_plugin_entities.py:283:40
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:992:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1019:16
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:993:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1020:16
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:994:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1021:16
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:995:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1022:16
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:996:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1023:16
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:997:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1024:16
 ERROR Object of class `NoneType` has no attribute `model` [missing-attribute]
-   --> tests/unit_tests/core/plugin/test_plugin_manager.py:998:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1025:16
 ERROR Object of class `NoneType` has no attribute `storage` [missing-attribute]
-    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1016:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1043:16
 ERROR Object of class `NoneType` has no attribute `storage` [missing-attribute]
-    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1017:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1044:16
 ERROR Object of class `NoneType` has no attribute `endpoint` [missing-attribute]
-    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1034:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1061:16
 ERROR Object of class `NoneType` has no attribute `node` [missing-attribute]
-    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1051:16
+    --> tests/unit_tests/core/plugin/test_plugin_manager.py:1078:16
 ERROR `in` is not supported between `Literal['Rate limit exceeded']` and `None` [not-iterable]
    --> tests/unit_tests/core/plugin/test_plugin_runtime.py:374:20
 ERROR `in` is not supported between `Literal['Invalid credentials']` and `None` [not-iterable]

@codecov

codecov Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.26087% with 62 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.33%. Comparing base (90d6046) to head (c317fb6).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
api/services/model_provider_service.py 86.48% 9 Missing and 6 partials ⚠️
web/service/use-plugins.ts 86.15% 9 Missing ⚠️
.../provider-added-card/lazy-custom-model-actions.tsx 75.86% 7 Missing ⚠️
...page/provider-added-card/provider-card-actions.tsx 91.95% 7 Missing ⚠️
api/services/workspace_service.py 89.36% 2 Missing and 3 partials ⚠️
...odel-provider-page/system-model-selector/index.tsx 84.00% 4 Missing ⚠️
web/service/use-common.ts 50.00% 4 Missing ⚠️
api/controllers/console/workspace/plugin.py 95.12% 1 Missing and 1 partial ⚠️
.../model-provider-page/model-selector/popup-item.tsx 84.61% 2 Missing ⚠️
.../model-provider-page/provider-added-card/index.tsx 80.00% 2 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #40118      +/-   ##
==========================================
+ Coverage   86.31%   86.33%   +0.02%     
==========================================
  Files        5251     5264      +13     
  Lines      294040   294973     +933     
  Branches    58893    59095     +202     
==========================================
+ Hits       253794   254662     +868     
- Misses      35320    35368      +48     
- Partials     4926     4943      +17     
Flag Coverage Δ
api 86.48% <92.65%> (+0.02%) ⬆️
cli 89.33% <ø> (ø)
dify-ui 93.49% <ø> (ø)
web 85.97% <93.57%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Jingyi-Dify Jingyi-Dify changed the title perf: optimize integrations initial loading feat: optimize integrations initial loading Aug 7, 2026
@Jingyi-Dify
Jingyi-Dify marked this pull request as ready for review August 7, 2026 01:50
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Aug 7, 2026
@hjlarry
hjlarry added this pull request to the merge queue Aug 7, 2026
Merged via the queue into main with commit 5dfd83e Aug 7, 2026
47 of 49 checks passed
@hjlarry
hjlarry deleted the codex/integrations-initial-load-performance-pr branch August 7, 2026 02:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants