c9d83431e0dcd49454590be96982b165f6c1f604
aggregate_claims_to_arguments crashed with "current transaction is aborted, commands ignored until end of transaction block" on large cases (confirmed on 1027-04-26, 195 claims; reported via CMP-186). Root cause: the proposition INSERT (legal_argument_propositions) was wrapped in a broad except Exception with no savepoint. When the LLM echoes a syntactically-valid-but-nonexistent claim_id, the FK violation (legal_argument_propositions_claim_id_fkey) puts the asyncpg transaction into aborted state. The except caught only that INSERT's error but never issued ROLLBACK TO SAVEPOINT, so the next statement (the following argument's INSERT into legal_arguments) raised InFailedSQLTransactionError uncaught and crashed the whole call. With many claims the bad-UUID probability is high -> consistent failure. Fix: - Validate each claim_id against the known set of claim ids fetched for the case before INSERT, so a hallucinated id never reaches the DB (G1: fix at source). Malformed UUIDs are already dropped in _normalize_argument; this catches the valid-but-nonexistent ones. - Wrap the INSERT in a per-row savepoint (async with conn.transaction()) as defense-in-depth, so any unexpected constraint failure rolls back to the savepoint instead of poisoning the surrounding transaction. Invariants: G1 (normalize at source, not symptom-catch on read). No parallel path (G2). No silent swallow — skips are logged. TaskMaster: legal-ai #156 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
docs(principles): move research into docs/precedent-corpus-redesign/ (README + research-full) (#153)
Merge pull request 'feat(corpus): עיצוב-מחדש קורפוס-הפסיקה — ביטול תור-ההלכות, שכבת-מאומת-מאזכורים, דירוג-בזמן-אחזור (#153)' (#315) from worktree-canonical-synthesis into main
Description
AI Legal Decision Drafting System — MCP server, web upload, RAG search
Languages
Python
65.8%
TypeScript
32.2%
JavaScript
1%
Shell
0.7%
CSS
0.2%