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

@ -49,7 +49,8 @@ from portfolio_optimiser.explore import DeclaredRequirement, ToolCall, navigator
from portfolio_optimiser.mandate import Approach, Mandate, criteria_block
_EXAMPLES = Path(__file__).resolve().parents[1] / "shared" / "examples"
_TUNNEL = _EXAMPLES / "tunnel-hauglia"
_BUNDLES = Path(__file__).resolve().parents[1] / "src" / "portfolio_optimiser" / "data" / "bundles"
_KJOLING = _BUNDLES / "driftssenter-kjoling"
_BYGG = _EXAMPLES / "bygg-energi-mikro"
_PID = "BYGG-KONTOR-NORD"
@ -84,7 +85,7 @@ def _declare(
def _base_with_a_requirement(root: Path) -> Path:
"""A base declaring its own ``req_number`` — the form the delivered N corpora carry.
"""A base declaring its own ``req_number`` — the form the requirement bases carry.
Crafted rather than taken from ``shared/examples``: MEASURED, no example base declares a
``req_number`` at all, so an arm built on one of them could not tell a reply that reads the
@ -96,8 +97,8 @@ def _base_with_a_requirement(root: Path) -> Path:
"---\nbundle_id: n-mini\n---\n\n- [Krav](krav.md) — one requirement.\n", encoding="utf-8"
)
(base / "krav.md").write_text(
"---\ntype: Krav\ntitle: Krav 4.1.2-1 Rundkjoring\nreq_number: Krav 4.1.2-1\n"
"seksjon: '4.1.2'\n---\n\nEn rundkjoring skal ha …\n",
"---\ntype: Krav\ntitle: Krav 4.1.2-1 Sikkerhetskopi\nreq_number: Krav 4.1.2-1\n"
"seksjon: '4.1.2'\n---\n\nEn sikkerhetskopi skal ha …\n",
encoding="utf-8",
)
return base
@ -113,7 +114,7 @@ def test_the_reply_carries_the_documents_own_title_and_number(tmp_path: Path) ->
base = _base_with_a_requirement(tmp_path)
tools, opened, declared = _wired(base)
answer = _declare(tools, opened, "n-mini", "krav.md")
assert answer["title"] == "Krav 4.1.2-1 Rundkjoring"
assert answer["title"] == "Krav 4.1.2-1 Sikkerhetskopi"
assert answer["req_number"] == "Krav 4.1.2-1"
assert "is the requirement the proposal rests on" in answer["binds"]
assert declared == [
@ -145,16 +146,16 @@ def test_a_verdict_document_is_never_named_back_by_title(tmp_path: Path) -> None
assert answer["title"] == "", "the verdict layer must not be readable through this answer"
# The control: the SAME base answers the concept's title, so the empty string above is the
# layer being excluded rather than the reader being broken.
assert _declare(tools, opened, "n-mini", "krav.md")["title"] == "Krav 4.1.2-1 Rundkjoring"
assert _declare(tools, opened, "n-mini", "krav.md")["title"] == "Krav 4.1.2-1 Sikkerhetskopi"
def test_the_tunnel_example_answers_its_own_title_and_no_number() -> None:
def test_the_cooling_example_answers_its_own_title_and_no_number() -> None:
"""(a) control on a REAL example base: title present, reference number honestly absent."""
tools, opened, _declared = _wired(_TUNNEL)
files = [f.name for f in okf.navigate_bundle(str(_TUNNEL)).context_files]
tools, opened, _declared = _wired(_KJOLING)
files = [f.name for f in okf.navigate_bundle(str(_KJOLING)).context_files]
path = files[0]
answer = _declare(tools, opened, "tunnel-hauglia", path, also=files[1:3])
assert answer["title"].startswith("Kilder: tunnelbelysning")
answer = _declare(tools, opened, "driftssenter-kjoling", path, also=files[1:3])
assert answer["title"].startswith("Kilder: kjøling")
assert answer["req_number"] == "", "this base declares none, and the reply must not invent one"
@ -250,7 +251,7 @@ def test_both_descriptions_name_the_filter_route() -> None:
instruction = explore._INSTRUCTIONS[explore.HYPOTHESISER_ROLE]
assert "read_dir a 'filter' word" in instruction
assert "Krav 4.1.2-1" in instruction, "the worked example is what makes the route concrete"
tools = {t.name: t for t in navigator_tools((str(_TUNNEL),), opened=[], requirements=[])}
tools = {t.name: t for t in navigator_tools((str(_KJOLING),), opened=[], requirements=[])}
description = tools["declare_requirement"].description or ""
assert "filter='rundkjoring'" in description
assert "filter='sikkerhetskopi'" in description
assert "own title and number" in description