fix(ocr): address code review feedback on multi-language OCR

- Fix _get_pipeline_ocr_language: remove redundant `or None` in step_config.get()
- Add Session type hint to _get_pipeline_ocr_language db parameter via TYPE_CHECKING
- Update process_with_ocr to use modern str | None syntax instead of Optional[str]
- Fix test_get_pipeline_ocr_language_explicit_pipeline_takes_priority: properly add
  sys_step to db_session so the system pipeline step is persisted in the test DB

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-08 21:49:49 +00:00
parent a2a4c6fc9a
commit 0b291995b9
3 changed files with 14 additions and 7 deletions
+3 -1
View File
@@ -977,13 +977,15 @@ def test_get_pipeline_ocr_language_explicit_pipeline_takes_priority(db_session):
db_session.add(sys_pipeline)
db_session.commit()
PipelineStep(
sys_step = PipelineStep(
pipeline_id=sys_pipeline.id,
position=0,
step_type="ocr",
config=json.dumps({"ocr_language": "eng"}),
enabled=True,
)
db_session.add(sys_step)
db_session.commit()
# Explicit pipeline with "fra"
explicit_pipeline = Pipeline(