Skip to content

fix(web): search all New RAG documents and restore scrolling - #44818

Merged
hyoban merged 5 commits into
mainfrom
fix/new-rag-document-search
Oct 27, 2026
Merged

hyoban merged 5 commits into
mainfrom
fix/new-rag-document-search

Conversation

@hyoban

@hyoban hyoban commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #44811.

The New RAG Documents page filters only loaded cursor pages and stops its automatic scan after 20 pages. Its content also lacks a bounded vertical scroller inside the knowledge-space shell, leaving lower rows and Load more at risk of clipping.

Send search and status filters through the Console API to KnowledgeFS and paginate matching results directly. Give the composed Documents surface its own bounded scroll area while retaining partial-result, retry, and selection safeguards.

Keep the toolbar mounted while results load, fail, or become empty, including when clearing a query opened from a direct link. Search and status controls remain usable independently of result loading. The toolbar owns upload and metadata actions for both populated and empty collections. Debounce API search input by 300 ms while keeping typing responsive; direct-link searches load immediately and clearing a query immediately restores the full list.

Refresh server-filtered membership when accepted task updates change queued/processing status. Invalidate status-filtered caches only within the current knowledge space, including inactive filters; ordinary progress updates do not refetch document lists. Terminal transitions retain the existing refresh path. Keep discovered active tasks in the space-scoped runtime when server-side filters remove their document rows and their tasks are outside loaded history, so retry-wait and terminal events still update filtered results. Release retained snapshots after terminal reconciliation.

Dependency: https://github.com/langgenius/knowledge-fs/pull/77 must be deployed first. It adds the server-side query/status contract and filters before pagination.

Validation

  • Documents unit suites: 412 tests passed across 13 files, including regressions for direct-link search focus, failed-filter recovery, queued/processing membership transitions, debounced API requests, and canceling a pending search when clearing and retyping. Transition tests also cover inactive cache invalidation, knowledge-space isolation, and avoiding refetches for percentage-only updates. Regressions also cover a task outside loaded history leaving the queued filter, returning through retry-wait, and completing with terminal reconciliation.
  • Chromium regression with the real KnowledgeSpaceShell: desktop 1280×720 and narrow 390×700 both passed wheel/keyboard scrolling and Load more interaction. These component tests use mocked API responses.
  • Targeted backend DTO/facade suite: 212 tests passed.
  • vp run -w check, vp staged, and Web type checks passed for the final changes. The full frontend check reported existing repository warnings and zero errors. Backend make lint and make type-check passed for the initial implementation; the follow-up changes are frontend-only.
  • The initial implementation was checked through the real local browser → Dify API → KnowledgeFS → PostgreSQL chain with 1,100 seeded records: direct match feat: use routes #1,060, 50 + 5 matching-result pages, late failed/queued/processing/disabled matches, combined filters, source-name search, empty-result recovery, and narrow-screen pagination. The follow-up interaction fixes were verified by the unit and Chromium suites above.

The local integration run uses synthetic records; it does not cover file ingestion/model processing or reproduce the unverified staging deployment. An old-code browser comparison was not performed.

Screenshots

No before/after screenshots attached. Desktop and narrow-screen behavior were checked in the real local browser and in the composed-shell browser regressions above.

Checklist

  • This change requires a documentation update, included: Dify Document — not required.
  • 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. — no separate documentation change required.
  • I ran make lint && make type-check (backend) and vp staged (frontend) to appease the lint gods

@github-actions github-actions Bot added size:L This PR changes 100-499 lines, ignoring generated files. web This relates to changes on the web. labels 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.96% 78.96% +0.00%
Strict coverage 78.64% 78.64% +0.00%
Typed symbols 74,697 74,702 +5
Untyped symbols 19,986 19,987 +1
Modules 3941 3941 0

@codecov

codecov Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.60440% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.45%. Comparing base (51e643f) to head (92f8018).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
api/controllers/console/knowledge_fs/resources.py 50.00% 1 Missing ⚠️
web/features/new-rag/documents/state/inputs.ts 50.00% 1 Missing ⚠️
.../features/new-rag/documents/tasks/runtime-state.ts 92.85% 1 Missing ⚠️
...rag/documents/tasks/use-document-status-refresh.ts 95.23% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #44818   +/-   ##
=======================================
  Coverage   89.45%   89.45%           
=======================================
  Files        5994     5995    +1     
  Lines      375954   376002   +48     
  Branches    76162    76174   +12     
=======================================
+ Hits       336321   336371   +50     
+ Misses      33610    33609    -1     
+ Partials     6023     6022    -1     
Flag Coverage Δ
api 89.27% <90.00%> (-0.01%) ⬇️
cli 94.27% <ø> (ø)
dify-ui 92.65% <ø> (ø)
web 89.47% <96.29%> (+<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.

@github-actions github-actions Bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Oct 26, 2026
@hyoban
hyoban marked this pull request as ready for review October 27, 2026 06:14
@hyoban
hyoban added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit e8b9a3c Oct 27, 2026
65 checks passed
@hyoban
hyoban deleted the fix/new-rag-document-search branch October 27, 2026 08:32
hyoban added a commit that referenced this pull request Oct 27, 2026
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
(cherry picked from commit e8b9a3c)
FFXN pushed a commit that referenced this pull request Oct 27, 2026
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
(cherry picked from commit e8b9a3c)
@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: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.

[Bug] New RAG Documents: long-list scrolling and dataset-wide search are incomplete

2 participants