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

@ -11,8 +11,9 @@ refusal is built from).
The reason is structural: the nearest listable ancestor of a guessed DOCUMENT path often holds
documents and no subdirectories, and then the neighbour clause was omitted — deliberately, because
an empty list is a sentence with nothing in it. Measured over those six misses, THREE land on such
an ancestor (``krav/N100`` with 445 documents; ``R761/1`` with exactly ONE, which two separate
guesses — ``R761/1/1-1.md`` and ``R761/1/R761-1-1_id-...md`` — were both reaching for) and three
an ancestor (a requirements level with 445 documents; a process-catalogue chapter, ``P900/1``,
with exactly ONE, which two separate guesses — ``P900/1/1-1.md`` and ``P900/1/P900-1-1_id-...md``
— were both reaching for) and three
have subdirectories and were already answered.
Same source and same property as its sibling: built from ``context_files`` through ``in_dimension``,
@ -91,7 +92,7 @@ def test_a_missing_document_is_answered_with_the_names_that_level_holds(tmp_path
def test_a_level_with_exactly_one_document_names_it(tmp_path: Path) -> None:
"""The measured ``R761/1`` case, which is the sharpest one in the round-5 trace: TWO separate
"""The measured ``P900/1`` case, which is the sharpest one in the round-5 trace: TWO separate
guesses at one document's name, in one run, at a level that holds exactly that one document.
Naming it answers both in a single step."""
base = _write_tree(tmp_path / "korpus", dirs=1, per_dir=1)
@ -136,9 +137,9 @@ def test_every_named_document_can_then_be_read(tmp_path: Path) -> None:
def test_the_document_list_is_bounded(tmp_path: Path) -> None:
"""A level of a delivered corpus can hold hundreds — ``krav/N100`` holds 445. The list is the
same fixed five its sibling uses, for the same reason: this is help text on a refusal, and its
price must not be set by how much the level contains."""
"""A level of a delivered corpus can hold hundreds — one requirements level held 445. The list
is the same fixed five its sibling uses, for the same reason: this is help text on a refusal,
and its price must not be set by how much the level contains."""
base = _write_tree(tmp_path / "korpus", dirs=1, per_dir=40)
refusal = _read_file(base, "kategori-00/dok-99-gjettet.md")
named = refusal.split("it holds the documents ")[1].split(")")[0].split(", ")
@ -150,7 +151,7 @@ def test_the_closest_name_comes_first(tmp_path: Path) -> None:
Replacing ``_shared_prefix`` with a plain reverse sort left the whole suite green: the bound,
the source and the resolve property were all gated, and the ORDER was not. For the measured
``R761/1`` case that costs nothing — one document, one answer — but a level of a delivered
``P900/1`` case that costs nothing — one document, one answer — but a level of a delivered
corpus can hold 445, and then which five it names is the whole value of the clause.
The rule is the sibling's, through the SAME ``_shared_prefix`` helper rather than a second copy
@ -160,7 +161,7 @@ def test_the_closest_name_comes_first(tmp_path: Path) -> None:
"""
base = tmp_path / "korpus"
base.mkdir(parents=True)
names = ["asfalt-slitelag-2024.md", "asfalt-dekke.md", "betong.md", "grus.md"]
names = ["lagring-sikkerhetskopi-2024.md", "lagring-disk.md", "nettverk.md", "server.md"]
lines = [f"# {base.name}", ""]
for name in names:
lines.append(f"- [{name}]({name})")
@ -171,12 +172,12 @@ def test_the_closest_name_comes_first(tmp_path: Path) -> None:
"---\ntype: index\n---\n\n" + "\n".join(lines) + "\n", encoding="utf-8"
)
refusal = _read_file(base, "asfalt-slitelag.md")
refusal = _read_file(base, "lagring-sikkerhetskopi.md")
named = refusal.split("it holds the documents ")[1].split(")")[0].split(", ")
# It shares the longest prefix AND is the longest name, so a length-only rule puts it last and
# a reverse-alphabetical one puts ``grus.md`` first. Only the prefix rule puts it first.
assert named[0] == "asfalt-slitelag-2024.md", named
assert named[1] == "asfalt-dekke.md", named
# a reverse-alphabetical one puts ``server.md`` first. Only the prefix rule puts it first.
assert named[0] == "lagring-sikkerhetskopi-2024.md", named
assert named[1] == "lagring-disk.md", named
# --- (e) the other call site ---------------------------------------------------------------------
@ -219,7 +220,7 @@ def test_a_foreign_dimension_document_is_never_named(tmp_path: Path) -> None:
base = _write_tree(tmp_path / "korpus", dirs=1, per_dir=1)
foreign = base / "kategori-00" / "fremmed.md"
foreign.write_text(
"---\ntype: concept\ndimension: asfalt\ntitle: Fremmed\n---\n\nkropp.\n", encoding="utf-8"
"---\ntype: concept\ndimension: lisens\ntitle: Fremmed\n---\n\nkropp.\n", encoding="utf-8"
)
index = base / "kategori-00" / "index.md"
index.write_text(