Trace a complete decision
This tutorial explains the public object flow from installation to evaluation. The example is bounded and reviewable: it shows how to build a contract, admit evidence and interpret the resulting state.
Install the public wheel:
python -m pip install --pre assurance-lab. Then import the library as assurance_lab. See the PyPI project page for package metadata and release files.1. Start with the assurance question
Question: at the review time, does the checkout service have attributable evidence that its backup is fresh?
The question fixes the subject (checkout), assertion (backup_fresh), criterion (True) and evaluation time. It does not claim that every recovery dependency has been tested.
2. Declare the contract
from assurance_lab import compile_service_contract contract = compile_service_contract({ "service_id": "checkout", "name": "Checkout service", "controls": [{ "control_id": "backup-freshness", "title": "Backup is fresh", "assertion": "backup_fresh", "expected_value": True, }], "objectives": [], })
3. Admit an observation
The envelope retains evidence identity, subject, observation time, kind and provenance. The transport schema identifies how the payload is interpreted; it is not a library release number.
payload = {
"schema_version": "assurance-telemetry/v1",
"records": [{
"evidence_id": "backup-check-001",
"subject": "checkout",
"assertion": "backup_fresh",
"value": True,
"observed_at": now.isoformat(),
"kind": "runtime",
"provenance": "backup-monitor",
}],
}
batch = ingest_json_envelope(payload, MappingEvidenceAdapter())
4. Evaluate at an explicit time
decision = AssuranceEngine().evaluate( contract, batch.evidence, now=now ) print(decision.state.value) print(decision.reasons)
A reviewer should inspect both the top-level state and its reasons. A state without its contract, evidence identities and evaluation time is not a complete assurance record.
5. Interpret every state
| State | Meaning in this boundary | Typical next action |
|---|---|---|
| PASS | Valid evidence satisfies the declared contract. | Retain the decision; continue monitoring. |
| FAIL | Valid evidence contradicts the expected value or target. | Investigate and execute the approved response. |
| UNKNOWN | Required evidence, binding or trust condition is missing. | Restore observability or collect evidence. |
| EXPIRED | Evidence is outside its validity window. | Refresh the observation. |
| CONFLICT | Relevant observations cannot be reconciled deterministically. | Resolve source authority and provenance. |
| NOT_TESTED | No evidence was supplied to the evaluation boundary. | Execute the planned check. |
6. Practice
- Change the value to
Falseand explain why the result is FAIL rather than UNKNOWN. - Remove the record and explain why no positive conclusion is possible.
- Add two observations with different values and decide which source-governance question must be answered.
- Add a payment dependency, then document what evidence would bind it.