Skip to content

fix(ingestion): migrate composite PaddleOCR layout selectors - #21236

Merged
yuzhichang merged 1 commit into
infiniflow:mainfrom
jay77721:fix/ingestion-paddleocr-layout-migration
Oct 20, 2026
Merged

yuzhichang merged 1 commit into
infiniflow:mainfrom
jay77721:fix/ingestion-paddleocr-layout-migration

Conversation

@jay77721

Copy link
Copy Markdown
Member

Summary

Python stored layout_recognize values as <model>@<instance>@<provider>. The Go parser-config migration treated a composite PaddleOCR selector as unsupported and returned an error, which rolled back the batch and made InitDB fail. A single legacy dataset row therefore prevented migrate_server from starting, and because the migration version is only written after a successful run, every restart failed on the same row.

The Go PDF dispatcher already handles this selector: it matches @paddleocr and resolves the tenant's PaddleOCR OCR model, and the composite's model/instance segments are never dispatch selectors there. The migration now converts the value to parse_method: "paddleocr" instead of rejecting it, aligning migration with runtime. The OCR selectors that genuinely have no dispatch path (mistral ocr, somark, opendataloader) still fail fast so they cannot silently fall through to generic VLM chat.

Related Issue

None.

Changes

  • internal/dao/ingestion_parser_config_migration.go: map composite @paddleocr references to parse_method: "paddleocr"; keep rejecting the three genuinely unsupported selectors.
  • internal/dao/ingestion_parser_config_migration_test.go: add the PaddleOCR conversion case and drop it from the rejection table.

Test Plan

  • bash build.sh --test ./internal/dao/... passes (internal/dao and internal/dao/transaction both ok).
  • The new table case covers [email protected]@PaddleOCR → {"Parser:HipSignsRhyme":{"pdf":{"parse_method":"paddleocr"}}}.
  • Verified that the reported row (knowledgebase.id=76af0e2a647711f1bb3a0d315b6417e3) no longer aborts the migration.

Python stored layout_recognize as "<model>@<instance>@<provider>". The
migration rejected a PaddleOCR composite and aborted InitDB, so a single
legacy row prevented the server from starting. The Go PDF dispatcher
already matches the provider spelling and resolves the tenant's PaddleOCR
OCR model, so the composite's model and instance segments never select a
model there. Convert the value to the parse method the dispatcher reads
instead of failing the migration.
@jay77721 jay77721 added database go Pull requests that update go code size:S This PR changes 10-29 lines, ignoring generated files. 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Oct 20, 2026
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d6309364-9cef-47c6-af1f-32caa066eb21
📥 Commits

Reviewing files that changed from the base of the PR and between 3a4cef0 and a60bbc6.

📒 Files selected for processing: 2
  • internal/dao/ingestion_parser_config_migration.go
  • internal/dao/ingestion_parser_config_migration_test.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.

📝 Walkthrough

The ingestion parser configuration migration now accepts paddleocr model references and maps them to the PDF paddleocr parse method. The migration test covers this mapping and removes a malformed-value expectation.

Changes: PaddleOCR migration

Layer / File(s) Summary
PaddleOCR mapping and validation
internal/dao/ingestion_parser_config_migration.go, internal/dao/ingestion_parser_config_migration_test.go
The converter maps paddleocr references to the PDF paddleocr parse method. The test adds a positive case for the PaddleOCR-VL model reference and removes the lowercase malformed-value case.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: zxlyyds100

Merge Risk: ⚪ Minimal · up to a60bb

The migration change is consistent with the dispatcher contract and has focused test coverage.

Pre-merge checks: Passed 5
Check name Status Explanation
Description check Passed The description includes a clear Summary section with background, the proposed fix, scope, changes, and test results. It also provides useful Related Issue, Changes, and Test Plan sections.
Title check Passed The title clearly and concisely describes the main change: migrating composite PaddleOCR layout selectors.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 2 files.
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.
  • 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 the parser's way
PaddleOCR joins the migration today
The PDF method gets its name
A test confirms the mapping came
Then hops away, content with the change

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

@yuzhichang
yuzhichang merged commit ac6876d into infiniflow:main Oct 20, 2026
26 checks passed
@jay77721
jay77721 deleted the fix/ingestion-paddleocr-layout-migration branch November 5, 2026 08:37
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. ci Continue Integration database go Pull requests that update go code size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants