chore(backend): save remaining API and deployment changes

Expose frozen factual review policy, update API descriptions and Swagger settings, and adjust local deployment and embedding connectivity.

Include the requested extraction candidates and review-policy regression coverage. Validation: 31 OCR policy tests passed; staged diff whitespace checks passed.
This commit is contained in:
amirhosein mazaheri
2026-10-10 17:43:17 +03:30
parent a769196bfa
commit 21a0ea076a
18 changed files with 268 additions and 49 deletions
@@ -19,6 +19,14 @@ def ocr_review_required(profile: Mapping) -> bool:
return value
def factual_review_required(profile: Mapping) -> bool:
"""Fail closed for legacy snapshots; deployment defaults never reinterpret jobs."""
value = profile.get("extraction", {}).get("factual_review_required", True)
if type(value) is not bool:
raise ValueError("Invalid frozen factual review policy")
return value
def processing_profile_kind(profile: Mapping) -> str:
if "profile_schema" not in profile and profile.get("extractor") == "pypdf-markdown-v1":
return "legacy-v1"
@@ -29,6 +37,7 @@ def processing_profile_kind(profile: Mapping) -> str:
def extraction_profile_digest(profile: Mapping) -> str:
ocr_review_required(profile)
factual_review_required(profile)
if processing_profile_kind(profile) == "legacy-v1":
raise LegacyProcessingProfile("Legacy extractor requires explicit legacy dispatch; OCR reinterpretation is forbidden")
# Faithful extraction is reusable across chunk/embedding/normalization changes.