Skip to content

Fix: The dataset retrieval test returned an incorrect total number. - #15901

Merged
wangq8 merged 2 commits into
infiniflow:mainfrom
cike8899:fix-search-required
Jun 10, 2026
Merged

wangq8 merged 2 commits into
infiniflow:mainfrom
cike8899:fix-search-required

Conversation

@cike8899

Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Fix: The dataset retrieval test returned an incorrect total number.

Type of change

  • Bug Fix (non-breaking change which fixes an issue)

@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 10, 2026
@cike8899 cike8899 added the ci Continue Integration label Jun 10, 2026
@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4e7c030b-6d1e-4b7f-ad46-5a215adb4ded

📥 Commits

Reviewing files that changed from the base of the PR and between dcf623d and 0b7e9c9.

📒 Files selected for processing (3)
  • api/apps/services/dataset_api_service.py
  • web/src/hooks/use-knowledge-request.ts
  • web/src/pages/dataset/testing/index.tsx
💤 Files with no reviewable changes (1)
  • api/apps/services/dataset_api_service.py

📝 Walkthrough

Walkthrough

The pull request removes the ranks["total"] field from the dataset search API response and implements automatic pagination reset in the frontend retrieval hook. When a user changes the question or pagination parameters, the system resets to page 1 before executing the retrieval query. A TODO comment is added to the component state initialization for future refactoring.

Changes

Dataset Retrieval Pagination Reset

Layer / File(s) Summary
API response field removal
api/apps/services/dataset_api_service.py
The search_datasets response builder removes the ranks["total"] assignment, streamlining the response structure by eliminating redundant total computation.
Pagination reset in retrieval hook
web/src/hooks/use-knowledge-request.ts
The useTestRetrieval hook enforces page 1 on initial retrieval via the refetch callback, and the onPaginationChange handler resets to page 1 whenever pageSize changes or when a question is present, ensuring pagination always starts fresh.
Component pagination state TODO marker
web/src/pages/dataset/testing/index.tsx
A TODO comment marks the count state initialization for potential future refactoring of conditional layout rendering logic.

🎯 2 (Simple) | ⏱️ ~8 minutes

🐰 Pagination hops back to page one so fast,
No remnants of totals forever shall last,
The retrieval flows clean, a quest fresh and bright,
Reset on each question—now that's done right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the main bug being fixed: incorrect total number returned by dataset retrieval test, matching the changes across backend and frontend code.
Description check ✅ Passed The description matches the template structure with both required sections completed: problem statement and type of change (bug fix) are clearly identified.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cike8899
cike8899 marked this pull request as draft June 10, 2026 07:37
@cike8899
cike8899 marked this pull request as ready for review June 10, 2026 07:38
@cike8899
cike8899 requested a review from wangq8 June 10, 2026 07:42
@codecov

codecov Bot commented Jun 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (478c984) to head (0b7e9c9).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15901   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ 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.

@wangq8
wangq8 merged commit aafe6c5 into infiniflow:main Jun 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants