refactor: compact courtlistener fallback chains and bulk lookup

↗ view on GitHub · Eli Ziff · 2026-07-27 · 0dbe0bfe

firstString() collapses the asString ?? asString chains (order
preserved per chain - API and bulk paths intentionally differ),
attachOpinionStructure() dedupes the WeakMap + structure tail shared
by API and R2 opinion mapping, failRow() replaces four identical
error-row pushes, and the sanitizer allowlists collapse to split
strings with identical contents. -165 lines; wire shapes untouched.

Verified: tsc clean; courtlistenerLocalBulk, docxCitationLinking,
legalSourceStructure suites green.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QUsMXzBsEJ27DjJVPSfW5o
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents 103b8b3d
Stats 1 file changed , +142 , -307
Part of A2AJ / CourtListener Canadian legal-source integration

Capture this commit into my fork

Download a Markdown prompt that tells Claude how to port this exact commit into your working tree. Run it via claude -p < capture-commit-0dbe0bfe.md from inside the repo you want the change in.

⬇ Download capture-commit-0dbe0bfe.md