Skip to content

Fix dataset parsing status counts - #16986

Closed
zcxGGmu wants to merge 1 commit into
infiniflow:mainfrom
zcxGGmu:fix/issue-16855-dataset-parsing-status
Closed

zcxGGmu wants to merge 1 commit into
infiniflow:mainfrom
zcxGGmu:fix/issue-16855-dataset-parsing-status

Conversation

@zcxGGmu

@zcxGGmu zcxGGmu commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #16855.

This PR wires include_parsing_status=true into the dataset list service response. When requested, the service now batches parsing-status aggregation for returned datasets and merges zero-filled status counts into each item.

Changes

  • Respect boolean and string include_parsing_status request values.
  • Batch-load parsing status counts for returned dataset IDs.
  • Default missing status buckets to zero for consistent API responses.
  • Add a focused regression test for the list response merge.

Tests

  • uv run python -m pytest test/unit_test/api/apps/services/test_dataset_api_service_list.py -q
  • uv run python -m pytest test/unit_test/api/db/services/test_document_service_get_parsing_status.py -q
  • uv run ruff check api/apps/services/dataset_api_service.py test/unit_test/api/apps/services/test_dataset_api_service_list.py
  • git diff --check

@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. 🌈 python Pull requests that update Python code 🐞 bug Something isn't working, pull request that fix bug. 🧪 test Pull requests that update test cases. labels Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

list_datasets now optionally includes parsing status counts by dataset, using zero values when no status data exists. A unit test verifies the status lookup arguments and merged results.

Changes

Dataset parsing status

Layer / File(s) Summary
Parsing status augmentation
api/apps/services/dataset_api_service.py
list_datasets normalizes include_parsing_status, retrieves counts for returned knowledgebase IDs, and merges status fields into each dataset entry.
Parsing status validation
test/unit_test/api/apps/services/test_dataset_api_service_list.py
Stubbed dependencies and deterministic data verify the lookup IDs, returned counts, and zero-filled fields for datasets without status data.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

  • infiniflow/ragflow#16913: Updates dataset listing to retrieve and merge parsing status counts with unit test coverage.

Poem

A bunny checks each dataset row,
And counts the statuses as they grow.
Missing counts become zeros bright,
Tests hop along to make them right. 🐇

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: fixing dataset parsing status counts.
Description check ✅ Passed The description includes the required Summary section and adequately explains the change and tests.
Linked Issues check ✅ Passed The changes address #16855 by returning integer parsing counts with zero defaults when include_parsing_status is requested.
Out of Scope Changes check ✅ Passed The PR stays focused on the reported bug and adds a targeted regression test, with no unrelated code changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/apps/services/dataset_api_service.py`:
- Around line 422-434: Expose the API contract’s unstarted_count and
failed_count fields instead of the internal unstart_count and fail_count keys.
In dataset_api_service.py lines 422-434, map both names in empty_status and when
merging parsing_status_by_kb; update
test/unit_test/api/apps/services/test_dataset_api_service_list.py lines 29 and
179-186 so _STATUS_FIELDS and output assertions use the corrected API keys.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4a3a2a59-129d-447b-b3a0-821144fedd64

📥 Commits

Reviewing files that changed from the base of the PR and between 5ab424c and 1fa2af6.

📒 Files selected for processing (2)
  • api/apps/services/dataset_api_service.py
  • test/unit_test/api/apps/services/test_dataset_api_service_list.py

@yuzhichang

Copy link
Copy Markdown
Member

Duplicated with #16913

@yuzhichang yuzhichang closed this Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. 🌈 python Pull requests that update Python code size:S This PR changes 10-29 lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Parsing status counts are null when include_parsing_status=true in API 'list datasets'

3 participants