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

@ -1,7 +1,7 @@
"""P19 DEL A — a direction must NAME the requirement that binds it, and it must have READ it.
**The measured silence, two paid rounds deep.** P16 (`docs/2026-09-12-p14-kontekstsett.md` § 4.1,
`docs/2026-09-14-p18-stressrunde-2.md`) and P18 both scored **0 of 26** fasit concepts opened —
**The measured silence, two paid rounds deep.** P16 and P18 (the ledger is
`docs/invarianter.md`) both scored **0 of 26** fasit concepts opened —
the same number twice, over four and then five paid runs, while every run still produced proposals
the deterministic gate then judged. P18 closed the navigation side of it (a listing is a window; an
invented path is refused by name) and the number did not move at all. That is what turns it from a
@ -72,12 +72,12 @@ from portfolio_optimiser.generate import _build_messages
from portfolio_optimiser.mandate import Approach, BindingRequirement
from portfolio_optimiser.reference_domain import Project
_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"
def _wired(
bundle_dir: Path = _TUNNEL,
bundle_dir: Path = _KJOLING,
) -> tuple[dict[str, Any], list[ToolCall], list[DeclaredRequirement]]:
"""The tools as a RUN holds them: the declaration rung reading the recorder's own trace."""
opened: list[ToolCall] = []
@ -86,7 +86,7 @@ def _wired(
return {t.name: t for t in tools}, opened, declared
def _a_concept(bundle_dir: Path = _TUNNEL) -> str:
def _a_concept(bundle_dir: Path = _KJOLING) -> str:
"""One real concept path in the base, taken from the navigated listing rather than guessed."""
from portfolio_optimiser import okf
@ -102,7 +102,7 @@ def test_a_requirement_the_run_never_opened_is_refused_and_recorded_nowhere() ->
"""(a) The declaration's one falsifier is the run's own read trace."""
tools, _opened, declared = _wired()
answer = tools["declare_requirement"].func(
approach_id="a1", bundle_id="tunnel-hauglia", path=_a_concept(), ref="12.1"
approach_id="a1", bundle_id="driftssenter-kjoling", path=_a_concept(), ref="12.1"
)
assert answer["refusal"] == "RequirementNotRead"
assert "0 document(s)" in answer["refused"]
@ -120,17 +120,17 @@ def test_the_correction_is_to_read_it_and_then_it_is_accepted() -> None:
tools, opened, declared = _wired()
from portfolio_optimiser import okf
files = [f.name for f in okf.navigate_bundle(str(_TUNNEL)).context_files]
files = [f.name for f in okf.navigate_bundle(str(_KJOLING)).context_files]
path = files[0]
body = tools["read_file"].func(bundle_id="tunnel-hauglia", path=path)
body = tools["read_file"].func(bundle_id="driftssenter-kjoling", path=path)
assert not body.startswith("REFUSED"), body[:120]
# The recorder is middleware in a real run; here the trace is appended directly, which is the
# SAME list the tool reads.
for other in files[1:3]:
opened.append(ToolCall(name="read_file", bundle_id="tunnel-hauglia", path=other))
opened.append(ToolCall(name="read_file", bundle_id="tunnel-hauglia", path=path))
opened.append(ToolCall(name="read_file", bundle_id="driftssenter-kjoling", path=other))
opened.append(ToolCall(name="read_file", bundle_id="driftssenter-kjoling", path=path))
answer = tools["declare_requirement"].func(
approach_id="a1", bundle_id="tunnel-hauglia", path=path, ref="Krav 12.1"
approach_id="a1", bundle_id="driftssenter-kjoling", path=path, ref="Krav 12.1"
)
# P20/A1 widened the reply: the three arguments PLUS the document's own title and number and
# the sentence saying what the declaration binds. Asserted key by key rather than by equality,
@ -138,7 +138,7 @@ def test_the_correction_is_to_read_it_and_then_it_is_accepted() -> None:
# the one property this arm exists for — that the declaration was ACCEPTED and RECORDED.
assert answer["declared"] is True
assert (answer["bundle_id"], answer["path"], answer["ref"]) == (
"tunnel-hauglia",
"driftssenter-kjoling",
path,
"Krav 12.1",
)
@ -154,7 +154,7 @@ def test_the_correction_is_to_read_it_and_then_it_is_accepted() -> None:
}
assert declared == [
DeclaredRequirement(
bundle_id="tunnel-hauglia", path=path, ref="Krav 12.1", approach_id="a1"
bundle_id="driftssenter-kjoling", path=path, ref="Krav 12.1", approach_id="a1"
)
]
@ -172,14 +172,14 @@ def test_a_declaration_naming_an_unknown_base_is_refused() -> None:
def test_the_rung_exists_only_when_both_sinks_are_offered() -> None:
"""(d) Every pre-P19 call site is byte-identical, and a half-wired one is refused."""
plain = {t.name for t in navigator_tools((str(_TUNNEL),))}
plain = {t.name for t in navigator_tools((str(_KJOLING),))}
assert plain == {"list_bundles", "read_bundle", "read_dir", "read_file"}
wired, _, _ = _wired()
assert set(wired) == plain | {"declare_requirement"}
with pytest.raises(explore.ExplorationError, match="together or not at all"):
navigator_tools((str(_TUNNEL),), requirements=[])
navigator_tools((str(_KJOLING),), requirements=[])
with pytest.raises(explore.ExplorationError, match="together or not at all"):
navigator_tools((str(_TUNNEL),), opened=[])
navigator_tools((str(_KJOLING),), opened=[])
# ---------------------------------------------------------------------------------------------
@ -238,16 +238,16 @@ def test_the_binding_requirement_reaches_the_proposer_verbatim() -> None:
"""(g) A3, and the byte-identical half is what keeps the golden transcript unchanged."""
bare = Approach(id="a1", label="L", description="D")
with_req = bare.model_copy(
update={"requirement": BindingRequirement(path="R761/12-1/x.md", ref="12.1")}
update={"requirement": BindingRequirement(path="P900/12-1/x.md", ref="12.1")}
)
without = _build_messages(_project(), "ctx", approach=bare)[0].text
withit = _build_messages(_project(), "ctx", approach=with_req)[0].text
assert "Binding requirement" not in without
assert "Binding requirement: 12.1 (R761/12-1/x.md)" in withit
assert "Binding requirement: 12.1 (P900/12-1/x.md)" in withit
# The ONLY difference is the block — an approach without one is byte-identical to before.
assert (
withit.replace(
"Binding requirement: 12.1 (R761/12-1/x.md)\nName that requirement verbatim in 'measure'.\n",
"Binding requirement: 12.1 (P900/12-1/x.md)\nName that requirement verbatim in 'measure'.\n",
"",
)
== without