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

@ -53,9 +53,9 @@ from portfolio_optimiser.ledger import LedgerEntry, SavingsLedger
from portfolio_optimiser.run import BudgetStop, PortfolioResult, RunFailure
from portfolio_optimiser.verdicts import VerdictStore
# The same caller-supplied answers the single-project door documents. On the shipped ROAD
# The same caller-supplied answers the single-project door documents. On the shipped REFERENCE
# portfolio these are rejected by S4.0's baseline anchoring (the cost code belongs to the bygg
# bundle, not to a road project's estimate) — which is the correct outcome and is beside the
# bundle, not to a reference project's estimate) — which is the correct outcome and is beside the
# point here: the blades below assert that the pass RUNS offline, not that it validates.
_VALID_PROPOSAL = (
'{"measure":"LED-retrofit av kontorbelysning","affected_items":'
@ -142,7 +142,7 @@ def test_no_banner_in_portfolio_mode_without_the_flag(tmp_path, capsys) -> None:
led = SavingsLedger()
led.add_realized(
LedgerEntry(
project_id="FV42-GSV-E1",
project_id="KONTOR-IT-E1",
dimension="energi",
candidate_identity="c1",
amount_ore=1,
@ -204,23 +204,23 @@ def test_failures_are_visible_with_their_own_values(stub_portfolio, capsys) -> N
stub_portfolio(
_result(
failures=(
RunFailure("FV42-GSV-E1", "Connection error.", "APIConnectionError"),
RunFailure("RV13-RAS-TP", "budget blew up", "BudgetExceeded"),
RunFailure("KONTOR-IT-E1", "Connection error.", "APIConnectionError"),
RunFailure("NETT-SIKR-TP", "budget blew up", "BudgetExceeded"),
)
)
)
rc = run.main(["--portfolio"])
err = capsys.readouterr().err
assert rc == 1
assert "FV42-GSV-E1" in err and "Connection error." in err
assert "RV13-RAS-TP" in err and "budget blew up" in err
assert "KONTOR-IT-E1" in err and "Connection error." in err
assert "NETT-SIKR-TP" in err and "budget blew up" in err
assert "APIConnectionError" in err and "BudgetExceeded" in err
def test_a_pass_with_failures_does_not_exit_zero(stub_portfolio, capsys) -> None:
"""Blade 6 — silence-as-success was the worse half of the defect: a scripted caller checking
only rc learned nothing. MEASURED before the fix: four dead projects, rc 0."""
stub_portfolio(_result(failures=(RunFailure("FV42-GSV-E1", "boom", "RuntimeError"),)))
stub_portfolio(_result(failures=(RunFailure("KONTOR-IT-E1", "boom", "RuntimeError"),)))
assert run.main(["--portfolio"]) == 1
capsys.readouterr()
@ -246,7 +246,7 @@ def test_completed_runs_still_print_alongside_a_failure(replies_file, monkeypatc
genuine = await real_run_portfolio(*args, **kwargs)
return _result(
runs=genuine.runs,
failures=(RunFailure("RV13-RAS-TP", "boom", "RuntimeError"),),
failures=(RunFailure("NETT-SIKR-TP", "boom", "RuntimeError"),),
)
monkeypatch.setattr(run, "run_portfolio", _fake)
@ -254,7 +254,7 @@ def test_completed_runs_still_print_alongside_a_failure(replies_file, monkeypatc
captured = capsys.readouterr()
assert rc == 1
assert captured.out.count("verdict id=") == 4, captured.out
assert "RV13-RAS-TP" in captured.err
assert "NETT-SIKR-TP" in captured.err
def test_budget_stop_is_visible_with_its_own_numbers(stub_portfolio, capsys) -> None: