feat: operational resource procurement facility

Implement RESOURCE-WP-0005: entity register, V0.1 terms parameters,
entity association on inventory and planning records, transfer-price
and credit-state arithmetic, monthly settlement, and entity views on
the portfolio report. Live close emits nothing until delivered cost
is known. Handoffs are FIN-WP-0006 and RAILIANCE-WP-0017.
This commit is contained in:
tegwick 2026-08-14 13:15:02 +02:00
parent 325a505980
commit f8d1c542d5
37 changed files with 1316 additions and 28 deletions

View file

@ -0,0 +1,29 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://coulomb.social/resource-control/financial-entity-register.schema.json",
"title": "Financial entity register v0.1",
"type": "object",
"additionalProperties": false,
"required": ["schema_version", "terms_version", "entities"],
"properties": {
"schema_version": {"const": "0.1"},
"terms_version": {"type": "string", "minLength": 1},
"entities": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["id", "display_name", "role", "credit_limit_eur", "account_ref", "status"],
"properties": {
"id": {"type": "string", "pattern": "^entity:[a-z0-9]+$"},
"display_name": {"type": "string", "minLength": 1},
"role": {"enum": ["umbrella", "provider", "consumer"]},
"credit_limit_eur": {"type": ["string", "null"], "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"account_ref": {"type": ["string", "null"]},
"status": {"enum": ["active", "suspended", "retired"]}
}
}
}
}
}

View file

@ -25,6 +25,9 @@
"tenant_id": {"type": ["string", "null"]},
"environment": {"type": ["string", "null"]},
"cost_attribution_key": {"type": ["string", "null"]},
"financial_entity_id": {"type": ["string", "null"], "pattern": "^entity:[a-z0-9]+$"},
"procuring_entity_id": {"type": ["string", "null"], "pattern": "^entity:[a-z0-9]+$"},
"entity_gap": {"type": ["string", "null"]},
"period_start": {"type": "string", "format": "date"},
"period_end": {"type": "string", "format": "date"},
"source_evidence": {"type": "array", "items": {"type": "string"}},
@ -55,6 +58,8 @@
"scenario": {"enum": ["low", "base", "high"]},
"forecast_version": {"type": "string", "minLength": 1},
"costs": {"$ref": "#/$defs/cost_breakdown"},
"transfer_price": {"$ref": "#/$defs/money"},
"credit_headroom": {"type": ["string", "null"], "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"uncertainty": {"type": ["string", "null"]},
"assumptions": {"type": "array", "items": {"type": "string"}}
}

View file

@ -0,0 +1,37 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://coulomb.social/resource-control/procurement-terms.schema.json",
"title": "Terms of Resource Procurement parameters",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"terms_version",
"currency",
"markup_rate",
"railiance_self_markup_rate",
"settlement_period",
"payment_term_days",
"interest_rate_per_year",
"interest_convention",
"default_credit_limit_eur",
"restricted_monthly_consumption_eur",
"procuring_entity_id",
"labor_rate_eur_per_hour"
],
"properties": {
"schema_version": {"const": "0.1"},
"terms_version": {"type": "string", "minLength": 1},
"currency": {"const": "EUR"},
"markup_rate": {"type": "string", "pattern": "^0\\.[0-9]{2}$"},
"railiance_self_markup_rate": {"type": "string", "pattern": "^0\\.[0-9]{2}$"},
"settlement_period": {"const": "calendar_month"},
"payment_term_days": {"type": "integer", "minimum": 1},
"interest_rate_per_year": {"type": "string", "pattern": "^0\\.[0-9]{2}$"},
"interest_convention": {"const": "simple_monthly"},
"default_credit_limit_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"restricted_monthly_consumption_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"procuring_entity_id": {"type": "string", "pattern": "^entity:[a-z0-9]+$"},
"labor_rate_eur_per_hour": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"}
}
}

View file

@ -41,6 +41,21 @@
"type": "string",
"pattern": "^resource:"
},
"financial_entity_id": {
"type": ["string", "null"],
"pattern": "^entity:[a-z0-9]+$"
},
"procuring_entity_id": {
"type": ["string", "null"],
"pattern": "^entity:[a-z0-9]+$"
},
"entity_gap": {
"type": ["string", "null"]
},
"transfer_price": {
"type": ["number", "null"],
"minimum": 0
},
"resource_class": {
"enum": [
"storage",

View file

@ -9,6 +9,9 @@
"schema_version": {"const": "0.2"},
"record_scope": {"enum": ["inventory", "example"]},
"id": {"type": "string", "pattern": "^resource:[a-z0-9][a-z0-9:_-]+$"},
"financial_entity_id": {"type": ["string", "null"], "pattern": "^entity:[a-z0-9]+$"},
"procuring_entity_id": {"type": ["string", "null"], "pattern": "^entity:[a-z0-9]+$"},
"entity_gap": {"type": ["string", "null"]},
"resource_class": {"enum": ["compute_instance", "storage", "network", "kubernetes_capacity", "database", "managed_service", "self_managed_service", "shared_platform_service", "license"]},
"status": {"enum": ["proposed", "ordered", "commissioning", "active", "suspended", "retiring", "retired", "rejected"]},
"management_model": {"enum": ["provider_managed", "self_managed", "shared_capacity"]},
@ -71,7 +74,19 @@
"mode": {"enum": ["dedicated", "shared", "unattributed"]},
"cost_attribution_key": {"type": ["string", "null"]},
"driver": {"type": ["string", "null"]},
"method_version": {"type": ["string", "null"]}
"method_version": {"type": ["string", "null"]},
"entity_shares": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": false,
"required": ["financial_entity_id", "note"],
"properties": {
"financial_entity_id": {"type": "string", "pattern": "^entity:[a-z0-9]+$"},
"note": {"type": "string"}
}
}
}
}
}
}

View file

@ -0,0 +1,54 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://coulomb.social/resource-control/settlement-statement.schema.json",
"title": "Internal settlement statement v0.1",
"type": "object",
"additionalProperties": false,
"required": [
"schema_version",
"record_type",
"terms_version",
"financial_entity_id",
"procuring_entity_id",
"period",
"statement_date",
"due_date",
"currency",
"line_items",
"known_delivered_cost_eur",
"known_transfer_price_eur",
"unknown_cost_remainder",
"prior_outstanding_eur",
"payment_recognition",
"interest_eur",
"new_transfer_charges_eur",
"outstanding_eur",
"consumption_mode"
],
"properties": {
"schema_version": {"const": "0.1"},
"record_type": {"const": "settlement_statement"},
"terms_version": {"type": "string", "minLength": 1},
"financial_entity_id": {"type": "string", "pattern": "^entity:[a-z0-9]+$"},
"procuring_entity_id": {"type": "string", "pattern": "^entity:[a-z0-9]+$"},
"period": {"type": "string", "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$"},
"statement_date": {"type": "string", "format": "date"},
"due_date": {"type": "string", "format": "date"},
"currency": {"const": "EUR"},
"line_items": {"type": "array"},
"known_delivered_cost_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"known_transfer_price_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"unknown_cost_remainder": {"type": "boolean"},
"prior_outstanding_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"recognized_payments_eur": {"type": ["string", "null"]},
"payment_recognition": {"enum": ["unknown", "recognized"]},
"interest_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"new_transfer_charges_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"outstanding_eur": {"type": "string", "pattern": "^(0|[1-9][0-9]*)\\.[0-9]{2}$"},
"credit_limit_eur": {"type": ["string", "null"]},
"credit_headroom_eur": {"type": ["string", "null"]},
"consumption_mode": {"enum": ["open", "restricted"]},
"next_month_allowance_eur": {"type": ["string", "null"]},
"payment_instruction": {"type": ["object", "null"]}
}
}