Skip to content

Reject invalid parsers before starting batch reparsing - #22936

Open
ZKunZhang wants to merge 1 commit into
infiniflow:mainfrom
ZKunZhang:fix/22188-batch-reparse
Open

ZKunZhang wants to merge 1 commit into
infiniflow:mainfrom
ZKunZhang:fix/22188-batch-reparse

Conversation

@ZKunZhang

Copy link
Copy Markdown
Contributor

Refs #22188. Split from #22935.

Changes

  • Reject retired built-in parser IDs when creating or updating datasets.
  • Validate every eligible document's parser before starting a batch reparse. An invalid parser later in the batch cannot clear earlier documents' chunks or replace their ingestion tasks.
  • Document how to reconfigure existing datasets and documents that use the retired parser.

Validation

  • Ran the chunk, document, and dataset Go unit tests with CGO disabled.
  • Regression tests cover an invalid parser after a valid document in the batch and verify the existing counters and completed task survive.

@coderabbitai

coderabbitai Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Dataset writes and parse entry points reject the retired knowledge_graph parser ID. Document parser validation runs before parsing or clearing prior parse state. Regression tests verify rejection and state preservation.

Changes: Retired parser validation

Layer / File(s) Summary
Dataset parser resolution and migration guidance
internal/service/dataset/helpers.go, internal/service/dataset/create_test.go, docs/administrator/upgrade_and_migration/upgrade_from_v0_to_v1.md
Dataset parser IDs now follow builtin registry lookup, and create or update rejects the retired knowledge_graph parser. The upgrade guide explains how to select a supported parser and configure knowledge graph compilation separately.
Pre-parse validation
internal/service/document/document_parse.go, internal/service/document/document_ingest.go, internal/service/chunk/chunk.go, internal/service/document/document_test.go, internal/service/chunk/chunk_test.go
ValidateDocumentParser accepts documents with a non-empty PipelineID; otherwise, it checks the trimmed parser ID against the default registry. Document and chunk parse paths reject invalid parser IDs before starting parsing or clearing prior state. Tests verify rejection and preservation of existing data and tasks.

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

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • infiniflow/ragflow#22188 — The issue describes acceptance of the retired parser ID and parse failures after existing chunks are deleted; this PR adds rejection and pre-parse validation.

Possibly related PRs

Suggested labels: go

Suggested reviewers: xugangqiang, buua436, qinling0210, yannnnnnny

Merge Risk: Minimal · up to 181be

This change rejects the retired knowledge_graph parser when datasets are created or updated and before batch reparsing starts. A bad parser later in a batch can no longer clear earlier documents' chunks or replace their ingestion tasks. No concrete merge-blocking risk was found, and regression tests cover the new behavior.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "Reject invalid parsers before starting batch reparsing" matches the main change. The PR rejects retired parser IDs during dataset writes and validates each document's parser before a batch …
Description check Passed The description follows the repository template's intent. It has a Changes section and a Validation section, and it explains the background with a reference to #22188 and the split from #22935. The te…
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.
Full details: Title check

Explanation

The title "Reject invalid parsers before starting batch reparsing" matches the main change. The PR rejects retired parser IDs during dataset writes and validates each document's parser before a batch reparse starts, so an invalid parser cannot clear earlier documents' chunks. The title is short, specific, and uses the actual terms from the changeset.

Full details: Description check

Explanation

The description follows the repository template's intent. It has a Changes section and a Validation section, and it explains the background with a reference to #22188 and the split from #22935. The template calls for a Summary heading, and the description does not include one. Its opening lines (Refs #22188, Split from #22935) carry the purpose, so the content is mostly complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit checks each parser’s name
Before the chunks begin their game
If knowledge_graph is in the queue
The parse stops before state is new
Old tasks and counters stay in place
Then hops away at a steady pace

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 1b6602bb-2680-480c-ac1b-aad779940d9e
Commits

Reviewing files that changed from the base of the PR and between 70ed4c9 and 181be36.

Files selected for processing: 8

  • docs/administrator/upgrade_and_migration/upgrade_from_v0_to_v1.md
  • internal/service/chunk/chunk.go
  • internal/service/chunk/chunk_test.go
  • internal/service/dataset/create_test.go
  • internal/service/dataset/helpers.go
  • internal/service/document/document_ingest.go
  • internal/service/document/document_parse.go
  • internal/service/document/document_test.go
Files with no reviewable changes: 1

  • internal/service/dataset/helpers.go

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@wangq8
wangq8 requested a review from xugangqiang November 28, 2026 09:01
@xugangqiang xugangqiang assigned buua436 and unassigned xugangqiang Nov 30, 2026
@xugangqiang
xugangqiang requested review from buua436 and removed request for xugangqiang November 30, 2026 03:05
@xugangqiang

Copy link
Copy Markdown
Collaborator

@buua436 pls help to review compiler PR

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants