feat(prepass): render the cut for the prompt and declare its denominators [skip-docs]

[skip-docs]: fortsatt ingen brukervendt flate -- CLI-flagget kommer i steg 6/7.

`render_context` er hva debatten faar I STEDET FOR pekeren: de leverte utdragene, de
tre nevnerne, spoersmaalet kuttet ble regnet for, og de tilbakeholdte konseptene som
REGEL -> ANTALL. Ids-ene baeres aldri -- maalt paa et 629-konsepts korpus er
withheld-lista alene 34 451 o200k-tokens, og et regelnavn er faktumet en leser kan
handle paa mens en liste over ids de ikke kan aapne er kostnad uten informasjon.

Avslutningslinja er ikke pynt: maalt LIVE gir et spoersmaal basen ikke svarer paa
fortsatt aatte utdrag, og med verktoeyene trukket har debatten ingen vei til aa
oppdage det selv. Renderingen sier derfor at et levert utdrag er et LEKSIKALSK treff
og ikke et svar, og navngir `[sourced-not-sufficient]` fra SS 4s markoer-sett.

`adjudication`/`trust_tier` merkes som PRODUSENTENS erklaering, ikke vaar: B4 slo fast
at en tillitsgrad utledes lokalt fra dokumentets eget `verified`, og repoets egne baser
baerer ingen -- saa en lokal utledning ville rapportert `unverified` for alt og sagt
ingenting. Aa adoptere produsentens verdi i stillhet ville vaert det gale svaret.

TAKET BINDER OVERHEADET, IKKE TOTALEN, og det er hele poenget: den leverte teksten er
alt bundet av produsentens eget budsjett (SS 7.3), saa et absolutt tak ville enten
nektet et legitimt stort kutt eller vaert saa loest at det fanget ingenting. Det po maa
garantere er KOSTNADSFORMEN -- O(levert tekst) + O(1), aldri O(korpus) -- som er
noeyaktig det som regrerer hvis withheld-lista sniker seg tilbake. Taket bor i TESTEN
(`_CATALOGUE_EXCERPT_CHARS`-regelen), med en korpus-skala kontroll paa 620
tilbakeholdte og en flat kontroll paa at den lista alene er >5x taket.

TO ARMER BLE SKREVET OM UNDER MAALINGEN, begge repoets vakuositets-klasse:
- Et absolutt tak paa 8 000 tegn var roedt paa fixturen (11 183) og ville uansett vaert
  meningsloest paa K2 -- det maalte ikke egenskapen, det maalte fixturstoerrelsen.
- `entry.concept_id not in rendering` var roed FORDI et levert konsept SITERER det
  tilbakeholdte. Asserten gjelder naa HEADEREN po selv forfatter; en delstreng-assert
  over hele renderingen kan ikke skille "vi lekket lista" fra "basen er kryss-lenket".

1425 passed / 5 skipped (fra 1413/5, +12, 0 fjernet). ruff + mypy rene. Golden
`shasum -a 1` av INNHOLDET = ea8c534773acdbe41ae68f2c55724d69aaf8be4f, BYTE-UENDRET.

Co-Authored-By: Claude <claude-opus-5>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-07 10:59:57 +02:00
commit 651c83f9df
2 changed files with 289 additions and 0 deletions

View file

@ -347,6 +347,70 @@ def _in_dimension(path: Path, dimension: str) -> bool:
)
# --- Rendering the cut for the prompt --------------------------------------------------------
def render_context(payload: PrepassPayload) -> str:
"""What the debate is handed INSTEAD of ``run._bundle_pointer``'s pointer.
Three jobs, and the third is the one the Amendment asked for.
1. **Deliver.** The excerpt text, so the debate can reason at all.
2. **Bound.** The withheld concepts appear as rule -> COUNT and never as ids. Measured on a
629-concept corpus the withheld list alone is 34 451 o200k tokens against a run cap of
100 000 that the task message rides three times and a rule name is the fact a reader can
act on, while a list of ids they cannot open is cost without information. The full list
stays in the payload, one artefact away (``list_bundles``' "the whole index is one call
away" rule, applied one rung over).
3. **Declare.** The three denominators and the question they were computed for, so the cut is
stated rather than left to be inferred from what happens not to be here (SS 2.3).
**The closing line is not decoration.** Measured live, a question this corpus cannot answer
still returns eight excerpts, and with the navigator tools withdrawn the debate has no way to
discover that for itself. So the rendering says plainly that a delivered excerpt is a LEXICAL
match and not an answer, and names ``[sourced-not-sufficient]`` from SS 4's marking set as the
available verdict.
**``adjudication`` and ``trust_tier`` are labelled as the PRODUCER's declaration**, not as
ours. B4 established that a trust tier is derived locally from a document's own ``verified``
frontmatter and this repository's bases carry none, so deriving it here would report
``unverified`` for everything and say nothing. Carrying the producer's value under the
producer's name is the honest form; adopting it silently as ours would not be.
The excerpt text goes in a delimited DATA block below the instruction (SS 9.3: machine-
generated text is data, never instructions). That is MITIGATION and is stated as such the
GATE is ``verify_against_bundle``, which makes the text re-derivable from the mounted base, so
a payload cannot deliver bytes the base does not hold.
"""
counts = payload.denominators
rules = ", ".join(f"{rule} ({count})" for rule, count in declaration_of(payload).withheld_rules)
lines = [
f"Knowledge base: {payload.bundle.bundle_id} (ref {payload.bundle.ref}).",
"",
"You are reading a DECLARED CUT of that base, not the base itself, and you have no tools "
"to read further. What is below is all of it.",
f"The cut was computed for this question: {payload.question}",
f"Concepts considered: {counts.considered}. Withheld: {counts.withheld}. "
f"Delivered below: {counts.delivered}.",
f"Withheld by rule: {rules}." if rules else "Withheld by rule: none.",
"",
"Each excerpt below matched the question LEXICALLY. That is not the same as answering it: "
"a base that holds no answer still returns its closest matches. If the delivered text "
"does not support a claim, say so with [sourced-not-sufficient] rather than filling the "
"gap. adjudication and trust_tier are the producer's declarations about each document, "
"carried here unchanged.",
]
for excerpt in payload.excerpts:
lines += [
"",
f"--- BEGIN DATA {excerpt.concept_id} "
f"(adjudication: {excerpt.adjudication}, trust_tier: {excerpt.trust_tier}) ---",
excerpt.text,
f"--- END DATA {excerpt.concept_id} ---",
]
return "\n".join(lines)
# --- The declaration -------------------------------------------------------------------------