feat(mcp): FU-14 GAP-52 — idempotency על case_create/precedent_attach/document_upload #63
Reference in New Issue
Block a user
Delete Branch "fix/fu14-gap52-idempotency"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
מה ולמה
GAP-52 מתוך FU-14 (פרוסה 2). INV-TOOL3 — כלי-מוטציה idempotent על מפתח דטרמיניסטי: קריאה חוזרת לא יוצרת כפילות.
Invariants — הצהרה
מה תוקן
case_createcase_number(כבר UNIQUE ב-schema)precedent_attach(case_id, section_id, citation, quote)document_upload(case_id, SHA-256 של הקובץ)לכל פלט idempotent נוסף
idempotent_existing: trueלהבחנה.בחירת מימוש — בדיקת-מפתח ברמת-אפליקציה (לא UNIQUE-constraint)
הספ אומר "upsert/ON CONFLICT", אבל הוספת UNIQUE-constraint על טבלה עם נתונים-כפולים legacy קיימים הייתה שוברת את ה-startup (יצירת ה-index נכשלת). לכן נבחרה בדיקת-מפתח (SELECT-לפני-INSERT) — מקיימת את אותו invariant בלי מיגרציה הרסנית ובלי סיכון startup.
document_uploadקיבל עמודה תוספתיתdocuments.content_hash(DEFAULT '', ללא unique; hash ריק=legacy → לעולם לא מותאם ככפילות).צ'קליסט — פרוטוקול כתיבת-קוד
00-constitution.md+X9(INV-TOOL3) לפני הכתיבהcontent_hash DEFAULT ''(ADD COLUMN IF NOT EXISTS) — ללא backfill, ללא unique. אפס סיכון על נתונים קיימיםאימות
🤖 Generated with Claude Code