Skip to content

Refactor: deco document upload_and_parse API#14366

Merged
yingfeng merged 8 commits into
infiniflow:mainfrom
xugangqiang:doc-upload-and-parse
Apr 27, 2026
Merged

Refactor: deco document upload_and_parse API#14366
yingfeng merged 8 commits into
infiniflow:mainfrom
xugangqiang:doc-upload-and-parse

Conversation

@xugangqiang
Copy link
Copy Markdown
Contributor

@xugangqiang xugangqiang commented Apr 24, 2026

What problem does this PR solve?

remove unused "POST /v1/document/upload_and_parse"

Type of change

  • Refactoring

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Removed the POST /upload_and_parse route and its multipart upload handling from the API, and deleted the doc_upload_and_parse helper from the document service, removing the end-to-end upload→parse→chunk→embed→insert pipeline and associated tests.

Changes

Cohort / File(s) Summary
API Endpoint
api/apps/document_app.py
Deleted the upload_and_parse POST route handler and removed its multipart/form-data handling and the doc_upload_and_parse import.
Service Layer
api/db/services/document_service.py
Removed the module-level doc_upload_and_parse(conversation_id, file_objs, user_id) function and related parsing/embedding/mind-map imports; eliminated end-to-end upload/parse/embed/insert logic.
Tests
test/testcases/test_web_api/test_document_app/test_upload_documents.py
Removed unit tests that exercised multipart upload validation and the stubbed successful parse flow for upload_and_parse.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

☯️ refactor

Suggested reviewers

  • yingfeng
  • yuzhichang
  • wangq8
  • JinHai-CN

Poem

🐰 I hopped through bytes both quick and spry,
One route folded tidy — waved goodbye.
Chunks once bustling now rest in shade,
I nibble logs and lend a paw to aid.
Hooray for clean paths — onward I pry.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

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.
Title check ❓ Inconclusive The title 'Refactor: deco document upload_and_parse API' is vague and uses abbreviations ('deco') that are unclear; it doesn't clearly convey what is being removed or refactored. Clarify the title to explicitly state the main action (e.g., 'Remove unused POST /upload_and_parse API endpoint') for better clarity.
✅ Passed checks (3 passed)
Check name Status Explanation
Description check ✅ Passed The description provides the core information required by the template: a brief problem statement and marked type of change (Refactoring). While minimal, it adequately addresses the template requirements.
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.

@xugangqiang xugangqiang self-assigned this Apr 24, 2026
@xugangqiang xugangqiang added the ci Continue Integration label Apr 24, 2026
@xugangqiang xugangqiang marked this pull request as ready for review April 24, 2026 13:31
@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@api/apps/document_app.py`:
- Line 28: The frontend still defines and uses the UploadAndParse enum value
'upload_and_parse' in web/src/hooks/use-chat-request.ts (symbol: UploadAndParse
and its mutation config) while the backend endpoint/doc_upload_and_parse helper
was removed; remove the UploadAndParse enum and any mutation/config branches
that reference 'upload_and_parse', or replace those branches to call the
new/available backend endpoint or a client-side fallback, ensuring no HTTP
requests are emitted using the string 'upload_and_parse' so the frontend no
longer triggers 404s.
🪄 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: 7e6512ae-1caa-40f5-aead-43816819536f

📥 Commits

Reviewing files that changed from the base of the PR and between 2508960 and f3ec61e.

📒 Files selected for processing (3)
  • api/apps/document_app.py
  • api/db/services/document_service.py
  • test/testcases/test_web_api/test_document_app/test_upload_documents.py
💤 Files with no reviewable changes (1)
  • test/testcases/test_web_api/test_document_app/test_upload_documents.py

Comment thread api/apps/document_app.py
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 24, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.30%. Comparing base (c1941fd) to head (11798a4).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14366   +/-   ##
=======================================
  Coverage   95.30%   95.30%           
=======================================
  Files          10       10           
  Lines         703      703           
  Branches      112      112           
=======================================
  Hits          670      670           
  Misses         16       16           
  Partials       17       17           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@api/apps/document_app.py`:
- Around line 27-29: Remove the stale and duplicate imports: eliminate the
import of doc_upload_and_parse (it no longer exists) and remove the duplicated
DocumentService import so DocumentService is imported only once; keep the needed
duplicate_name import and a single "from api.db.services.document_service import
DocumentService" statement and run ruff to verify no F811/F401 issues.
🪄 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: 67e900eb-78a6-402d-95de-cfb2accdaefb

📥 Commits

Reviewing files that changed from the base of the PR and between f3ec61e and dec054c.

📒 Files selected for processing (2)
  • api/apps/document_app.py
  • test/testcases/test_web_api/test_document_app/test_upload_documents.py
💤 Files with no reviewable changes (1)
  • test/testcases/test_web_api/test_document_app/test_upload_documents.py

Comment thread api/apps/document_app.py Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
api/db/services/document_service.py (1)

983-1016: ⚠️ Potential issue | 🔴 Critical

Restore missing import for MAXIMUM_TASK_PAGE_NUMBERqueue_raptor_o_graphrag_tasks will fail at runtime.

Lines 999–1000 reference MAXIMUM_TASK_PAGE_NUMBER, but the constant is not imported. This causes NameError whenever the function is invoked. The constant is defined in common/constants.py and should be imported alongside the other constants at the top of the file.

Proposed fix
-from common.constants import ParserType, StatusEnum, TaskStatus, SVR_CONSUMER_GROUP_NAME
+from common.constants import (
+    ParserType,
+    StatusEnum,
+    TaskStatus,
+    SVR_CONSUMER_GROUP_NAME,
+    MAXIMUM_TASK_PAGE_NUMBER,
+)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@api/db/services/document_service.py` around lines 983 - 1016, The function
queue_raptor_o_graphrag_tasks references MAXIMUM_TASK_PAGE_NUMBER but that
constant is not imported, causing a NameError; add an import for
MAXIMUM_TASK_PAGE_NUMBER from common.constants alongside the other constants at
the top of the file (where other constants/imports are grouped) so
queue_raptor_o_graphrag_tasks can use it at lines that set from_page/to_page.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@api/db/services/document_service.py`:
- Around line 983-1016: The function queue_raptor_o_graphrag_tasks references
MAXIMUM_TASK_PAGE_NUMBER but that constant is not imported, causing a NameError;
add an import for MAXIMUM_TASK_PAGE_NUMBER from common.constants alongside the
other constants at the top of the file (where other constants/imports are
grouped) so queue_raptor_o_graphrag_tasks can use it at lines that set
from_page/to_page.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 66fde615-e019-4f0b-a6a3-a68fa9457991

📥 Commits

Reviewing files that changed from the base of the PR and between 0bc2284 and 04d35c5.

📒 Files selected for processing (2)
  • api/apps/document_app.py
  • api/db/services/document_service.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • api/apps/document_app.py

@yingfeng yingfeng merged commit 343bda1 into infiniflow:main Apr 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants