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
|
|
@ -66,9 +66,9 @@ from portfolio_optimiser.verdicts import (
|
|||
)
|
||||
|
||||
_PROJECT_ID = "BYGG-KONTOR-NORD"
|
||||
# The delivered domain bundle (commons `002f000`) — the project the demo runs on stage. Kept beside
|
||||
# the reserve's id rather than replacing it: the reserve stays reachable as the abort path.
|
||||
_VEGLYS_PROJECT_ID = "VEGLYS-FV-SOER"
|
||||
# The delivered domain bundle — the project the demo runs on stage. Kept beside the reserve's id
|
||||
# rather than replacing it: the reserve stays reachable as the abort path.
|
||||
_KLIENTPARK_PROJECT_ID = "KLIENTPARK-ENERGI"
|
||||
|
||||
# --- P4 pkt. 2: demo stderr discipline -----------------------------------------------------------
|
||||
# Measured 2026-08-09, the demo wrote six stderr lines: two ``ExperimentalWarning``s from
|
||||
|
|
@ -232,35 +232,35 @@ _CANDIDATES: tuple[ScriptedCandidate, ...] = (
|
|||
),
|
||||
flip_key="250000",
|
||||
),
|
||||
# VEGLYS-FV-SOER — the DELIVERED bundle (commons `002f000`), and the one on stage. Every number
|
||||
# below is written FROM `shared/examples/veglys-fv-soer/validator-input.json`, never beside it
|
||||
# (plan P3 b): this is `baseline_from_scripted_candidate`'s direction REVERSED — the domain team
|
||||
# shipped the cost lines, so the register copies them, and the derivation helper is not used on
|
||||
# this path (`main` reads the delivered `cost-baseline.json` off the bundle instead).
|
||||
# KLIENTPARK-ENERGI — the DELIVERED bundle, and the one on stage. Every number below is written
|
||||
# FROM `data/bundles/klientpark-energi/validator-input.json`, never beside it (plan P3 b): this
|
||||
# is `baseline_from_scripted_candidate`'s direction REVERSED — the bundle ships the cost lines,
|
||||
# so the register copies them, and the derivation helper is not used on this path (`main` reads
|
||||
# the delivered `cost-baseline.json` off the bundle instead).
|
||||
#
|
||||
# The corrected reply IS the delivered IR projection verbatim: affected_items = the WHOLE
|
||||
# portfolio's annual energy cost (their decision — scoping it to the 2 500 touched points would
|
||||
# make the RIGHT proposal 38,6 % of its own baseline and the 30 % cap would fell it on stage),
|
||||
# claimed_saving_nok = 445500, assumptions = the declared energy-price band. The overclaimed one
|
||||
# differs in exactly ONE field.
|
||||
# portfolio's annual energy cost (the bundle's decision — scoping it to the 2 500 replaced
|
||||
# machines would make the RIGHT proposal 38,6 % of its own baseline and the 30 % cap would fell
|
||||
# it on stage), claimed_saving_nok = 445500, assumptions = the declared energy-price band. The
|
||||
# overclaimed one differs in exactly ONE field.
|
||||
#
|
||||
# 2100000 is chosen OUTSIDE commons' number inventory and above BOTH thresholds: measured absent
|
||||
# 2100000 is chosen OUTSIDE the bundle's numbers and above BOTH thresholds: measured absent
|
||||
# from the bundle (so the correction is caused by the falsification travelling back), and above
|
||||
# the degenerate cap 0.30 x 4386150 = 1315845 as well as the banded P90. 600000/900000 would have
|
||||
# CLEARED the gate — the REJECTED line would never appear and demo-criterion 2 would fail quietly.
|
||||
ScriptedCandidate(
|
||||
project_id=_VEGLYS_PROJECT_ID,
|
||||
project_id=_KLIENTPARK_PROJECT_ID,
|
||||
overclaimed=(
|
||||
'{"measure":"LED-utskifting av 2 500 eldre HPS-armaturer (114 W -> 70 W)",'
|
||||
'"affected_items":[{"code":"ENERGI-VEGLYS-EL","quantity":4386150,"unit_cost":1.0}],'
|
||||
'{"measure":"Utskifting av 2 500 eldre stasjonære PC-er (114 W -> 70 W)",'
|
||||
'"affected_items":[{"code":"ENERGI-KLIENTPARK-EL","quantity":4386150,"unit_cost":1.0}],'
|
||||
'"claimed_saving_nok":2100000,'
|
||||
'"assumptions":{"ENERGI-VEGLYS-EL":[0.70,1.40]}}'
|
||||
'"assumptions":{"ENERGI-KLIENTPARK-EL":[0.70,1.40]}}'
|
||||
),
|
||||
corrected=(
|
||||
'{"measure":"LED-utskifting av 2 500 eldre HPS-armaturer (114 W -> 70 W)",'
|
||||
'"affected_items":[{"code":"ENERGI-VEGLYS-EL","quantity":4386150,"unit_cost":1.0}],'
|
||||
'{"measure":"Utskifting av 2 500 eldre stasjonære PC-er (114 W -> 70 W)",'
|
||||
'"affected_items":[{"code":"ENERGI-KLIENTPARK-EL","quantity":4386150,"unit_cost":1.0}],'
|
||||
'"claimed_saving_nok":445500,'
|
||||
'"assumptions":{"ENERGI-VEGLYS-EL":[0.70,1.40]}}'
|
||||
'"assumptions":{"ENERGI-KLIENTPARK-EL":[0.70,1.40]}}'
|
||||
),
|
||||
flip_key="2100000",
|
||||
),
|
||||
|
|
@ -275,20 +275,24 @@ _COST_BASELINE_FILE = "cost-baseline.json"
|
|||
_ANCHORED_DIR_NAME = "forankret-reserve"
|
||||
_RESERVE_PROVENANCE = "tallene er syntetiske — avledet av demo-manuset, ikke levert av et fagmiljø"
|
||||
# The GO-day honesty sentence (plan P4 pkt. 4). It claims exactly what the bundle's own `_note`
|
||||
# documents — the cost line is derived from published sources — and nothing about the realization
|
||||
# rate, which the seed verdict itself marks as BORROWED from lighting-programme literature.
|
||||
_VEGLYS_PROVENANCE = (
|
||||
"tallene er levert i kunnskapsbasen — utledet av fagkilder (Håndbok V124, NMFV), "
|
||||
# documents — the cost line is derived from the knowledge base's own (fictional) sources — and
|
||||
# nothing about the realization rate, which the seed verdict itself marks as BORROWED.
|
||||
_KLIENTPARK_PROVENANCE = (
|
||||
"tallene er levert i kunnskapsbasen — utledet av dens egne (fiktive) kilder, "
|
||||
"ikke av demo-manuset"
|
||||
)
|
||||
|
||||
#: The package's own example bundles, reached through a ``__file__``-relative path — the same
|
||||
#: convention ``costsim`` uses for the packaged ``data/`` directory, so an installed wheel has it.
|
||||
_PACKAGED_BUNDLES = Path(__file__).resolve().parent / "data" / "bundles"
|
||||
|
||||
|
||||
def _delivered_bundle_dir() -> Path:
|
||||
"""The delivered VEGLYS bundle, resolved at CALL time via ``shared_root()`` (same seam as
|
||||
``_default_bundle_dir``). It ships its own ``cost-baseline.json``, so the demo is anchored
|
||||
WITHOUT ``materialize_anchored_bundle`` — that helper exists for the reserve, whose numbers
|
||||
cannot be given a baseline in place (pull-only subtree + byte-unchanged goldens)."""
|
||||
return shared_root() / "examples" / "veglys-fv-soer"
|
||||
"""The delivered KLIENTPARK bundle, packaged under ``data/bundles/`` (never under the pull-only
|
||||
``shared/`` subtree). It ships its own ``cost-baseline.json``, so the demo is anchored WITHOUT
|
||||
``materialize_anchored_bundle`` — that helper exists for the reserve, whose numbers cannot be
|
||||
given a baseline in place (pull-only subtree + byte-unchanged goldens)."""
|
||||
return _PACKAGED_BUNDLES / "klientpark-energi"
|
||||
|
||||
|
||||
def baseline_from_scripted_candidate(candidate: ScriptedCandidate) -> CostBaseline:
|
||||
|
|
@ -1075,13 +1079,13 @@ def main(argv: list[str] | None = None) -> int: # pragma: no cover - console tr
|
|||
|
||||
work = tempfile.mkdtemp(prefix="po-sim-")
|
||||
# THE call site (P3, GO): the demo runs the DELIVERED bundle, which ships its own
|
||||
# `cost-baseline.json` — so the gate is anchored on numbers a domain team wrote, not on numbers
|
||||
# `cost-baseline.json` — so the gate is anchored on numbers the base states, not on numbers
|
||||
# the script derived. The abort path is these three lines reverted to the anchored reserve
|
||||
# (`materialize_anchored_bundle` + `_RESERVE_PROVENANCE` + `_PROJECT_ID`); the run path's seam
|
||||
# is identical either way, which is what made pointing at delivered content a call-site change.
|
||||
bundle = _delivered_bundle_dir()
|
||||
provenance = _VEGLYS_PROVENANCE
|
||||
project_id = _VEGLYS_PROJECT_ID
|
||||
provenance = _KLIENTPARK_PROVENANCE
|
||||
project_id = _KLIENTPARK_PROJECT_ID
|
||||
result = asyncio.run(simulate_learning_loop(str(bundle), work, project_id=project_id))
|
||||
|
||||
print("=" * 78)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue