Design a service contract
A contract is a reviewable statement of what a service must demonstrate. Start with a material outcome, then bind controls and dependencies to explicit evidence—not to keywords.
Ask five questions first
| Question | Contract element | Failure if omitted |
|---|---|---|
| Which service is in scope? | service_id | Evidence can be applied to the wrong subject. |
| Which outcome matters? | objectives | Controls become disconnected from business purpose. |
| What must be observed? | controls | The obligation cannot be evaluated consistently. |
| Which services can invalidate a local result? | dependencies | A local PASS hides upstream uncertainty. |
| Who owns the response? | Contract metadata / response plan | Results are produced without accountable action. |
Model a measurable objective
The API expresses a business objective as a metric, target and comparator. For recovery, a smaller observed time may be better, so the criterion can be restore_minutes <= 60.
contract_spec = {
"service_id": "checkout",
"name": "Checkout service",
"objectives": [{
"objective_id": "restore-orders",
"metric": "restore_minutes",
"target": 60,
"comparator": "<=",
}],
}
Add the supporting control
contract_spec["controls"] = [{ "control_id": "restore-test", "title": "Restore test succeeded", "assertion": "restore_test_passed", "expected_value": True, }] contract_spec["control_objective_links"] = [{ "control_id": "restore-test", "objective_id": "restore-orders", "relation": "measures", "provenance": "approved recovery design", "scope_conditions": ["production-like data volume"], }]
The link records why the control relates to the objective and under which conditions. It does not prove that the relation is universally valid.
Bind critical dependencies
contract_spec["dependencies"] = ["orders-database"] contract_spec["dependency_requirements"] = [{ "dependency_id": "orders-database", "assertion": "database_restored", "expected_value": True, }] contract = compile_service_contract(contract_spec)
Contract review checklist
- The service boundary and exclusions are explicit.
- Every objective has a measurable metric, target and comparator.
- Every control has one unambiguous assertion and expected value.
- Every critical dependency has an evidence binding.
- Control-to-objective links include rationale and scope conditions.
- The decision horizon and response owner are documented outside the evaluator.
Anti-pattern: importing a control catalog and marking every item PASS because a policy document exists. Design evidence for operating effectiveness and the stated decision, not for checklist completion.