Skip to content

feat: refine snippet siderbar and support RBAC.#38134

Merged
JzoNgKVO merged 47 commits into
mainfrom
feat/refine-snippet-siderbar
Jun 29, 2026
Merged

feat: refine snippet siderbar and support RBAC.#38134
JzoNgKVO merged 47 commits into
mainfrom
feat/refine-snippet-siderbar

Conversation

@FFXN

@FFXN FFXN commented Jun 29, 2026

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

feat: refine snippet siderbar and support RBAC.

Screenshots

Before After
... ...

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 documentation accordingly.
  • I ran make lint && make type-check (backend) and cd web && pnpm exec vp staged (frontend) to appease the lint gods

JzoNgKVO and others added 30 commits June 22, 2026 12:12
@dosubot dosubot Bot added the size:XL This PR changes 500-999 lines, ignoring generated files. label Jun 29, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 29, 2026
@github-actions

github-actions Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-06-29 05:40:57.466468868 +0000
+++ /tmp/pyrefly_pr.txt	2026-06-29 05:40:45.871479368 +0000
@@ -7393,88 +7393,100 @@
    --> tests/unit_tests/services/test_snippet_service.py:258:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.sync_draft_workflow` [bad-argument-type]
    --> tests/unit_tests/services/test_snippet_service.py:261:17
+ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.update_workflow` [bad-argument-type]
+   --> tests/unit_tests/services/test_snippet_service.py:284:17
+ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.update_workflow` [bad-argument-type]
+   --> tests/unit_tests/services/test_snippet_service.py:285:17
+ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.update_workflow` [bad-argument-type]
+   --> tests/unit_tests/services/test_snippet_service.py:287:17
+ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.update_workflow` [bad-argument-type]
+   --> tests/unit_tests/services/test_snippet_service.py:304:17
+ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.update_workflow` [bad-argument-type]
+   --> tests/unit_tests/services/test_snippet_service.py:305:17
+ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.update_workflow` [bad-argument-type]
+   --> tests/unit_tests/services/test_snippet_service.py:307:17
 ERROR `() -> _SessionContext` is not assignable to attribute `_session_maker` with type `sessionmaker[Session]` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:339:30
+   --> tests/unit_tests/services/test_snippet_service.py:378:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.restore_published_workflow_to_draft` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:345:17
+   --> tests/unit_tests/services/test_snippet_service.py:384:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.restore_published_workflow_to_draft` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:347:17
+   --> tests/unit_tests/services/test_snippet_service.py:386:17
 ERROR `() -> _SessionContext` is not assignable to attribute `_session_maker` with type `sessionmaker[Session]` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:364:30
+   --> tests/unit_tests/services/test_snippet_service.py:403:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.restore_published_workflow_to_draft` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:370:21
+   --> tests/unit_tests/services/test_snippet_service.py:409:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.restore_published_workflow_to_draft` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:372:21
+   --> tests/unit_tests/services/test_snippet_service.py:411:21
 ERROR `() -> _SessionContext` is not assignable to attribute `_session_maker` with type `sessionmaker[Session]` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:393:30
+   --> tests/unit_tests/services/test_snippet_service.py:432:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.restore_published_workflow_to_draft` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:403:17
+   --> tests/unit_tests/services/test_snippet_service.py:442:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.restore_published_workflow_to_draft` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:405:17
+   --> tests/unit_tests/services/test_snippet_service.py:444:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_published_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:416:45
+   --> tests/unit_tests/services/test_snippet_service.py:455:45
 ERROR `() -> _SessionContext` is not assignable to attribute `_session_maker` with type `sessionmaker[Session]` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:425:30
+   --> tests/unit_tests/services/test_snippet_service.py:464:30
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_published_workflow_by_id` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:429:21
+   --> tests/unit_tests/services/test_snippet_service.py:468:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.publish_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:440:21
+   --> tests/unit_tests/services/test_snippet_service.py:479:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.publish_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:441:21
+   --> tests/unit_tests/services/test_snippet_service.py:480:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.publish_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:442:21
+   --> tests/unit_tests/services/test_snippet_service.py:481:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.publish_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:465:17
+   --> tests/unit_tests/services/test_snippet_service.py:504:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.publish_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:466:17
+   --> tests/unit_tests/services/test_snippet_service.py:505:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `account` with type `Account` in function `services.snippet_service.SnippetService.publish_workflow` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:467:17
+   --> tests/unit_tests/services/test_snippet_service.py:506:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.get_all_published_workflows` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:482:17
+   --> tests/unit_tests/services/test_snippet_service.py:521:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_all_published_workflows` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:483:17
+   --> tests/unit_tests/services/test_snippet_service.py:522:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.get_all_published_workflows` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:497:17
+   --> tests/unit_tests/services/test_snippet_service.py:536:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_all_published_workflows` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:498:17
+   --> tests/unit_tests/services/test_snippet_service.py:537:17
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.delete_snippet` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:516:52
+   --> tests/unit_tests/services/test_snippet_service.py:555:52
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.delete_snippet` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:516:69
+   --> tests/unit_tests/services/test_snippet_service.py:555:69
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService._delete_draft_variable_files` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:549:57
+   --> tests/unit_tests/services/test_snippet_service.py:588:57
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService._delete_draft_variable_files` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:549:74
+   --> tests/unit_tests/services/test_snippet_service.py:588:74
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService._delete_archived_workflow_run_files` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:569:64
+   --> tests/unit_tests/services/test_snippet_service.py:608:64
 ERROR `SimpleNamespace` is not assignable to attribute `_workflow_run_repo` with type `APIWorkflowRunRepository` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:585:34
+   --> tests/unit_tests/services/test_snippet_service.py:624:34
 ERROR `SimpleNamespace` is not assignable to attribute `_node_execution_service_repo` with type `DifyAPIWorkflowNodeExecutionRepository` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:586:44
+   --> tests/unit_tests/services/test_snippet_service.py:625:44
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_snippet_workflow_runs` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:589:54
+   --> tests/unit_tests/services/test_snippet_service.py:628:54
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/unit_tests/services/test_snippet_service.py:590:12
+   --> tests/unit_tests/services/test_snippet_service.py:629:12
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_snippet_workflow_run` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:590:53
+   --> tests/unit_tests/services/test_snippet_service.py:629:53
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_snippet_workflow_run_node_executions` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:591:69
+   --> tests/unit_tests/services/test_snippet_service.py:630:69
 ERROR Object of class `NoneType` has no attribute `id` [missing-attribute]
-   --> tests/unit_tests/services/test_snippet_service.py:595:9
+   --> tests/unit_tests/services/test_snippet_service.py:634:9
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_snippet_node_last_run` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:596:21
+   --> tests/unit_tests/services/test_snippet_service.py:635:21
 ERROR Argument `SimpleNamespace` is not assignable to parameter `workflow` with type `Workflow` in function `services.snippet_service.SnippetService.get_snippet_node_last_run` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:597:22
+   --> tests/unit_tests/services/test_snippet_service.py:636:22
 ERROR `SimpleNamespace` is not assignable to attribute `_node_execution_service_repo` with type `DifyAPIWorkflowNodeExecutionRepository` [bad-assignment]
-   --> tests/unit_tests/services/test_snippet_service.py:623:44
+   --> tests/unit_tests/services/test_snippet_service.py:662:44
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.get_snippet_workflow_run_node_executions` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:627:17
+   --> tests/unit_tests/services/test_snippet_service.py:666:17
 ERROR Object of class `FunctionType` has no attribute `assert_not_called` [missing-attribute]
-   --> tests/unit_tests/services/test_snippet_service.py:632:5
+   --> tests/unit_tests/services/test_snippet_service.py:671:5
 ERROR Argument `SimpleNamespace` is not assignable to parameter `session` with type `Session` in function `services.snippet_service.SnippetService.increment_use_count` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:639:48
+   --> tests/unit_tests/services/test_snippet_service.py:678:48
 ERROR Argument `SimpleNamespace` is not assignable to parameter `snippet` with type `CustomizedSnippet` in function `services.snippet_service.SnippetService.increment_use_count` [bad-argument-type]
-   --> tests/unit_tests/services/test_snippet_service.py:639:65
+   --> tests/unit_tests/services/test_snippet_service.py:678:65
 ERROR Missing required key `enable` for TypedDict `SummaryIndexSettingDict` [bad-typed-dict-key]
   --> tests/unit_tests/services/test_summary_index_service.py:98:93
 ERROR Key `a` is not defined in TypedDict `SummaryIndexSettingDict` [bad-typed-dict-key]

@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 51.48% 51.50% +0.01%
Strict coverage 51.00% 51.01% +0.01%
Typed symbols 30,824 30,844 +20
Untyped symbols 29,325 29,330 +5
Modules 2931 2931 0

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.70752% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.34%. Comparing base (d2216fe) to head (a11a282).

Files with missing lines Patch % Lines
...ippets/hooks/use-create-snippet-from-selection.tsx 91.55% 13 Missing ⚠️
api/controllers/console/tag/tags.py 86.36% 2 Missing and 1 partial ⚠️
web/app/components/main-nav/index.tsx 95.65% 1 Missing ⚠️
...nents/snippets/components/snippet-header/index.tsx 80.00% 1 Missing ⚠️
...pp/components/snippets/components/snippet-main.tsx 96.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #38134      +/-   ##
==========================================
+ Coverage   85.33%   85.34%   +0.01%     
==========================================
  Files        4964     4967       +3     
  Lines      258334   258421      +87     
  Branches    49023    49033      +10     
==========================================
+ Hits       220452   220562     +110     
+ Misses      33593    33569      -24     
- Partials     4289     4290       +1     
Flag Coverage Δ
api 85.49% <95.45%> (+<0.01%) ⬆️
dify-ui 94.93% <ø> (ø)
web 85.05% <94.53%> (+0.02%) ⬆️

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:
  • ❄️ 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.

@autofix-ci autofix-ci Bot requested a review from crazywoola as a code owner June 29, 2026 02:53
JzoNgKVO
JzoNgKVO previously approved these changes Jun 29, 2026
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Jun 29, 2026
@JzoNgKVO JzoNgKVO added this pull request to the merge queue Jun 29, 2026
Merged via the queue into main with commit ca2755e Jun 29, 2026
42 checks passed
@JzoNgKVO JzoNgKVO deleted the feat/refine-snippet-siderbar branch June 29, 2026 06:20
@FFXN FFXN added this to the 1.16.0 milestone Jul 1, 2026
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: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