docs: case-deletion runbook (legal-ai + Paperclip + Gitea)
All checks were successful
Build & Deploy / build-and-deploy (push) Successful in 7s

Captures the full deletion procedure we worked out empirically while
wiping case 8174-24 for a clean rerun. Covers all four systems where
case state lives, in dependency order:

  1. legal-ai DB + on-disk dir — DELETE /api/cases?remove_files=true
     (now actually works after 903fb4d added the missing db.delete_case)
  2. Paperclip DB — no API; raw SQL with explicit FK-blocker ordering
     (issue_comments, cost_events, finance_events, feedback_votes,
     issue_inbox_archives, issue_read_states must go before issues;
     heartbeat_runs.wakeup_request_id must be NULLed before
     agent_wakeup_requests can be deleted)
  3. Gitea — DELETE /api/v1/repos/cases/{N}
  4. Verification queries for each system

Two gotchas worth highlighting in the doc:
  • The case directory inside /data/cases is owned by root because the
    container runs as root — host-side rm needs sudo, or use the API
    (rmtree happens inside the container).
  • Paperclip projects are referenced via name LIKE '%{N}%' since
    there's no slug column. Stricter matching is recommended if N
    appears in multiple project names.

Linked from legal-ai/CLAUDE.md docs index. A future scripts/delete-case.sh
that automates the runbook with a confirmation prompt is noted as TODO
inside the runbook itself.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-30 14:54:21 +00:00
parent 903fb4d140
commit cd4eed0045
2 changed files with 180 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
| [`docs/new-company-setup-guide.md`](docs/new-company-setup-guide.md) | מדריך הקמת חברה חדשה (CMPA) — skills, corpus, style analysis | לפני הוספת חברה/סוג ערר חדש |
| [`docs/audit-report.md`](docs/audit-report.md) | דוח audit של המערכת | רקע כללי |
| [`docs/case-migration-tracker.md`](docs/case-migration-tracker.md) | מעקב מיגרציה של תיקים קיימים | לצורך מעקב |
| [`docs/case-deletion-runbook.md`](docs/case-deletion-runbook.md) | runbook מלא למחיקת תיק — legal-ai DB + disk + Paperclip + Gitea, FK ordering, fallback ל-SQL ישיר | לפני reset שלם של תיק (מבחן, מחיקה בטעות) |
| [`docs/decision-block-mapping.md`](docs/decision-block-mapping.md) | מיפוי בלוקים להחלטות — איך 12 הבלוקים משתקפים ב-DOCX | להתמצאות במבנה |
| [`docs/memory.md`](docs/memory.md) | הקשר כללי — skills, פרויקטים שהושלמו, מבנה vault | להתמצאות כללית |
| [`skills/decision/SKILL.md`](skills/decision/SKILL.md) | מדריך סגנון מלא של דפנה — טון, מבנה, ביטויים, מתודולוגיה | **לפני כל כתיבת החלטה** |