Skip to content

refactor: migrate workflow queries to contracts#35799

Merged
lyzno1 merged 7 commits into
mainfrom
codex/refactor-workflow-comments-contracts
May 5, 2026
Merged

refactor: migrate workflow queries to contracts#35799
lyzno1 merged 7 commits into
mainfrom
codex/refactor-workflow-comments-contracts

Conversation

@lyzno1
Copy link
Copy Markdown
Member

@lyzno1 lyzno1 commented May 5, 2026

Summary

Workflow comments and collaboration contracts

  • add contract-backed oRPC coverage for workflow comments and collaboration-related API calls
  • migrate workflow comment read/write call sites from ad hoc service requests to contract-derived query and mutation helpers
  • replace manual collaboration polling with TanStack Query polling so the polling interval and cache lifecycle are owned by query options

App list infinite queries on the frontend

  • add the console app list contract and register it under consoleQuery.apps.list
  • remove the thin useAppList and useInfiniteAppList passthrough hooks from the app service layer
  • update app list, app nav, account page, and plugin app selector call sites to consume consoleQuery.apps.list directly
  • use oRPC infiniteOptions with TanStack Query for paginated app list reads, including explicit page params and next-page calculation at the call site
  • update related frontend tests to mock TanStack Query directly now that app list queries are no longer hidden behind service hooks

Backend app tag filter parsing

  • update the console app list controller to decode bracket-style tag_ids[n] query parameters into AppListQuery.tag_ids
  • keep the service-layer app filtering contract unchanged: app services still receive validated tag_ids as a list of UUID strings
  • add backend coverage for the new tag filter query boundary, including rejecting the old flat tag_ids shape

@dosubot dosubot Bot added size:XL This PR changes 500-999 lines, ignoring generated files. refactor labels May 5, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label May 5, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 97.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.81%. Comparing base (c0431ec) to head (3832957).

Files with missing lines Patch % Lines
api/controllers/console/app/app.py 91.30% 1 Missing and 1 partial ⚠️
.../components/workflow/hooks/use-workflow-comment.ts 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #35799      +/-   ##
==========================================
+ Coverage   85.78%   85.81%   +0.03%     
==========================================
  Files        4462     4461       -1     
  Lines      209069   209005      -64     
  Branches    39081    39069      -12     
==========================================
+ Hits       179352   179365      +13     
+ Misses      26554    26474      -80     
- Partials     3163     3166       +3     
Flag Coverage Δ
api 85.09% <91.30%> (+<0.01%) ⬆️
dify-ui 93.01% <ø> (ø)
web 86.78% <98.70%> (+0.06%) ⬆️

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

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 38.66% 38.65% -0.01%
Strict coverage 38.19% 38.18% -0.01%
Typed symbols 19,420 19,420 0
Untyped symbols 31,193 31,205 +12
Modules 2537 2537 0

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-05 12:35:56.704642704 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-05 12:35:43.600539056 +0000
@@ -1,7 +1,7 @@
 ERROR Object of class `Server` has no attribute `app` [missing-attribute]
    --> app_factory.py:132:5
 ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
-   --> controllers/console/app/app.py:553:13
+   --> controllers/console/app/app.py:573:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
   --> controllers/console/auth/email_register.py:75:108
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
@@ -1805,19 +1805,19 @@
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
    --> tests/unit_tests/controllers/console/app/test_annotation_security.py:256:35
 ERROR Object of class `ModuleType` has no attribute `console_ns` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:70:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
 ERROR Object of class `ModuleType` has no attribute `api` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:71:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:73:5
 ERROR Object of class `ModuleType` has no attribute `bp` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:74:5
 ERROR Object of class `ModuleType` has no attribute `app` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:78:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:80:5
 ERROR Argument `ModuleSpec | None` is not assignable to parameter `spec` with type `ModuleSpec` in function `_frozen_importlib.module_from_spec` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:107:36
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:109:36
 ERROR Object of class `NoneType` has no attribute `loader` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:110:12
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:112:12
 ERROR Object of class `object` has no attribute `exec_module` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:111:5
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:113:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_workflow.py:26:40
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-05 12:39:19.333072171 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-05 12:39:05.774160757 +0000
@@ -1,7 +1,7 @@
 ERROR Object of class `Server` has no attribute `app` [missing-attribute]
    --> app_factory.py:132:5
 ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
-   --> controllers/console/app/app.py:553:13
+   --> controllers/console/app/app.py:573:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
   --> controllers/console/auth/email_register.py:75:108
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
@@ -1805,19 +1805,19 @@
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
    --> tests/unit_tests/controllers/console/app/test_annotation_security.py:256:35
 ERROR Object of class `ModuleType` has no attribute `console_ns` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:70:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
 ERROR Object of class `ModuleType` has no attribute `api` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:71:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:73:5
 ERROR Object of class `ModuleType` has no attribute `bp` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:74:5
 ERROR Object of class `ModuleType` has no attribute `app` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:78:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:80:5
 ERROR Argument `ModuleSpec | None` is not assignable to parameter `spec` with type `ModuleSpec` in function `_frozen_importlib.module_from_spec` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:107:36
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:109:36
 ERROR Object of class `NoneType` has no attribute `loader` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:110:12
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:112:12
 ERROR Object of class `object` has no attribute `exec_module` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:111:5
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:113:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_workflow.py:26:40
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]

@lyzno1 lyzno1 enabled auto-merge May 5, 2026 13:18
@lyzno1 lyzno1 requested a review from hjlarry May 5, 2026 13:18
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-05 13:31:28.128246691 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-05 13:31:20.091259775 +0000
@@ -1,7 +1,7 @@
 ERROR Object of class `Server` has no attribute `app` [missing-attribute]
    --> app_factory.py:132:5
 ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
-   --> controllers/console/app/app.py:553:13
+   --> controllers/console/app/app.py:573:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
   --> controllers/console/auth/email_register.py:75:108
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
@@ -1805,19 +1805,19 @@
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
    --> tests/unit_tests/controllers/console/app/test_annotation_security.py:256:35
 ERROR Object of class `ModuleType` has no attribute `console_ns` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:70:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
 ERROR Object of class `ModuleType` has no attribute `api` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:71:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:73:5
 ERROR Object of class `ModuleType` has no attribute `bp` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:74:5
 ERROR Object of class `ModuleType` has no attribute `app` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:78:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:80:5
 ERROR Argument `ModuleSpec | None` is not assignable to parameter `spec` with type `ModuleSpec` in function `_frozen_importlib.module_from_spec` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:107:36
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:109:36
 ERROR Object of class `NoneType` has no attribute `loader` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:110:12
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:112:12
 ERROR Object of class `object` has no attribute `exec_module` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:111:5
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:113:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_workflow.py:26:40
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]

@lyzno1 lyzno1 force-pushed the codex/refactor-workflow-comments-contracts branch from e30ce93 to 3832957 Compare May 5, 2026 13:34
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 5, 2026

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-05-05 13:35:46.555835331 +0000
+++ /tmp/pyrefly_pr.txt	2026-05-05 13:35:37.358752296 +0000
@@ -1,7 +1,7 @@
 ERROR Object of class `Server` has no attribute `app` [missing-attribute]
    --> app_factory.py:132:5
 ERROR Object of class `App` has no attribute `access_mode` [missing-attribute]
-   --> controllers/console/app/app.py:553:13
+   --> controllers/console/app/app.py:573:13
 ERROR Argument `str | None` is not assignable to parameter `language` with type `str` in function `services.account_service.AccountService.send_email_register_email` [bad-argument-type]
   --> controllers/console/auth/email_register.py:75:108
 ERROR Object of class `MissingRouter` has no attribute `get` [missing-attribute]
@@ -1805,19 +1805,19 @@
 ERROR Object of class `int` has no attribute `lower` [missing-attribute]
    --> tests/unit_tests/controllers/console/app/test_annotation_security.py:256:35
 ERROR Object of class `ModuleType` has no attribute `console_ns` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:70:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
 ERROR Object of class `ModuleType` has no attribute `api` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:71:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:73:5
 ERROR Object of class `ModuleType` has no attribute `bp` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:72:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:74:5
 ERROR Object of class `ModuleType` has no attribute `app` [missing-attribute]
-  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:78:5
+  --> tests/unit_tests/controllers/console/app/test_app_response_models.py:80:5
 ERROR Argument `ModuleSpec | None` is not assignable to parameter `spec` with type `ModuleSpec` in function `_frozen_importlib.module_from_spec` [bad-argument-type]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:107:36
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:109:36
 ERROR Object of class `NoneType` has no attribute `loader` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:110:12
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:112:12
 ERROR Object of class `object` has no attribute `exec_module` [missing-attribute]
-   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:111:5
+   --> tests/unit_tests/controllers/console/app/test_app_response_models.py:113:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]
   --> tests/unit_tests/controllers/console/app/test_workflow.py:26:40
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `controllers.console.app.workflow._parse_file` [bad-argument-type]

Copy link
Copy Markdown
Contributor

@hjlarry hjlarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lyzno1 lyzno1 added this pull request to the merge queue May 5, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 5, 2026
Merged via the queue into main with commit 995c43f May 5, 2026
37 checks passed
@lyzno1 lyzno1 deleted the codex/refactor-workflow-comments-contracts branch May 5, 2026 15:04
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 refactor size:XL This PR changes 500-999 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