native markup: compile the provider structure we discarded (survey findings 2-4)

↗ view on GitHub · Eli Ziff · 2026-07-30 · f96adec0

The structural-richness survey (c35d45e3) found three providers handing
us structure the compiler threw away. All three now compile, under one
receipt-schema bump.

- CAP casebody (xml_harvard): star pagination
  (<a id="p336" data-label="336" class="page-label">) becomes native
  page blocks - INLINE, no text break, since star pages land
  mid-sentence and the rendered text is frozen; footnote asides
  (<aside data-label="N" class="footnote">) become native fn-N blocks.
  The 372us335 fixture goes from 5 heuristic paragraphs to +17 pages
  +20 footnotes, text byte-identical. compactOpinion needed no flip:
  it already preferred xml_harvard for structure - the defect was that
  the compiler could not read it, and now it can.
- TNA: lvl_N levels compile to native section blocks (cleanSectionId
  learns the level/lvl prefix). The eat-2025-1 fixture gains 24
  sections on a doc that indexed section:0. New nativeMarkupCitedRefs
  reads the <ref uk:canonical uk:type> cited-authority markup -
  deduped, first-appearance order - and TNA fetch/rehydrate carry it as
  PublicLegalDocument.citedAuthorities; the fetch tool payload surfaces
  cited_authorities (capped 60).
- GOV.UK ET: hidden_indexable_content HTML now reaches the compiler as
  markup (title/description ride as escaped paragraphs) instead of
  being tag-stripped first, so <p>[N] boundaries inform the heuristic
  spine.

Receipt schema v1 -> v2 (mike.provider_legal_evidence.v2, handle and
store path v2): payload hashes cover same-kind context, so v1 SECTION
hashes on lvl-bearing docs can no longer re-verify; v1 handles are
refused by version with a typed recapture error (surfaced verbatim to
the model - it names the recovery), never a misleading integrity error.
Proven in the new recording gate: legacy-structure.json (the deleted
engine's frozen output, untouched) now asserts the enrichment
invariants - rendered text byte-identical, every legacy block survives
verbatim, and every legacy PARAGRAPH lookup replays with an identical
payload hash - while native-structure-v2.json freezes the enriched
compiler byte-exactly (283 lookups across 4 fixtures).

Suites: sourceDocNativeMarkup (11), publicLegalSources,
publicLegalSourceIntegration (+ typed v1-refusal test),
publicLegalSourcePdfFallback, docxEvidenceCitations, sourceDocFixtures,
providerPdfConsumers, legalSourceLinks, localAssistantTools - all
green; tsc clean.

Integration plan item 4 (task #28).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012AgUm5EcRKbT3duVFMbrQD
Repository eliziff/Beaver
Author Eli Ziff <eliasziff@gmail.com>
Authored
Parents 3501d7ab
Stats 8 files changed , +6915 , -44
Part of SourceDoc / DOCX engine: redlines, tracked changes, editing benchmark

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

⬇ Download capture-commit-f96adec0.md