← Back to Pull requests

feat: complete offline ingestion pipeline and reconcile repository truth #6

Closed
unknown closed this pull request without merging on Oct 01, 2026 16:04 UTC
View on GitHub
unknown unknown commented on Oct 01, 2026 12:03 UTC
Author

Summary


Completes the production offline ingestion pipeline tracked by Issue #2 and reconciles repository
documentation, config, contracts, and the consistency guard with that implementation. PR #5
(Phase 1 TXT slice) is merged into main; this branch is rebased onto main, so this PR contains
only the full-pipeline + reconciliation changes.

Implemented


  • Multi-format DocumentProcessor (TXT/PDF/DOCX/XLSX) with scanned-PDF OCR routing.

  • Deterministic structured chunking; TXT chunk identity stays compatible with Phase 1.

  • OCR/image pipeline with pluggable OCRProvider/ImageEmbedder and a deterministic visual-weight rule.

  • CLIP image embedder (512d) sharing the online preprocessing contract.

  • Epoch-aware Qdrant image writer; legacy image points remain retrievable in default.

  • Elasticsearch cosmetics_docs writer with explicit mapping and search_after pagination.

  • SQLite incremental source state (content-hash + permission-mask authoritative; committed after a successful snapshot).

  • Snapshot carry-forward, full rebuild, snapshot validator, and validate-then-seal CLI.

  • Lifecycle CLI: create-index, ingest, incremental-build, full-rebuild, seal-epoch

  • (legacy ingest-text preserved).
  • Framework-independent scheduler + config-driven Airflow DAG definitions.

  • Unified, review-gated feedback pipeline.

  • Cross-platform file lock adapter (POSIX/Windows).

  • Real BGE smoke harness (scripts/smoke_bge_ingestion.py, @pytest.mark.model_smoke).
  • Repository reconciliation


  • Image retrieval (sync + async CLIP) now respects the active knowledge_version_epoch exactly

  • like text retrieval; legacy missing-epoch points no longer leak into a non-default epoch.
  • seal-epoch runs the canonical snapshot validator (Qdrant text/image + Elasticsearch) before sealing.

  • create-index --recreate --yes now recreates Qdrant text/image collections and the ES index

  • consistently with its help text.
  • Config consumption audited: supported_extensions and scheduler enable flags are consumed and

  • validated; dead knobs removed; change detection documented as content-hash authoritative.
  • BM25 results expose the source-level doc_id/chunk_id so they merge with Qdrant in RRF.

  • offline/requirements-ocr.txt documents the optional PaddleOCR runtime boundary.

  • elasticsearch client pinned <9 to match the 8.x deployment server.

  • README, PRD annotations, CHANGELOG [Unreleased], data-admin/deployment/operations/pre-launch/user

  • guides, repository truth audit, and .env.example reconciled to code truth.
  • scripts/check_repo_consistency.py upgraded into a drift guard (offline CLI docs, stale-claim guard,

  • truth-audit row/status validation) with tests.
  • Issue #2 checklist reconciled (stays OPEN for external validation).
  • Review fixes (Codex)


    All eight automated review findings are addressed and their threads resolved:
    state-commit timing, incremental permission-mask detection, stale image-point clearing, unexpected
    document validation, BM25 doc_id, ES pagination, Airflow timeout args, and serializable DAG results.

    Validation


  • python3 -m pytest tests/ -q: 719 passed, 1 skipped

  • python3 -m pytest --collect-only -q: 720 collected

  • focused tests/offline/: 83 passed

  • ruff check . / ruff format --check .: pass (ruff 0.16.9)

  • python3 -m compileall -q .: pass

  • python3 scripts/check_repo_consistency.py: pass

  • git diff --check: pass

  • docker compose config (dummy secrets): pass
  • Real infrastructure integration


  • REAL: Qdrant (v1.12 container), Elasticsearch (8.11 container).

  • FAKE / deterministic: text embedder, image embedder, OCR, unit-test ES.

  • Real run: full build 5 docs/6 chunks/1 image → validate+seal ok; dense hits=5 (public auth=2,

  • restricted auth=4); epoch-isolated CLIP hit=1; ES docs=6; incremental carried=11, processed=1, validated.

    External model validation status


  • Real BGE smoke: EXTERNAL_MODEL_ASSET_REQUIRED (harness implemented; assets absent).

  • Real CLIP smoke: EXTERNAL_MODEL_ASSET_REQUIRED.

  • Real PaddleOCR smoke: NOT RUN (optional runtime not installed).

  • Real Airflow execution: NOT RUN (Airflow not installed).

  • Production benchmark/evaluation: NOT RUN (no reproducible artifact).
  • Known limitations


  • Deterministic test embedders are not real-model validation.

  • Airflow DAG registration is guard-tested only; default Compose does not run Airflow.

  • tests/contracts/offline_pipeline_contract.py preserves older planned interfaces and is not collected.
  • Issue #2 relationship


    Issue #2 remains OPEN. Code + deterministic tests are complete; real-model smoke, real Airflow
    execution, and production evaluation remain pending (or should be split into a validation issue).

    Diff: 594 lines (+445 / -149) across 7 files Reviewer: Xander-Xai Review duration: 240m
    All Vouch review confidence checks passed
    Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.50 · 594 lines diff across 7 files
    0.50
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.382
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #6"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 50% (MEDIUM) · Higher = larger blast radius
    50%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 19.8% · Safe to merge
    19.8%