Skip to content

fix(knowledge): reflect reranking model availability on dataset cards - #43853

Open
Redestiny wants to merge 5 commits into
langgenius:mainfrom
Redestiny:fix/dataset-reranking-availability-43847
Open

Redestiny wants to merge 5 commits into
langgenius:mainfrom
Redestiny:fix/dataset-reranking-availability-43847

Conversation

@Redestiny

@Redestiny Redestiny commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #43847. Dataset cards now reflect both embedding and reranking model availability, so a missing or disabled required reranker produces the Unavailable badge and corresponding card/menu state. Responses expose reranking_available using active models in the current workspace.

Weighted-score hybrid search, disabled reranking, economy indexing, and external knowledge bases do not require a reranker lookup. Normalize legacy provider IDs on reads without rewriting stored retrieval configuration; incomplete configuration is unavailable.

Synchronize with main at b531dcbe, preserving current dataset visibility, response contracts, card interactions, and tag management. Extend the existing stored-configuration regression to cover an empty provider name.

Validation

  • Dataset adapter/application, field, and Service API suites: 162 passed.
  • Dataset card and tag-management unit suites: 98 passed across 13 files.
  • Scoped backend Ruff and Pyrefly checks, full Web type checking, scoped frontend formatting/lint, and git diff --check: passed.
  • API specs, Markdown documentation, and TypeScript/Zod contracts regenerated successfully; generated output matches the merged contracts.
  • Codecov reports 98.08% patch coverage, with one partially covered defensive non-dictionary configuration branch; no assertion was added solely to raise the percentage. Empty provider configuration and stored-data preservation are verified through the real adapter.
  • Browser Mode remains unverified locally because Playwright's Chromium download failed. Repository Vite task execution is blocked by the environment's seccomp supervisor, and whole-repository type-aware lint exceeded its memory limit. Updated-head Main CI Pipeline on 24e92355: passed. Full backend make lint also passed.

AI-assisted implementation and validation with Codex.

@ghfind-review ghfind-review Bot added the review: medium ghfind author score; see https://ghfind.com label Oct 11, 2026
@github-actions github-actions Bot added web This relates to changes on the web. size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 11, 2026
Preserve the reranking model regression tests and the repository-backed app query fixture from main.
@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Diff

base → PR
--- /tmp/pyrefly_base.txt	2026-11-03 03:39:56.026937339 +0000
+++ /tmp/pyrefly_pr.txt	2026-11-03 03:39:43.466841659 +0000
@@ -5665,9 +5665,9 @@
 ERROR Object of class `NoneType` has no attribute `storage_key` [missing-attribute]
    --> tests/unit_tests/factories/file_factory/test_builders.py:196:12
 ERROR Object of class `Dataset` has no attribute `embedding_available` [missing-attribute]
-   --> tests/unit_tests/fields/test_dataset_fields.py:228:5
+   --> tests/unit_tests/fields/test_dataset_fields.py:236:5
 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/fields/test_dataset_fields.py:299:25
+   --> tests/unit_tests/fields/test_dataset_fields.py:307:25
 ERROR Cannot set item in `OrderedDict[str, bool | list[str] | str]` [unsupported-operation]
    --> tests/unit_tests/fields/test_workflow_draft_variable_fields.py:142:47
 ERROR Object of class `Subscription` has no attribute `_start_if_needed` [missing-attribute]

@github-actions

github-actions Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

Pyrefly Type Coverage

Metric Base PR Delta
Type coverage 83.00% 83.01% +0.00%
Strict coverage 82.66% 82.66% +0.00%
Typed symbols 85,598 85,624 +26
Untyped symbols 17,603 17,603 0
Modules 4373 4373 0

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.07692% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 89.80%. Comparing base (ac0f594) to head (24e9235).
⚠️ Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
api/services/knowledge/datasets/adapters.py 93.75% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main   #43853       +/-   ##
===========================================
+ Coverage   68.81%   89.80%   +20.98%     
===========================================
  Files        6103     6240      +137     
  Lines      368940   391005    +22065     
  Branches    77825    79312     +1487     
===========================================
+ Hits       253897   351123    +97226     
+ Misses     112233    33782    -78451     
- Partials     2810     6100     +3290     
Flag Coverage Δ
api 89.64% <97.61%> (+37.30%) ⬆️
cli 94.26% <ø> (ø)
dify-ui 92.45% <ø> (+0.06%) ⬆️
web 89.80% <100.00%> (+<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.

@Redestiny
Redestiny requested a review from hyoban as a code owner October 20, 2026 17:04

Redestiny commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor Author

Updated against main in 24e92355, preserving current dataset visibility and card/menu behavior. Revalidated 162 backend tests and 98 dataset-card/tag-management unit tests, regenerated API contracts/docs, and passed backend make lint, backend/frontend typing, and scoped frontend lint. The stored-configuration regression also covers an empty reranking provider. Updated-head Main CI passed: https://github.com/langgenius/dify/actions/runs/41573176658 . Codecov reports 98.08% patch coverage with one partially covered defensive non-dictionary branch; the PR description records that diagnostic and the unavailable local browser check. Ready for maintainer review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review: medium ghfind author score; see https://ghfind.com size:L This PR changes 100-499 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.

[Bug] Knowledge base is not marked unavailable when its configured reranking model is unavailable

1 participant