Implement governance workflows and close WP-0008

This commit is contained in:
codex
2026-07-03 01:27:37 +02:00
parent a76e57ba89
commit a9a55e19f1
11 changed files with 1177 additions and 74 deletions

View File

@@ -9,6 +9,7 @@ from .economics import build_liquidity_summary, build_snapshot
from .load import (
default_data_dir,
latest_period,
load_governance_policy,
load_ltv_scenarios,
load_budget,
load_expense_records,
@@ -24,6 +25,7 @@ from .load import (
from .allocation import build_cost_allocation
from .boundary import build_boundary_validation
from .credits import build_credit_summary, load_credit_wallets
from .governance import build_governance_policy, build_governance_surfaces
from .membership_analytics import build_membership_analytics
from .pricing_context import build_cost_floor, build_market_price_view, build_value_range_view
from .publication import build_stripe_publication_preview
@@ -92,8 +94,10 @@ def build_dashboard_payload(data_dir: Path | None = None, period: str | None = N
market_raw = load_market_signals(root)
usage_records = load_usage_records(root)
usage_summary = build_usage_summary(usage_records, target_period)
governance_policy_raw = load_governance_policy(root)
ltv_scenarios = load_ltv_scenarios(root)
tuning_requests = load_tuning_requests(root)
governance_policy = build_governance_policy(governance_policy_raw)
cost_floor = build_cost_floor(snapshot, models)
value_range = build_value_range_view(value_range_raw, snapshot, product, models)
market_price = build_market_price_view(market_raw)
@@ -114,6 +118,12 @@ def build_dashboard_payload(data_dir: Path | None = None, period: str | None = N
tuning_requests,
)
boundary_validation = build_boundary_validation(snapshot, models, usage_records)
provider_publication = build_stripe_publication_preview(
product,
models,
root,
model_id=product.active_pricing_model_id,
)
credit_wallets = load_credit_wallets(root)
credit_summary = build_credit_summary(
credit_wallets,
@@ -121,13 +131,25 @@ def build_dashboard_payload(data_dir: Path | None = None, period: str | None = N
target_period,
)
recommendations = build_pricing_recommendations(
cost_floor, value_range, market_price, simulations, usage_summary
cost_floor,
value_range,
market_price,
simulations,
usage_summary,
boundary_validation=boundary_validation,
customer_tuning=customer_tuning,
provider_publication=provider_publication,
governance_policy=governance_policy_raw,
product=product,
)
provider_publication = build_stripe_publication_preview(
governance = build_governance_surfaces(
root,
product,
models,
root,
model_id=product.active_pricing_model_id,
cost_floor,
customer_tuning,
provider_publication,
governance_policy,
)
return _serialize(
@@ -156,6 +178,7 @@ def build_dashboard_payload(data_dir: Path | None = None, period: str | None = N
"boundary_validation": boundary_validation,
"credit_wallets": credit_summary,
"recommendations": recommendations,
"governance": governance,
"provider_publication": provider_publication,
"infrastructure": {
"domains": _load_json_catalog(root, "domains.json"),