feat(wp-0002): complete T07 — control loop on the live backup resource

The backup is procured and proven, so the loop runs on real evidence.

- data/actuals/2026-08.json: first real observation. database 0.6365 GB,
  stored 0.0066 GB over 8 objects, backup success 1/1, restore RTO 1.08 min.
  Five proxies null, each with a named owner in measurement_gaps.
- data/thresholds/platform-audit-storage.json + tools/thresholds.py: budget
  variance, abnormal growth, stale backup, unused commitment. Fail-closed —
  an unmeasured value is reported as unmeasured, never as within.
- financial_exchange.py gains a usage mode emitting technical_usage records to
  fin-hub, with measurement gaps carried through and no infrastructure amount:
  fin-hub owns the booked fact and a null is never sent as 0.00.
- observation schema 0.2 allows null cost and usage proxies; variance.py fails
  closed rather than reporting a 100% favourable variance on a missing amount.
- platform-audit-storage: ordered -> active, commissioned 2026-08-14, on
  operational fact rather than on the purchase.

The optimization case is now approved by the founder. That needed a schema
change: Host Europe never supplied written terms, so options gained
excluded/exclusion_reason. Previously an unevaluable alternative blocked its
case forever, leaving the record claiming no decision while the bucket was in
production. An excluded option keeps its unknowns and must say what would
bring it back.

August produces no variance and should not: the decision forecast starts at
2026-09, so August is a commissioning baseline. Threshold run is 2 within,
1 not applicable, 6 unmeasured, 0 breaches.

Also fixes a pre-existing test failure: reef-storage consumers_actual is now
rapp-postgres, which the assertion still expected to be empty.

136 tests pass.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
tegwick 2026-08-14 20:53:12 +02:00
parent 2704292d45
commit 10b988fa1c
17 changed files with 1312 additions and 122 deletions

View file

@ -20,12 +20,20 @@
"evidence"
],
"properties": {
"schema_version": { "const": "0.1" },
"schema_version": {
"const": "0.1"
},
"record_scope": {
"description": "operational cases assert real facts; illustrative cases exist only to exercise the mechanism.",
"enum": ["operational", "illustrative"]
"enum": [
"operational",
"illustrative"
]
},
"case_id": {
"type": "string",
"pattern": "^opt:[a-z0-9][a-z0-9:._-]+$"
},
"case_id": { "type": "string", "pattern": "^opt:[a-z0-9][a-z0-9:._-]+$" },
"case_type": {
"enum": [
"rightsizing",
@ -38,42 +46,94 @@
]
},
"trigger": {
"enum": ["cadence", "renewal", "variance", "incident", "request", "procurement"]
"enum": [
"cadence",
"renewal",
"variance",
"incident",
"request",
"procurement"
]
},
"review_period": {
"type": "string",
"pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$"
},
"created_at": {
"type": "string",
"format": "date-time"
},
"review_period": { "type": "string", "pattern": "^[0-9]{4}-(0[1-9]|1[0-2])$" },
"created_at": { "type": "string", "format": "date-time" },
"resource_ids": {
"type": "array",
"minItems": 1,
"uniqueItems": true,
"items": { "type": "string", "pattern": "^resource:" }
"items": {
"type": "string",
"pattern": "^resource:"
}
},
"baseline": {
"$ref": "#/$defs/option"
},
"baseline": { "$ref": "#/$defs/option" },
"alternatives": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/option" }
"items": {
"$ref": "#/$defs/option"
}
},
"decision": {
"type": "object",
"additionalProperties": false,
"required": ["state", "recommended_option_id", "rationale", "approver", "approved_on", "delegated_to"],
"required": [
"state",
"recommended_option_id",
"rationale",
"approver",
"approved_on",
"delegated_to"
],
"properties": {
"state": {
"description": "blocked_on_evidence until every decision field of the compared options is known; proposed once the case computes; then approved or rejected by the named authority.",
"enum": ["blocked_on_evidence", "proposed", "approved", "rejected", "superseded"]
"enum": [
"blocked_on_evidence",
"proposed",
"approved",
"rejected",
"superseded"
]
},
"recommended_option_id": {
"type": [
"string",
"null"
]
},
"rationale": {
"type": "string",
"minLength": 1
},
"recommended_option_id": { "type": ["string", "null"] },
"rationale": { "type": "string", "minLength": 1 },
"approver": {
"description": "Named human or repository authority. Null while the case is not yet decided.",
"type": ["string", "null"]
"type": [
"string",
"null"
]
},
"approved_on": {
"type": [
"string",
"null"
],
"format": "date"
},
"approved_on": { "type": ["string", "null"], "format": "date" },
"delegated_to": {
"description": "Repositories that own any approved implementation. resource-control never implements.",
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"uniqueItems": true
}
}
@ -82,27 +142,49 @@
"description": "What is sent to fin-hub when the case is approved.",
"type": "object",
"additionalProperties": false,
"required": ["cost_attribution_key", "sent"],
"required": [
"cost_attribution_key",
"sent"
],
"properties": {
"cost_attribution_key": { "type": ["string", "null"] },
"sent": { "type": "boolean" },
"reference": { "type": ["string", "null"] }
"cost_attribution_key": {
"type": [
"string",
"null"
]
},
"sent": {
"type": "boolean"
},
"reference": {
"type": [
"string",
"null"
]
}
}
},
"outcome": {
"description": "Closes the loop: which control-cycle records will show whether the case was right.",
"type": "object",
"additionalProperties": false,
"required": ["feeds_forecast", "actual_refs"],
"required": [
"feeds_forecast",
"actual_refs"
],
"properties": {
"feeds_forecast": {
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"uniqueItems": true
},
"actual_refs": {
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"uniqueItems": true
}
}
@ -110,39 +192,84 @@
"evidence": {
"type": "array",
"minItems": 1,
"items": { "$ref": "#/$defs/evidence_ref" }
"items": {
"$ref": "#/$defs/evidence_ref"
}
}
},
"$defs": {
"measurement": {
"type": "object",
"additionalProperties": false,
"required": ["value", "unit"],
"required": [
"value",
"unit"
],
"properties": {
"value": { "type": ["number", "null"] },
"unit": { "type": "string", "minLength": 1 }
"value": {
"type": [
"number",
"null"
]
},
"unit": {
"type": "string",
"minLength": 1
}
}
},
"utilization": {
"type": "object",
"additionalProperties": false,
"required": ["provisioned", "used"],
"required": [
"provisioned",
"used"
],
"properties": {
"provisioned": { "$ref": "#/$defs/measurement" },
"used": { "$ref": "#/$defs/measurement" }
"provisioned": {
"$ref": "#/$defs/measurement"
},
"used": {
"$ref": "#/$defs/measurement"
}
}
},
"evidence_ref": {
"type": "object",
"additionalProperties": false,
"required": ["kind", "ref", "authority"],
"required": [
"kind",
"ref",
"authority"
],
"properties": {
"kind": {
"enum": ["telemetry", "quote", "contract", "invoice", "forecast", "workplan", "document", "decision"]
"enum": [
"telemetry",
"quote",
"contract",
"invoice",
"forecast",
"workplan",
"document",
"decision"
]
},
"ref": { "type": "string", "minLength": 1 },
"authority": { "type": "string", "minLength": 1 },
"observed_at": { "type": ["string", "null"], "format": "date" }
"ref": {
"type": "string",
"minLength": 1
},
"authority": {
"type": "string",
"minLength": 1
},
"observed_at": {
"type": [
"string",
"null"
],
"format": "date"
}
}
},
"option": {
@ -164,41 +291,110 @@
"unknowns"
],
"properties": {
"option_id": { "type": "string", "minLength": 1 },
"label": { "type": "string", "minLength": 1 },
"one_time_eur": { "type": ["number", "null"], "minimum": 0 },
"recurring_infrastructure_eur_month": { "type": ["number", "null"], "minimum": 0 },
"recurring_internal_labor_eur_month": { "type": ["number", "null"], "minimum": 0 },
"recurring_external_labor_eur_month": { "type": ["number", "null"], "minimum": 0 },
"option_id": {
"type": "string",
"minLength": 1
},
"label": {
"type": "string",
"minLength": 1
},
"one_time_eur": {
"type": [
"number",
"null"
],
"minimum": 0
},
"recurring_infrastructure_eur_month": {
"type": [
"number",
"null"
],
"minimum": 0
},
"recurring_internal_labor_eur_month": {
"type": [
"number",
"null"
],
"minimum": 0
},
"recurring_external_labor_eur_month": {
"type": [
"number",
"null"
],
"minimum": 0
},
"utilization": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/utilization" }
"additionalProperties": {
"$ref": "#/$defs/utilization"
}
},
"uncertainty": {
"type": "object",
"additionalProperties": false,
"required": ["level", "notes"],
"required": [
"level",
"notes"
],
"properties": {
"level": { "enum": ["low", "medium", "high"] },
"notes": { "type": "array", "items": { "type": "string" } }
"level": {
"enum": [
"low",
"medium",
"high"
]
},
"notes": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"service_constraints": {
"type": "object",
"additionalProperties": { "$ref": "#/$defs/measurement" }
"additionalProperties": {
"$ref": "#/$defs/measurement"
}
},
"failure_domains": {
"type": "array",
"minItems": 1,
"items": { "type": "string" },
"items": {
"type": "string"
},
"uniqueItems": true
},
"exit_path": { "type": ["string", "null"] },
"exit_path": {
"type": [
"string",
"null"
]
},
"unknowns": {
"description": "Named blocking evidence gaps, each attributable to an owning repository or authority.",
"type": "array",
"items": { "type": "string" },
"items": {
"type": "string"
},
"uniqueItems": true
},
"excluded": {
"type": "boolean",
"default": false,
"description": "True when an alternative could not be evaluated and the deciding authority chose to exclude it rather than wait. An excluded option does not block the case, and its exclusion_reason becomes part of the decision record."
},
"exclusion_reason": {
"type": [
"string",
"null"
],
"description": "Required when excluded is true: why the option was set aside, and what would bring it back."
}
}
}