refactor(examples): replace sector-specific example material with generic, fictitious examples

The context sets, the packaged knowledge bases and the example bundles are
replaced by one fictitious example set about IT operations in an invented
organisation: three context sets (serverrom-2027, driftsavtale-2027 and the
two-base drift-og-avtale-2027), two synthetic knowledge bases under
src/portfolio_optimiser/data/kunnskapsbaser and two example bundles under
src/portfolio_optimiser/data/bundles. Numbers, codes and structural values in
tests and fixtures are kept; names, ids and wording change. Dated measurement
documents that only recorded runs on the replaced material are deleted.

Gate figures measured on the new set are not comparable with earlier ones.
The exclusion gate from the previous commit is green: 0 tracked files hit
outside the shared/ subtree.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-09-23 15:04:21 +02:00
commit 37547fe292
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
1147 changed files with 24138 additions and 9503 deletions

View file

@ -3,7 +3,7 @@
MAJOR-3 (``docs/2026-09-02-misjonsreview-v2.md`` § 7), measured before anything was changed in
``docs/2026-09-02-read-bundle-kontekstkostnad.md``:
read_bundle payload bygg 3 861 / veglys 10 406 / tunnel 12 595 o200k_base tokens
read_bundle payload 3 861 / 10 406 / 12 595 o200k_base tokens (three example bases)
prompts one result rides in FIVE (navigator 1, manager 3, hypothesiser 1)
share of every prompt-token 54 % / 59 % / 59 % of one CLI ``--explore`` run
@ -21,7 +21,7 @@ level, not data loss: every byte is still exactly one call away, and a navigator
documents it chose to open instead of for the ones it did not.
**A premise felled before it was built on** (see the measurement doc § 2): "the index body is the
base's own navigation prose, so it belongs here". The tunnel base's root index is **4 763 chars
base's own navigation prose, so it belongs here". The largest base's root index was **4 763 chars
alone ≈ 1 400 tokens** — nearly the entire ceiling, for a field ``list_bundles`` already excerpts
and ``read_file(id, "index.md")`` still returns whole.
@ -33,7 +33,7 @@ raising the budget is precisely the regression this file exists to catch.
file bounds CHARACTERS instead. ``tiktoken`` is not a project dependency (and adding one for a
gate would be a bigger decision than the gate), and a gate that skips when an optional package is
missing is a gate that can be silently absent. The character ceiling is a proxy whose conversion
was MEASURED rather than assumed: the new payload over the real tunnel base is **748 chars / 259
was MEASURED rather than assumed: the new payload over the largest base was **748 chars / 259
o200k tokens** (2.89 chars/token for this Norwegian markdown), so 1 500 characters is ≈ 520 tokens
— comfortably inside the order's criterion, and twice the measured payload, so ordinary field
growth does not force a rewrite. The order's own criterion is verified directly, once, by the
@ -49,7 +49,7 @@ for byte -- and the hierarchy's own gate is ``tests/test_hierarchical_navigation
What the arms pin, and what each one refuses:
(a) the bound itself, over the REAL base the order names — refuses the unbounded form. A synthetic
(a) the bound itself, over the largest SHIPPED base — refuses the unbounded form. A synthetic
fixture here would measure the fixture writer, not the base;
(b) cost tracks DOCUMENT COUNT, not document SIZE — ten times the prose, the same price. That is
the property stated directly rather than inferred from (a);
@ -76,10 +76,11 @@ from typing import Any
from portfolio_optimiser import okf
from portfolio_optimiser.explore import navigator_tools
_EXAMPLES = Path(__file__).resolve().parents[1] / "shared" / "examples"
_BUNDLES = Path(__file__).resolve().parents[1] / "src" / "portfolio_optimiser" / "data" / "bundles"
#: The base the order names. Measured, not chosen: the largest of the three example bases.
_TUNNEL = _EXAMPLES / "tunnel-hauglia"
#: The largest example base the package ships -- the structural counterpart (same documents, same
#: link graph, same frontmatter) of the base the order named, which has since been replaced.
_KJOLING = _BUNDLES / "driftssenter-kjoling"
#: Characters one ``read_bundle`` listing may cost. Test-owned on purpose — see the docstring, and
#: the measured chars/token conversion that ties it to the order's token criterion.
@ -130,12 +131,12 @@ def _write_base(
return base
def test_read_bundle_over_the_real_tunnel_base_is_bounded() -> None:
"""(a) The headline, over the base the order names — not a fixture of my own making."""
blob = _blob(_listing(_TUNNEL))
def test_read_bundle_over_the_largest_shipped_base_is_bounded() -> None:
"""(a) The headline, over the largest shipped base — not a fixture of my own making."""
blob = _blob(_listing(_KJOLING))
assert len(blob) <= _CEILING_CHARS, (
f"read_bundle over {_TUNNEL.name} costs {len(blob)} chars, over the ceiling "
f"read_bundle over {_KJOLING.name} costs {len(blob)} chars, over the ceiling "
f"{_CEILING_CHARS}; it used to be 39 583 (12 595 o200k tokens), riding in five prompts"
)
@ -164,8 +165,8 @@ def test_the_listing_still_identifies_every_document(tmp_path: Path) -> None:
will cost (``chars``) — so all four are asserted, and the entry count is tied to the navigated
context files rather than to a number written here.
"""
bundle = okf.navigate_bundle(str(_TUNNEL))
entries = _documents(_TUNNEL)
bundle = okf.navigate_bundle(str(_KJOLING))
entries = _documents(_KJOLING)
assert len(entries) == len(bundle.context_files) > 0, (
"a listing that omits documents is a base the navigator cannot fully see"
@ -200,10 +201,10 @@ def test_the_verdict_layer_is_still_excluded(tmp_path: Path) -> None:
def test_the_whole_document_is_still_one_call_away() -> None:
"""(e) The bound is a disclosure LEVEL, not data loss."""
entries = _documents(_TUNNEL)
entries = _documents(_KJOLING)
biggest = max(entries, key=lambda e: int(e["chars"]))
whole = _tools(_TUNNEL)["read_file"].func(bundle_id=_TUNNEL.name, path=str(biggest["name"]))
whole = _tools(_KJOLING)["read_file"].func(bundle_id=_KJOLING.name, path=str(biggest["name"]))
assert len(whole) > _CEILING_CHARS, "read_file must still return the document, not a summary"
assert str(biggest["chars"]) != "0" and int(biggest["chars"]) <= len(whole)
@ -211,11 +212,11 @@ def test_the_whole_document_is_still_one_call_away() -> None:
def test_control_one_document_alone_would_blow_the_ceiling() -> None:
"""(f) The ceiling discriminates — proved, not assumed. The order names this control."""
bundle = okf.navigate_bundle(str(_TUNNEL))
bundle = okf.navigate_bundle(str(_KJOLING))
biggest = max(len(f.body) for f in bundle.context_files)
assert biggest > _CEILING_CHARS, (
f"the largest document in {_TUNNEL.name} is {biggest} chars; a ceiling it does not exceed "
f"the largest document in {_KJOLING.name} is {biggest} chars; a ceiling it does not exceed "
"would be a ceiling this base could pass while carrying everything"
)