FU-7: audit-trail + provenance (GAP-17/18/19/20) #13

Merged
chaim merged 10 commits from fix/fu7-audit-provenance into main 2026-05-30 21:43:34 +00:00
Owner

Summary

ממיר את audit_log מ"כמעט-ריק" ל-audit-trail מקצה-לקצה + provenance בלוק→מקורות, אכיפת ציטוט→קורפוס, וגילוי drift DOCX↔blocks. מאמת מול 3+ מקורות (append-only lineage event; GitOps drift detect-don't-remediate). בלי טבלה חדשה (audit_log שב-X5 §4), בלי מיגרציית-נתונים.

  • GAP-18log_action_safe (non-fatal) ב-document_upload / extract_claims / export_docx / write_block.
  • GAP-19 — provenance בלוק→מקורות (document_ids/claim_ids/case_law_ids) כאירוע write_block ב-audit_log.details.
  • GAP-20 — ולידציה מבנית של case_law_id פתיר → ממצא-QA warning (לא חוסם export; שערי FU-6 נשמרים).
  • GAP-17 — דגל cases.blocks_stale (V22, additive) מסומן ב-revise/apply, מאופס ב-export/save, נחשף ב-health-check (cases_with_stale_blocks). מקור-אמת=בלוקים; אין reparse DOCX→blocks שביר.

מספק INV-AUD1/2/3, INV-EX1, INV-G9.

Test Plan

  • בדיקות offline חדשות (log_action_safe non-fatal, citation resolver, blocks_stale)
  • כל החבילה ירוקה — 94 passed; שערי-QA של FU-6 עדיין 5/5
  • smoke מול DB אמיתי: V22 column + resolver + audit row
  • סקירת-קוד סופית (spec+quality): 0 Critical/Important; תוקן second-caller של _build_precedents_context + None-doc-types provenance

🤖 Generated with Claude Code

## Summary ממיר את audit_log מ"כמעט-ריק" ל-audit-trail מקצה-לקצה + provenance בלוק→מקורות, אכיפת ציטוט→קורפוס, וגילוי drift DOCX↔blocks. מאמת מול 3+ מקורות (append-only lineage event; GitOps drift detect-don't-remediate). **בלי טבלה חדשה** (audit_log שב-X5 §4), **בלי מיגרציית-נתונים**. - **GAP-18** — `log_action_safe` (non-fatal) ב-document_upload / extract_claims / export_docx / write_block. - **GAP-19** — provenance בלוק→מקורות (`document_ids`/`claim_ids`/`case_law_ids`) כאירוע `write_block` ב-`audit_log.details`. - **GAP-20** — ולידציה מבנית של `case_law_id` פתיר → ממצא-QA **warning** (לא חוסם export; שערי FU-6 נשמרים). - **GAP-17** — דגל `cases.blocks_stale` (V22, additive) מסומן ב-revise/apply, מאופס ב-export/save, נחשף ב-health-check (`cases_with_stale_blocks`). מקור-אמת=בלוקים; אין reparse DOCX→blocks שביר. מספק INV-AUD1/2/3, INV-EX1, INV-G9. ## Test Plan - [x] בדיקות offline חדשות (log_action_safe non-fatal, citation resolver, blocks_stale) - [x] כל החבילה ירוקה — 94 passed; שערי-QA של FU-6 עדיין 5/5 - [x] smoke מול DB אמיתי: V22 column + resolver + audit row - [x] סקירת-קוד סופית (spec+quality): 0 Critical/Important; תוקן second-caller של _build_precedents_context + None-doc-types provenance 🤖 Generated with [Claude Code](https://claude.com/claude-code)
chaim added 10 commits 2026-05-30 21:43:33 +00:00
Reuse audit_log.log_action with details JSONB (X5 §4, no new table) for
end-to-end audit + block→source provenance. GAP-17 drift = blocks_stale flag
+ health-check (not fragile DOCX→blocks reparse). GAP-20 = structural
case_law_id resolution (not Hebrew citation NLP). Verified vs 3+ sources
(append-only lineage event; GitOps drift detect-don't-auto-remediate).
Pure-code, no migration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
chaim merged commit 63dc08c963 into main 2026-05-30 21:43:34 +00:00
chaim deleted branch fix/fu7-audit-provenance 2026-05-30 21:43:34 +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#13