feat(ingestion): add opt-in best-effort document admission

Freeze temporary partial-extraction admission in new uploads. Bypass manual approval, retain recognition warnings, and accept ambiguous legal references during bounded chunking. Preserve strict defaults, immutable evidence and atomic publication. Expose effective policy and safe failure categories with regression coverage.
This commit is contained in:
amirhosein mazaheri
2026-10-13 14:09:21 +03:30
parent 18e595ac93
commit 90a164f5a6
18 changed files with 301 additions and 31 deletions
+37
View File
@@ -2241,3 +2241,40 @@ identical later search args coalesce, different queries discard the old topic.
See API/implementation retained-search amendment and
`tests/unit/test_voice_retained_search.py` plus PostgreSQL runtime cases in
`tests/integration/test_voice_evidence_reuse.py`. No persistence migration.
## Temporary best-effort ingestion admission (2026-10-13)
User-authorized `INGEST_ALLOW_PARTIAL_EXTRACTION=true` is frozen in NEW upload
profiles as `extraction.allow_partial_extraction`. Default false and missing
legacy fields retain strict admission; existing profiles/digests are not rewritten.
This temporary mode bypasses PDF visual, OCR and factual manual approval without
fabricating reviewer identities or annotations. Usable recognition with incomplete
regions, warnings or unknown glyphs proceeds to chunking/embedding. Warnings remain
in the retained artifact; `extraction_quality_decision=accepted_with_warnings`
identifies unreviewed admission. Artifact `complete=true` denotes completion of
the extraction attempt, not a claim of perfect recognition. No measured 90%
accuracy threshold is available. Empty/unusable output, malformed provider JSON,
identity/checksum mismatch, invalid relationships and resource bounds remain
errors. Publication remains atomic, ready and inactive until selection.
F01 capabilities add `allow_partial_extraction` and report effective review gates.
Failed existing documents require a new upload to use this new frozen policy.
Regression source: `tests/unit/test_partial_extraction.py`.
Best-effort admission verification: 196 focused provider-free checks passed;
7 isolated PostgreSQL upload/polling/configuration checks passed, zero skips.
Both Gemini and OpenRouter incomplete/warning response fixtures are covered.
API and worker rebuilt; local INGEST_ALLOW_PARTIAL_EXTRACTION=true confirmed
and /health/ready reports ingestion available. Actual failed photo re-upload
has not been run; prior failed snapshots remain strict. Worker failure logs
now include fixed extraction reason categories without provider response text.
Best-effort chunking follow-up (2026-10-13): the retained 89-block PDF
34930b1a-b341-46c1-adca-67d247d579e2 failed at chunking, not extraction,
with Unsupported governing-rule identifier. In the explicit partial-admission
mode, source-document units bypass strict legal-reference association and large
protected units may split with the existing overlap and character/chunk limits.
Source order, text and locations are preserved; strict mode remains unchanged.
This mode does not guarantee complete legal context within each chunk.
117 focused regression checks passed, including malformed legal identifiers
and bounded splitting.
@@ -837,3 +837,22 @@ status does not declare cancellation of the separately retained backend search.
Gemini continues to use its native interruption transport. New reservations use
`evidence_policy_revision=same-session-evidence-retained-v5`; existing pins are
not rewritten. No schema/table migration or new public endpoint is introduced.
## Temporary best-effort ingestion admission (2026-10-13)
User-authorized `INGEST_ALLOW_PARTIAL_EXTRACTION=true` is frozen in NEW upload
profiles as `extraction.allow_partial_extraction`. Default false and missing
legacy fields retain strict admission; existing profiles/digests are not rewritten.
This temporary mode bypasses PDF visual, OCR and factual manual approval without
fabricating reviewer identities or annotations. Usable recognition with incomplete
regions, warnings or unknown glyphs proceeds to chunking/embedding. Warnings remain
in the retained artifact; `extraction_quality_decision=accepted_with_warnings`
identifies unreviewed admission. Artifact `complete=true` denotes completion of
the extraction attempt, not a claim of perfect recognition. No measured 90%
accuracy threshold is available. Empty/unusable output, malformed provider JSON,
identity/checksum mismatch, invalid relationships and resource bounds remain
errors. Publication remains atomic, ready and inactive until selection.
F01 capabilities add `allow_partial_extraction` and report effective review gates.
Failed existing documents require a new upload to use this new frozen policy.
Regression source: `tests/unit/test_partial_extraction.py`.
@@ -470,3 +470,32 @@ status does not declare cancellation of the separately retained backend search.
Gemini continues to use its native interruption transport. New reservations use
`evidence_policy_revision=same-session-evidence-retained-v5`; existing pins are
not rewritten. No schema/table migration or new public endpoint is introduced.
## Temporary best-effort ingestion admission (2026-10-13)
User-authorized `INGEST_ALLOW_PARTIAL_EXTRACTION=true` is frozen in NEW upload
profiles as `extraction.allow_partial_extraction`. Default false and missing
legacy fields retain strict admission; existing profiles/digests are not rewritten.
This temporary mode bypasses PDF visual, OCR and factual manual approval without
fabricating reviewer identities or annotations. Usable recognition with incomplete
regions, warnings or unknown glyphs proceeds to chunking/embedding. Warnings remain
in the retained artifact; `extraction_quality_decision=accepted_with_warnings`
identifies unreviewed admission. Artifact `complete=true` denotes completion of
the extraction attempt, not a claim of perfect recognition. No measured 90%
accuracy threshold is available. Empty/unusable output, malformed provider JSON,
identity/checksum mismatch, invalid relationships and resource bounds remain
errors. Publication remains atomic, ready and inactive until selection.
F01 capabilities add `allow_partial_extraction` and report effective review gates.
Failed existing documents require a new upload to use this new frozen policy.
Regression source: `tests/unit/test_partial_extraction.py`.
Best-effort chunking follow-up (2026-10-13): the retained 89-block PDF
34930b1a-b341-46c1-adca-67d247d579e2 failed at chunking, not extraction,
with Unsupported governing-rule identifier. In the explicit partial-admission
mode, source-document units bypass strict legal-reference association and large
protected units may split with the existing overlap and character/chunk limits.
Source order, text and locations are preserved; strict mode remains unchanged.
This mode does not guarantee complete legal context within each chunk.
117 focused regression checks passed, including malformed legal identifiers
and bounded splitting.