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:
parent
058dd25570
commit
37547fe292
1147 changed files with 24138 additions and 9503 deletions
|
|
@ -13,7 +13,7 @@ validates), and the no-baseline arm proves the argument stays OPTIONAL (``None``
|
|||
behaviour, which is why the existing suite stands).
|
||||
|
||||
Measured detach points (see the session log): the reconciliation stage · the magnitude tolerance ·
|
||||
the road-path wiring in ``run.py`` · the bundle-path wiring · the method-cap registry key (F8).
|
||||
the reference-path wiring in ``run.py`` · the bundle-path wiring · the method-cap registry key (F8).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
|
@ -44,7 +44,7 @@ PRE_AMENDMENT_BUNDLE = _DATA / "bygg-energi-mikro-a"
|
|||
|
||||
_VERDICT_INPUT = {"decision": "approved", "rationale": "expert reviewed (sim)"}
|
||||
|
||||
# FV42-GSV-E1's real cost line 05.2 (Asfalt Ab11): 4300 m2 x 215 NOK. Affected total 924500 ->
|
||||
# KONTOR-IT-E1's real cost line 05.2 (Lisens kontorpakke): 4300 licences x 215 NOK. Affected total 924500 ->
|
||||
# degenerate P90 = 0.30 x 924500 = 277350, so claimed 200000 clears every pre-S4.0 stage.
|
||||
_REAL_CODE = "05.2"
|
||||
_REAL_QTY = 4300.0
|
||||
|
|
@ -61,13 +61,13 @@ _FAKE_CLAIM = 3_000_000.0
|
|||
|
||||
def _fv42_baseline() -> CostBaseline:
|
||||
return baseline_from_project(
|
||||
next(p for p in load_reference_projects() if p.id == "FV42-GSV-E1")
|
||||
next(p for p in load_reference_projects() if p.id == "KONTOR-IT-E1")
|
||||
)
|
||||
|
||||
|
||||
def _proposal(code: str, quantity: float, unit_cost: float, claimed: float) -> SavingsProposal:
|
||||
return SavingsProposal(
|
||||
project_id="FV42-GSV-E1",
|
||||
project_id="KONTOR-IT-E1",
|
||||
measure="Reduce scope",
|
||||
affected_items=[AffectedItem(code=code, quantity=quantity, unit_cost=unit_cost)],
|
||||
claimed_saving_nok=claimed,
|
||||
|
|
@ -184,7 +184,7 @@ def test_malformed_baseline_raises_even_on_the_optional_path(tmp_path) -> None:
|
|||
okf.load_optional_cost_baseline(str(tmp_path))
|
||||
|
||||
|
||||
# --- Arm 4: the run-path wiring (road + bundle) ---------------------------------------------------
|
||||
# --- Arm 4: the run-path wiring (reference + bundle) ---------------------------------------------------
|
||||
|
||||
|
||||
def _reply(code: str, quantity: float, unit_cost: float, claimed: float) -> str:
|
||||
|
|
@ -205,11 +205,11 @@ def _factory(reply: str):
|
|||
|
||||
|
||||
async def test_road_path_anchors_the_gate_to_the_reference_baseline(docs_dir, fresh_store) -> None:
|
||||
"""RED (road wiring): a numerically-impeccable fabricated cost line is REJECTED end-to-end
|
||||
through ``run_project``. Detach the road-path baseline (stop passing it) and the same run
|
||||
"""RED (reference wiring): a numerically-impeccable fabricated cost line is REJECTED end-to-end
|
||||
through ``run_project``. Detach the reference-path baseline (stop passing it) and the same run
|
||||
returns a ValidatedProposal."""
|
||||
result = await run_project(
|
||||
"FV42-GSV-E1",
|
||||
"KONTOR-IT-E1",
|
||||
"local",
|
||||
docs_dir=docs_dir,
|
||||
verdict_input=_VERDICT_INPUT,
|
||||
|
|
@ -221,9 +221,9 @@ async def test_road_path_anchors_the_gate_to_the_reference_baseline(docs_dir, fr
|
|||
|
||||
|
||||
async def test_road_path_control_real_line_validates(docs_dir, fresh_store) -> None:
|
||||
"""Causality control for the road wiring: the real 05.2 line validates through the same path."""
|
||||
"""Causality control for the reference wiring: the real 05.2 line validates through the same path."""
|
||||
result = await run_project(
|
||||
"FV42-GSV-E1",
|
||||
"KONTOR-IT-E1",
|
||||
"local",
|
||||
docs_dir=docs_dir,
|
||||
verdict_input=_VERDICT_INPUT,
|
||||
|
|
@ -280,13 +280,13 @@ def test_method_cap_is_keyed_by_config_not_a_hardcoded_string() -> None:
|
|||
cap for a measure with no built-in entry rejects a proposal the generic P90 stage passes — so
|
||||
the rule is keyed by configuration, not by the ``energy_efficiency`` literal."""
|
||||
proposal = SavingsProposal(
|
||||
project_id="P-ASFALT",
|
||||
measure="asfalt_reduction",
|
||||
project_id="P-LISENS",
|
||||
measure="lisens_reduction",
|
||||
affected_items=[AffectedItem(code="05.2", quantity=100000, unit_cost=1.0)],
|
||||
claimed_saving_nok=20000,
|
||||
assumptions={},
|
||||
)
|
||||
assert isinstance(validate_proposal(proposal), ValidatedProposal) # generic P90 = 30000
|
||||
capped = validate_proposal(proposal, method_caps={"asfalt_reduction": 0.10})
|
||||
capped = validate_proposal(proposal, method_caps={"lisens_reduction": 0.10})
|
||||
assert isinstance(capped, Rejection)
|
||||
assert "method cap" in capped.reason
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue