feat(fase1): export domain-model public API + green full suite (F1)

This commit is contained in:
Kjell Tore Guttormsen 2026-07-07 08:17:10 +02:00
commit 847ed90135
2 changed files with 49 additions and 1 deletions

View file

@ -1,13 +1,39 @@
"""portfolio-optimiser — generic MAF framework for per-project cost-savings optimization."""
from portfolio_optimiser.run import PortfolioResult, RunResult, run_portfolio, run_project
from portfolio_optimiser.contracts import GoalConfig, GoalContract, load_goal_config
from portfolio_optimiser.dimension import Dimension, admits
from portfolio_optimiser.ledger import (
LedgerEntry,
RealizationRefused,
SavingsLedger,
realize,
)
from portfolio_optimiser.run import (
GoalReached,
PortfolioResult,
RunResult,
run_portfolio,
run_project,
)
__version__ = "0.1.0"
__all__ = [
# Portfolio orchestration
"PortfolioResult",
"RunResult",
"run_portfolio",
"run_project",
# Fase 1 domain model
"Dimension",
"admits",
"SavingsLedger",
"LedgerEntry",
"realize",
"RealizationRefused",
"GoalContract",
"GoalConfig",
"load_goal_config",
"GoalReached",
"__version__",
]

View file

@ -21,3 +21,25 @@ def test_core_runtime_deps_importable_and_cbc_available() -> None:
# PuLP 3.3.2's available() returns the resolved CBC binary PATH (a truthy str) when
# present, not the bool True — so assert truthiness, not identity.
assert pulp.PULP_CBC_CMD(msg=False).available()
def test_fase1_domain_model_public_api_importable() -> None:
"""SC10: every Fase 1 domain-model symbol is importable from the package root (the explicit
__all__ export), so a deployer reaches the new API without deep-importing submodules."""
import portfolio_optimiser as po
expected = {
"Dimension",
"admits",
"SavingsLedger",
"LedgerEntry",
"realize",
"RealizationRefused",
"GoalContract",
"GoalConfig",
"load_goal_config",
"GoalReached",
}
assert expected <= set(po.__all__) # each is publicly exported
for name in expected:
assert hasattr(po, name), f"{name} is in __all__ but not importable from the package root"