feat(storage): X14 Phase 2b — extracted-text + async DOCX exports through storage.py #153

Merged
chaim merged 1 commits from worktree-storage-minio-phase2b into main 2026-06-08 08:05:52 +00:00
Owner

מה זה

המשך חיווט אתרי-הכתיבה דרך שכבת-האחסון (X14, משימה 106.3, INV-STG1):

  • services/processor.py — extracted-text .txt → דלי DERIVED (נגזר; ה-DB הוא מקור-האמת INV-STG5 → הכתיבה נשארת non-fatal)
  • services/docx_exporter.py (export_decision) — DOCX → דלי DOCUMENTS דרך BytesIO → put_bytes, עם נפילה-לאחור לכתיבה ישירה כשה-caller מעביר output_path מחוץ ל-DATA_DIR
  • services/analysis_docx_exporter.py (build_analysis_docx) — אותו דפוס; out_path תמיד תחת DATA_DIR

אפס שינוי-התנהגות

תחת STORAGE_BACKEND=filesystem (ברירת-מחדל) הבייטים נוחתים בנתיב הישן המדויק. החלקים שקוראים דיסק ונשארים (glob ב-_next_version) — versioning נייטיב-storage הוא עניין של cutover.

עדיין על דיסק (אתרים סינכרוניים — follow-up שלב 2c)

docx_reviser (track-changes), גיבוי docx_retrofit, ו-thumbnails (render ב-to_thread). טקסט git-tracked (case.json/notes/research/draft-md) נשאר בדיסק מתוכנן (INV-STG7).

בדיקות

38 storage+docx ירוקות (כולל test_export_qa_gate/test_docx_exporter_bookmarks שמפעילות את נתיב-הייצוא האמיתי); 242 נאספות ללא שבירה.

מקיים G2; מקדם INV-STG1. ספ: docs/spec/X14-storage-minio.md.

🤖 Generated with Claude Code

## מה זה המשך חיווט אתרי-הכתיבה דרך שכבת-האחסון (X14, משימה 106.3, INV-STG1): - `services/processor.py` — extracted-text `.txt` → דלי **DERIVED** (נגזר; ה-DB הוא מקור-האמת INV-STG5 → הכתיבה נשארת non-fatal) - `services/docx_exporter.py` (`export_decision`) — DOCX → דלי **DOCUMENTS** דרך `BytesIO → put_bytes`, עם נפילה-לאחור לכתיבה ישירה כשה-caller מעביר `output_path` מחוץ ל-DATA_DIR - `services/analysis_docx_exporter.py` (`build_analysis_docx`) — אותו דפוס; `out_path` תמיד תחת DATA_DIR ## אפס שינוי-התנהגות תחת `STORAGE_BACKEND=filesystem` (ברירת-מחדל) הבייטים נוחתים בנתיב הישן המדויק. החלקים שקוראים דיסק ונשארים (glob ב-`_next_version`) — versioning נייטיב-storage הוא עניין של cutover. ## עדיין על דיסק (אתרים סינכרוניים — follow-up שלב 2c) `docx_reviser` (track-changes), גיבוי `docx_retrofit`, ו-thumbnails (render ב-to_thread). טקסט git-tracked (case.json/notes/research/draft-md) נשאר בדיסק **מתוכנן** (INV-STG7). ## בדיקות 38 storage+docx ירוקות (כולל `test_export_qa_gate`/`test_docx_exporter_bookmarks` שמפעילות את נתיב-הייצוא האמיתי); 242 נאספות ללא שבירה. מקיים **G2**; מקדם **INV-STG1**. ספ: `docs/spec/X14-storage-minio.md`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 1 commit 2026-06-08 08:05:47 +00:00
Continue the write-site rewiring onto the unified storage layer (INV-STG1):
- services/processor.py: extracted-text .txt → DERIVED bucket (a derived
  artifact; the DB column is the source of truth per INV-STG5, so the write
  stays non-fatal)
- services/docx_exporter.py (export_decision): DOCX → DOCUMENTS bucket via
  BytesIO → put_bytes, with a fallback to a direct disk write when the caller
  passes an output_path outside DATA_DIR
- services/analysis_docx_exporter.py (build_analysis_docx): same pattern;
  out_path is always under DATA_DIR

Under the default STORAGE_BACKEND=filesystem the bytes land at the exact
legacy path (put_bytes → DATA_DIR/key), so behaviour is unchanged. The
disk-reading bits that must stay for now (export_dir glob in _next_version)
are kept; storage-native versioning is a cutover concern.

Still on disk (sync call-sites, follow-up Phase 2c): docx_reviser
(track-changes), docx_retrofit backup, and multimodal thumbnails (rendered in
a to_thread). git-tracked text (case.json/notes/research-md/draft-md) stays on
disk by design (INV-STG7).

tests: 38 storage + docx tests green (incl. test_export_qa_gate /
test_docx_exporter_bookmarks which exercise the real export path); 242
collected, no import breakage.

Keeps G2; advances INV-STG1. Spec: docs/spec/X14-storage-minio.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit 1e41125baa into main 2026-06-08 08:05:52 +00:00
chaim deleted branch worktree-storage-minio-phase2b 2026-06-08 08:05:52 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ezer-mishpati/legal-ai#153