Typed runtime contracts

September 8, 2026 ยท View on GitHub

FlagQuantum cross-layer control and evidence use versioned frozen dataclasses from flagquantum.core.contracts. The structural ownership rule is:

  • planners create RuntimePlanContract with only requested, estimated and capability fields;
  • executors create ExecutionRecordContract with observed, ownership, measurement, accuracy, failure and provenance fields;
  • auditors create AuditRecordContract, the only contract containing a validated release decision.

Production parsing is strict: unknown fields are rejected at every envelope and nested-contract level, and unsupported versions fail closed. The unreleased 0.9 plan migration was removed rather than retained as permanent compatibility debt. Serialization is deterministic JSON with a SHA-256 content hash.

runtime_contracts.schema.json is executable documentation generated by:

python tools/runtime_contract_schema.py
python tools/runtime_contract_schema.py --check