feat: SourceDoc core and A2AJ compiler (P1.1a stages 1-2)

↗ view on GitHub · Eli Ziff · 2026-07-27 · c1142333

One immutable content-hashed artifact per fetched source: text, lazy
token spans, ordered blocks with native/heuristic origin, and a
locator index. Providers are compilers, consumers are queries.

Every fixture shape was captured live from api.a2aj.ca and two of the
brief's claims died on contact: the 'inline heading marker' SCC shape
is really a table-of-contents block (which halves the paragraph spine
- recorded in ranges.missing), and Oakes 1986 is dot-numbered, not
unnumbered (R. v. Duarte 1990 is the true abstain case). Newly
indexed: federal bold-emphasis sections (Criminal Code 0 -> 11,165
blocks live), alphanumeric regulation sections (CRC 870 0 -> 7,911),
Ontario out-of-order cross-reference traps. Two section-map nesting
bugs fixed and pinned: Number('01')===Number('1') dropped s.231(6.1),
and (C)/(D) parsed as Roman numerals. Byte-identical parity with the
legacy engine everywhere legacy produced anything.

Compile: 2.26 MB Criminal Code in 29-39 ms; tokenization deferred to
a memoized getter (144 ms, first quote query only).

Browser gate (scripts/deeplink-gate.mjs) run on the generated URLs:
Decisia anchors and text fragments land (including anchor-less 2001
SCC 1, where the fragment alone jumps - anchor availability is
per-document); A2AJ's raw-XML and JSON-API source URLs are proven
non-pinpointable (fragment never jumps) and recorded as negative
controls for the stage-3 host/anchor table.

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 c366efad
Stats 21 files changed , +2272 , -17
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-c1142333.md from inside the repo you want the change in.

⬇ Download capture-commit-c1142333.md