feat(portfolio): fold in RAILIANCE-WP-0016 apps-pg evidence
First delegated evidence from RESOURCE-WP-0003-T04 to land. railiance-platform delivered apps-pg capacity, utilization, consumers, and the apps-pg-dbbytes-v1 allocation driver, and correctly delivered no EUR. - data/resources/apps-pg.json: real capacity; allocation unattributed -> shared under apps-pg-dbbytes-v1; second consumer vergabe-teilnahme registered - data/control-cycle/apps-pg-2026-09-base.json: first operational control-cycle record in the repository - examples/control-cycle/apps-pg-*.json retired; the invented fixture collided with the real record's identifier - data/portfolio-coverage-2026-08-14.json: gap marked delivered with three residual unknowns still open The real evidence exposed a design gap in the T05 schema: v0.1 required a number for every cost field, so recording genuine usage without a booked cost meant inventing one. Schema 0.2 permits null costs, null unattributed_eur, a technical unattributed_share, and null measurements. Null is unknown, never zero; an unknown component makes the total null rather than the sum of the known parts; and the comparator classifies unknown amounts as data_quality instead of computing a variance. Existing 0.1 records are not rewritten. apps-pg is now measured (idle at 5.8% of volume) and attributed, and remains unpriced: delivered technical evidence does not create a booked cost. 86 tests pass. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
b64b5683df
commit
17de8b831e
16 changed files with 908 additions and 71 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import json
|
||||
import sys
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
|
|
@ -50,5 +51,77 @@ class ControlCycleTest(unittest.TestCase):
|
|||
self.assertEqual("data_quality", result["usage_proxies"]["stored_gb"]["category"])
|
||||
|
||||
|
||||
class UnknownCostTest(unittest.TestCase):
|
||||
"""Schema 0.2: a cost the authoritative repository has not supplied is
|
||||
unknown, not zero, and must not produce a fabricated variance."""
|
||||
|
||||
def test_unknown_cost_reports_status_rather_than_an_error_figure(self):
|
||||
forecast, actual = record(), record("actual")
|
||||
forecast["costs"].update(infrastructure=None, total=None)
|
||||
actual["costs"].update(infrastructure=None, total=None)
|
||||
result = compare(forecast, actual)["costs"]["infrastructure"]
|
||||
self.assertEqual("unknown", result["status"])
|
||||
self.assertNotIn("error", result)
|
||||
|
||||
def test_unknown_cost_is_a_data_quality_gap_not_a_price_movement(self):
|
||||
forecast, actual = record(), record("actual")
|
||||
actual["costs"].update(infrastructure=None, total=None)
|
||||
actual["variance_attribution"] = {"costs.infrastructure": "provider_price"}
|
||||
result = compare(forecast, actual)["costs"]["infrastructure"]
|
||||
self.assertEqual("data_quality", result["category"])
|
||||
|
||||
def test_known_components_still_compute_beside_an_unknown_one(self):
|
||||
forecast, actual = record(), record("actual")
|
||||
forecast["costs"].update(infrastructure=None, total=None)
|
||||
actual["costs"].update(infrastructure=None, internal_labor=90, total=None)
|
||||
result = compare(forecast, actual)["costs"]
|
||||
self.assertEqual("unknown", result["infrastructure"]["status"])
|
||||
self.assertEqual(30, result["internal_labor"]["error"])
|
||||
|
||||
def test_one_sided_unknown_does_not_subtract_against_a_missing_amount(self):
|
||||
forecast, actual = record(), record("actual")
|
||||
actual["costs"].update(infrastructure=None, total=None)
|
||||
result = compare(forecast, actual)["costs"]["infrastructure"]
|
||||
self.assertEqual("unknown", result["status"])
|
||||
self.assertEqual(10, result["forecast"])
|
||||
self.assertIsNone(result["actual"])
|
||||
|
||||
|
||||
class OperationalRecordTest(unittest.TestCase):
|
||||
"""The first real apps-pg record, folded in from RAILIANCE-WP-0016."""
|
||||
|
||||
def setUp(self):
|
||||
path = Path(__file__).parents[1] / "data" / "control-cycle" / "apps-pg-2026-09-base.json"
|
||||
self.record = json.loads(path.read_text())
|
||||
|
||||
def test_usage_is_known_while_infrastructure_cost_is_not(self):
|
||||
costs = self.record["costs"]
|
||||
self.assertIsNone(costs["infrastructure"])
|
||||
self.assertIsNone(costs["total"])
|
||||
self.assertEqual(30.0, costs["internal_labor"])
|
||||
self.assertTrue(self.record["usage_proxies"])
|
||||
|
||||
def test_total_is_not_the_sum_of_the_known_parts(self):
|
||||
costs = self.record["costs"]
|
||||
known = costs["internal_labor"] + costs["external_labor"]
|
||||
self.assertNotEqual(known, costs["total"])
|
||||
self.assertIsNone(costs["total"])
|
||||
|
||||
def test_shared_overhead_is_recorded_as_a_share_before_any_eur_exists(self):
|
||||
allocation = self.record["allocation"]
|
||||
self.assertEqual("apps-pg-dbbytes-v1", allocation["method_version"])
|
||||
self.assertIsNone(allocation["unattributed_eur"])
|
||||
self.assertEqual(0.948, allocation["unattributed_share"])
|
||||
|
||||
def test_absent_recovery_objectives_are_null_not_optimistic_defaults(self):
|
||||
constraints = self.record["service_constraints"]
|
||||
self.assertIsNone(constraints["rpo_minutes"]["value"])
|
||||
self.assertIsNone(constraints["rto_minutes"]["value"])
|
||||
|
||||
def test_record_cites_the_authoritative_platform_evidence(self):
|
||||
self.assertIn("RAILIANCE-WP-0016", self.record["evidence"])
|
||||
self.assertEqual("high", self.record["uncertainty"]["level"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue