WS7: Citation Checker - live legislation.gov.uk verification

↗ view on GitHub · sloth-ninja · 2026-07-19 · a84f0465

Backend: new POST /citations/check (requireAuth, own rate limiter
RATE_LIMIT_CITATIONS_MAX default 20/15min, 100k-char cap with 413,
50-citation cap, whole-handler try/catch with fixed generic 500 detail).
Extraction regexes ported from evals/src/citations.ts into
backend/src/lib/citationExtraction.ts (provenance headers both ends; the
evals resolver is NOT ported - verification uses lib/legislation.ts's
verifyCitation, sequential to respect its ~1 req/s politeness bucket).
Neutral-case citations always return "unverifiable" with the fixed
Find Case Law / BAILII copy.

Frontend: /citation-checker page per the approved WS7 mock-up (paste-in
textarea, Check citations action, skeleton checking state, results table
with green Verified rows linking to canonical legislation.gov.uk URLs,
red Not found + reason, amber case-law rows, summary count line, footer
disclaimer), checkCitations in mikeApi.ts, and a "Research" sidebar group
with Citation Checker (ClipboardCheck).

Tests: 25 new vitest cases (extraction fixtures + route tests with mocked
verifyCitation); backend suite 122/122. Docs: env registry + module maps
in CLAUDE.md, .env.example, BUILD_LOG entry.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Repository Sloth-ninja/JessicaOSS
Author sloth-ninja <ezanahaddis@gmail.com>
Authored
Parents 13aaf3a7
Stats 12 files changed , +998 , -42
Part of WS7: Citation Checker (live legislation.gov.uk verification)

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-a84f0465.md from inside the repo you want the change in.

⬇ Download capture-commit-a84f0465.md