Skip to content

fix: fix list dataset not include own - #44795

Merged
fatelei merged 2 commits into
langgenius:mainfrom
fatelei:cus-1749
Oct 26, 2026
Merged

fatelei merged 2 commits into
langgenius:mainfrom
fatelei:cus-1749

Conversation

@fatelei

@fatelei fatelei commented Oct 26, 2026

Copy link
Copy Markdown
Contributor

Important

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

Summary

fix https://linear.app/dify/issue/CUS-1749/用户看不到自己创建的知识库

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 verified the change and added or updated tests where meaningful regression risk justifies coverage.
  • I've updated the documentation accordingly.
  • I ran make lint && make type-check (backend) and vp staged (frontend) to appease the lint gods

@fatelei
fatelei requested a review from JohnJyong as a code owner October 26, 2026 07:11
@github-actions github-actions Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Oct 26, 2026
@github-actions

github-actions Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 78.80% 78.80% -0.00%
Strict coverage 78.48% 78.48% -0.00%
Typed symbols 74,323 74,320 -3
Untyped symbols 20,077 20,077 0
Modules 3915 3915 0

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.41%. Comparing base (aebe697) to head (e1278ec).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
api/services/knowledge/dataset_service.py 0.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #44795       +/-   ##
===========================================
+ Coverage   68.30%   89.41%   +21.10%     
===========================================
  Files        5832     5988      +156     
  Lines      347015   375593    +28578     
  Branches    74185    76152     +1967     
===========================================
+ Hits       237045   335831    +98786     
+ Misses     107718    33709    -74009     
- Partials     2252     6053     +3801     
Flag Coverage Δ
api 89.21% <77.77%> (+38.41%) ⬆️

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.

@github-actions github-actions Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:S This PR changes 10-29 lines, ignoring generated files. labels Oct 26, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-10-26 07:56:14.622673325 +0000
+++ /tmp/pyrefly_pr.txt	2026-10-26 07:56:04.502628897 +0000
@@ -5781,41 +5781,41 @@
 ERROR `None` is not subscriptable [unsupported-operation]
    --> tests/unit_tests/services/knowledge/metadata/test_application.py:434:20
 ERROR Object of class `NoneType` has no attribute `keyword_number` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1440:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1438:20
 ERROR Argument `str` is not assignable to parameter `data_source_type` with type `DataSourceType | SQLCoreOperations[DataSourceType]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1755:26
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1753:26
 ERROR Argument `str` is not assignable to parameter `indexing_status` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1761:25
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1759:25
 ERROR Argument `Literal['opendal']` is not assignable to parameter `storage_type` with type `StorageType` in function `tests.helpers.unit.model_factories.make_upload_file` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1778:22
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1776:22
 ERROR Argument `str` is not assignable to parameter `mode` with type `ProcessRuleMode | SQLCoreOperations[ProcessRuleMode]` in function `models.dataset.DatasetProcessRule.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1799:37
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:1797:37
 ERROR Argument `Literal['opendal']` is not assignable to parameter `storage_type` with type `StorageType` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2039:30
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2037:30
 ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2045:33
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2043:33
 ERROR `None` is not subscriptable [unsupported-operation]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2070:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2068:20
 ERROR Object of class `NoneType` has no attribute `name` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2071:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2069:20
 ERROR Argument `Literal['opendal']` is not assignable to parameter `storage_type` with type `StorageType` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2513:30
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2511:30
 ERROR Argument `Literal['account']` is not assignable to parameter `created_by_role` with type `CreatorUserRole` in function `models.model.UploadFile.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2519:33
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2517:33
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2598:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2596:20
 ERROR Object of class `NoneType` has no attribute `status` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2697:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2695:20
 ERROR Argument `list[PreProcessingRule] | None` is not assignable to parameter `obj` with type `Sized` in function `len` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2801:24
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2799:24
 ERROR `None` is not subscriptable [unsupported-operation]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2802:20
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:2800:20
 ERROR Object of class `NoneType` has no attribute `rules` [missing-attribute]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:3802:42
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:3800:42
 ERROR Argument `Literal['completed']` is not assignable to parameter `indexing_status` with type `IndexingStatus | SQLCoreOperations[IndexingStatus]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4237:25
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4235:25
 ERROR Argument `str` is not assignable to parameter `doc_form` with type `IndexStructureType | SQLCoreOperations[IndexStructureType]` in function `models.dataset.Document.__init__` [bad-argument-type]
-    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4238:18
+    --> tests/unit_tests/services/knowledge/test_dataset_service.py:4236:18
 ERROR Object of class `FromClause` has no attribute `create` [missing-attribute]
   --> tests/unit_tests/services/plugin/test_plugin_parameter_service.py:47:9
 ERROR Class member `DummyRetrieval.get_pipeline_templates` overrides parent class `PipelineTemplateRetrievalBase` in an inconsistent manner [bad-override]

@fatelei
fatelei added this pull request to the merge queue Oct 26, 2026
Merged via the queue into langgenius:main with commit a394d04 Oct 26, 2026
47 checks passed
@fatelei
fatelei deleted the cus-1749 branch October 26, 2026 08:13
xhdnoah added a commit to xhdnoah/dify that referenced this pull request Oct 28, 2026
Remove the include_own_datasets parameter and the conditional gate so
that maintainers always retain visibility of their own datasets when
RBAC is enabled, matching the main branch behavior.

The LTS branch predates the dataset application boundary refactor
(langgenius#41729, 2026-09-29) that introduced api/services/knowledge/datasets/.
The same logic is applied to the pre-refactor files instead.

Source commits on main:
- 4c830e8 (fix: fix list dataset not include own)
- e1278ec (chore: remove include_own_datasets param)
xhdnoah added a commit to xhdnoah/dify that referenced this pull request Oct 28, 2026
Remove the include_own_datasets parameter and the conditional gate so
that maintainers always retain visibility of their own datasets when
RBAC is enabled, matching the main branch behavior.

The LTS branch predates the dataset application boundary refactor
(langgenius#41729, 2026-09-29) that introduced api/services/knowledge/datasets/.
The same logic is applied to the pre-refactor files instead.

(cherry picked from commit a394d04)
xhdnoah added a commit to xhdnoah/dify that referenced this pull request Oct 28, 2026
Remove the include_own_datasets parameter and the conditional gate so
that maintainers always retain visibility of their own datasets when
RBAC is enabled, matching the main branch behavior.

The LTS branch predates the dataset application boundary refactor
(langgenius#41729, 2026-09-29) that introduced api/services/knowledge/datasets/.
The same logic is applied to the pre-refactor files instead.

Add two tests verifying that a maintainer can see their own dataset
even when accessible_dataset_ids is empty, mirroring the maintainer
visibility test added in the main branch PR.

(cherry picked from commit a394d04)
xhdnoah added a commit to xhdnoah/dify that referenced this pull request Oct 28, 2026
Remove the include_own_datasets parameter and the conditional gate so
that maintainers always retain visibility of their own datasets when
RBAC is enabled, matching the main branch behavior.

The LTS branch predates the dataset application boundary refactor
(langgenius#41729, 2026-09-29) that introduced api/services/knowledge/datasets/.
The same logic is applied to the pre-refactor files instead.

(cherry picked from commit a394d04)
xhdnoah added a commit to xhdnoah/dify that referenced this pull request Oct 28, 2026
Remove the include_own_datasets parameter and the conditional gate so
that maintainers always retain visibility of their own datasets when
RBAC is enabled, matching the main branch behavior.

The LTS branch predates the dataset application boundary refactor
(langgenius#41729, 2026-09-29) that introduced api/services/knowledge/datasets/.
The same logic is applied to the pre-refactor files instead.

The main branch PR added a maintainer-visibility test with an empty
accessible_dataset_ids list (test_list_visibility_restricts_even_requested_ids
in test_adapters.py, introduced by langgenius#44605 on 2026-10-23). LTS forked
on 2026-09-10 and never received that test. Add two equivalent tests
to test_dataset_service_dataset.py covering the boundary scenario
where accessible_dataset_ids is empty but the maintainer should still
see their own dataset — this is the exact regression that langgenius#44795
fixes and the LTS existing tests only cover the non-empty case.

(cherry picked from commit a394d04)
xhdnoah added a commit that referenced this pull request Oct 28, 2026
Remove the include_own_datasets parameter and the conditional gate so
that maintainers always retain visibility of their own datasets when
RBAC is enabled, matching the main branch behavior.

The LTS branch predates the dataset application boundary refactor
(#41729, 2026-09-29) that introduced api/services/knowledge/datasets/.
The same logic is applied to the pre-refactor files instead.

The main branch PR added a maintainer-visibility test with an empty
accessible_dataset_ids list (test_list_visibility_restricts_even_requested_ids
in test_adapters.py, introduced by #44605 on 2026-10-23). LTS forked
on 2026-09-10 and never received that test. Add two equivalent tests
to test_dataset_service_dataset.py covering the boundary scenario
where accessible_dataset_ids is empty but the maintainer should still
see their own dataset — this is the exact regression that #44795
fixes and the LTS existing tests only cover the non-empty case.

(cherry picked from commit a394d04)
@laipz8200 laipz8200 mentioned this pull request Nov 3, 2026
1 task done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants