fix(ci): restore green backend gate after engine pin
Ruff: declare adapter re-exports via __all__ in docling_extractor (F401) and sort the engine import block in the adapter test (I001). Pytest: engine-dependent tests now importorskip the pinned engine — CI installs light deps only and the engine repo is private, so they skip visibly there and run in Docker/dev envs with the engine. Verified: ruff clean; pytest 74 passed + 2 skipped without engine, 80 passed with the pinned engine v0.1.0 installed. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@@ -40,10 +40,13 @@ jobs:
|
||||
run: python -m compileall -q app scripts tests
|
||||
|
||||
- name: Pytest (unit only — heavy deps excluded)
|
||||
# test_chunker.py skips here: it needs the pinned document recognition
|
||||
# engine (private TeamHUB_Engines repo, no PAT secret configured).
|
||||
# It runs in the Docker image and in dev envs with the engine installed.
|
||||
run: |
|
||||
pytest tests/test_hashing.py tests/test_quality.py \
|
||||
tests/test_chunker.py tests/test_duplicates.py \
|
||||
tests/test_hybrid_search.py -q
|
||||
tests/test_hybrid_search.py -q -rs
|
||||
|
||||
- name: docker compose config
|
||||
run: docker compose config --quiet
|
||||
|
||||
@@ -15,6 +15,17 @@ from teamhub_document_recognition_engine import extract as _engine_extract
|
||||
|
||||
from app.config import settings
|
||||
|
||||
# Re-exported engine models: chunker, table/figure processors and tests import
|
||||
# them from this adapter instead of depending on the engine package directly.
|
||||
__all__ = [
|
||||
"ExtractedBlock",
|
||||
"ExtractedFigure",
|
||||
"ExtractedPage",
|
||||
"ExtractedTable",
|
||||
"ExtractionResult",
|
||||
"extract",
|
||||
]
|
||||
|
||||
|
||||
def extract(pdf_path: Path) -> ExtractionResult:
|
||||
return _engine_extract(pdf_path, docling_ocr_enabled=settings.docling_ocr_enabled)
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from app.ingestion.chunker import chunk_extraction
|
||||
from app.ingestion.docling_extractor import (
|
||||
import pytest
|
||||
|
||||
# CI installs light deps only; the pinned engine repo is private (no PAT), so
|
||||
# these tests run wherever the engine is installed (Docker image, dev env) and
|
||||
# skip visibly elsewhere. See app/ingestion/ENGINE_SOURCE.md.
|
||||
pytest.importorskip("teamhub_document_recognition_engine")
|
||||
|
||||
from app.ingestion.chunker import chunk_extraction # noqa: E402
|
||||
from app.ingestion.docling_extractor import ( # noqa: E402
|
||||
ExtractedBlock,
|
||||
ExtractedFigure,
|
||||
ExtractedPage,
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
# Skip cleanly where the pinned engine is not installed (e.g. light-deps CI);
|
||||
# see app/ingestion/ENGINE_SOURCE.md for the focused verification command.
|
||||
pytest.importorskip("teamhub_document_recognition_engine")
|
||||
|
||||
|
||||
def test_legacy_ocr_adapter_reexports_engine_model_and_settings(monkeypatch, tmp_path: Path) -> None:
|
||||
from teamhub_document_recognition_engine import OcrResult as EngineOcrResult
|
||||
@@ -34,6 +40,8 @@ def test_legacy_ocr_adapter_reexports_engine_model_and_settings(monkeypatch, tmp
|
||||
def test_legacy_docling_adapter_reexports_engine_models_and_settings(monkeypatch, tmp_path: Path) -> None:
|
||||
from teamhub_document_recognition_engine import (
|
||||
ExtractedBlock as EngineExtractedBlock,
|
||||
)
|
||||
from teamhub_document_recognition_engine import (
|
||||
ExtractionResult as EngineExtractionResult,
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user