Repository navigation
feat(parser): require a text source for images when vision enhancement is off - #20839
Conversation
…t is off An image with OCR off and vision enhancement disabled carries no text and is dropped by the Tokenizer, indexing nothing silently. Reject that configuration at build time in ParserComponent.Check, block both switches in the parser form with a warning, and add a FormSchema cross-check so the dead combination cannot be saved.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to Image configurations consistently require OCR or vision enhancement, and no remaining merge-blocking behavior risk is established. Pre-merge checks |
|
Check() and maybeDispatchImage encoded the same OCR-selection truth table twice. Keep imageSetupRunsOCR as the single source so the validation and the dispatch cannot drift.
|
LGTM |
Summary
An image with OCR off and vision enhancement disabled carries no text, and the Tokenizer drops it, so the document indexes nothing without telling the user why. This PR makes that dead configuration hard to write by mistake: the backend rejects it at build time (which also covers direct API calls bypassing the form), and the frontend blocks both switches with a warning plus a save-time schema check.
Related Issue
None.
Changes
internal/ingestion/component/parser.go):ParserComponent.Check()returns an error when the image family has no text source (OCR off viaocr_enabledor legacyparse_method) whileenable_vision_enhancementis off. Shares theimageSetupRunsOCRhelper betweenCheck()and themaybeDispatchImageselection logic, so validation and dispatch cannot drift.image-form-fields.tsx,vision-form-fields.tsx): turning OCR off while enhancement is off (and vice versa) showsflow.imageTextSourceRequiredand refuses the toggle.schema.ts):FormSchema.superRefinerejects imageocr_enabled: false+ enhancement off at save time for normalized form values (the form always materializes the switch on load; legacyparse_methodshapes are still caught by backendCheck()).en.ts,zh.ts): newflow.imageTextSourceRequiredkey.parser_check_test.go/media_dispatch_test.goexpectations, newimage-form-fields.test.tsx, extendedschema.test.ts/vision-form-fields.test.tsx.Test Plan
All green locally: Go component/pipeline/task packages pass, 66 frontend tests pass, format/lint clean.