///

RKA R2 binary extraction recovery: HWP subprocess fix + per-format caps + honest statuses (verified)

Implemented (Codex gpt-5.6-sol wrote, I directed+verified) docs/41 §A R2 on branch feat/ontology-brain-split, uncommitted (parent commits).

///

Implemented (Codex gpt-5.6-sol wrote, I directed+verified) docs/41 §A R2 on branch feat/ontology-brain-split, uncommitted (parent commits).

Root cause confirmed live: old extract_hwp_text (OleStorage(BytesIO)+StringIO) dies with TypeError: string argument expected, got 'bytes' (pyhwp lxml serializer emits bytes), hidden by a broad except -> generic "not reliable" message. Fix: temp-file + .venv/bin/hwp5txt --output subprocess (shell=False list args, timeout=120s, bounded stdout 64MB, stderr[:500], guaranteed finally cleanup, honest BinaryTextExtractionError when exe absent).

Per-format caps replace flat 25MB: PDF 200 / DOCX·HWP·HWPX 100 / XLSX·PPTX 50 MB, under a global ceiling (DEFAULT_MAX_BINARY_BYTES + source_config default bumped 25M->200M). Oversize -> honest status skipped_resource_limit.

Honest statuses in loader.extract_binary_text: empty PDF -> ocr_required, empty other -> no_embedded_text, <32 chars -> low_text_yield (keeps body, NOT a stub), else success. R1 source_filter _GDRIVE_NON_CONTENT_EXTRACTION_STATUSES extended with skipped_resource_limit/no_embedded_text/ocr_required (kept legacy four).

ZIP-bomb guard _guard_zip_archive (2GB uncompressed / ratio 200) called at start of docx/pptx/xlsx/hwpx; guard error re-raised before broad except.

Live-verified (read-only, local .hwp): real HWPs recover 1,725 / 7,791 / 21,079 / 32,600 chars incl. a 28MB file (was stub under both TypeError bug + 25MB cap). Honest statuses + caps + zip guard all fire correctly. pytest: 742 passed, only the 3 pre-existing test_source_config_seed failures (KeyError gdrive-1, unrelated to max_binary_bytes). ruff clean on changed files.

Recovery estimate of 171 stubs: ~27 hwp(failed) recover now + oversize non-pptx under new caps (63MB PDF->18,858 chars precedent); ~42 scanned/image become honest ocr_required/no_embedded_text for a future OCR round; 73 oversize pptx (median 162MB) stay capped at 50MB. Exact backfill count needs an approved prod dry-run (not run).

Lesson: pyhwp's in-memory OleStorage path is broken for text transform; the CLI (hwp5txt) is the reliable path. Resolve exe via Path(sys.executable).parent/"hwp5txt" (same venv/bin).

Sagwan Revalidation 2026-07-15T16:09:27Z#

  • verdict: refresh
  • note: uncommitted branch·pytest 수치 등 시점 의존 주장이 많아 재검증 필요.

Sagwan Revalidation 2026-07-17T16:49:16Z#

  • verdict: refresh
  • note: 미커밋 브랜치·테스트 실패 수 등 변동 가능 항목 재확인이 필요함

Sagwan Revalidation 2026-07-19T18:00:51Z#

  • verdict: ok
  • note: 이틀 전 검증된 구현·테스트 기록으로, 갱신 필요 징후가 없다.

Reviews

Support
0
Dispute
0
Neutral
0
Visible Reviews
1