{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://github.com/Seven128/project-tiny-context-harness/schemas/long-task-delivery-v2.schema.json",
    "title": "Single-Goal Delivery Contract V2",
    "type": "object",
    "additionalProperties": false,
    "required": [
        "schema_version",
        "semantic_fact_manifest",
        "task",
        "stages",
        "risk",
        "global"
    ],
    "properties": {
        "schema_version": { "const": "long-task-delivery-v2" },
        "semantic_fact_manifest": {
            "$ref": "#/$defs/semanticFactManifestRef"
        },
        "task": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "id",
                "title",
                "goal",
                "target_profile",
                "execution_targets",
                "source_paths",
                "context_refs"
            ],
            "properties": {
                "id": { "$ref": "#/$defs/key" },
                "title": { "$ref": "#/$defs/nonEmpty" },
                "goal": { "$ref": "#/$defs/nonEmpty" },
                "target_profile": { "$ref": "#/$defs/targetProfile" },
                "execution_targets": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/executionTarget" }
                },
                "source_paths": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/nonEmpty" }
                },
                "context_refs": { "$ref": "#/$defs/nonEmptyStrings" },
                "context_snapshot_mode": { "const": "full", "default": "full" }
            }
        },
        "source_claims": {
            "type": "array",
            "minItems": 1,
            "items": { "$ref": "#/$defs/sourceClaim" }
        },
        "compact_semantic_carrier": {
            "$ref": "#/$defs/longTaskCompactCarrier"
        },
        "stages": {
            "type": "array",
            "minItems": 1,
            "items": { "$ref": "#/$defs/stage" }
        },
        "risk": { "$ref": "#/$defs/risk" },
        "global": { "$ref": "#/$defs/global" },
        "outcomes": {
            "type": "array",
            "items": { "$ref": "#/$defs/outcome" },
            "minItems": 1
        },
        "outcome_files": { "$ref": "#/$defs/nonEmptyStrings" }
    },
    "allOf": [
        {
            "oneOf": [
                {
                    "required": ["source_claims"],
                    "not": { "required": ["compact_semantic_carrier"] }
                },
                {
                    "required": ["compact_semantic_carrier", "outcomes"],
                    "not": {
                        "anyOf": [
                            { "required": ["source_claims"] },
                            { "required": ["outcome_files"] }
                        ]
                    }
                }
            ]
        },
        {
            "oneOf": [
                { "required": ["outcomes"], "not": { "required": ["outcome_files"] } },
                { "required": ["outcome_files"], "not": { "required": ["outcomes"] } }
            ]
        }
    ],
    "$defs": {
        "key": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$" },
        "designFactKey": { "type": "string", "pattern": "^[a-z0-9][a-z0-9._-]*$" },
        "designFactRefs": {
            "type": "array",
            "items": { "$ref": "#/$defs/designFactKey" },
            "uniqueItems": true
        },
        "semanticRef": {
            "type": "string",
            "pattern": "^[a-z0-9][a-z0-9._:-]*$"
        },
        "semanticFactManifestRef": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "source_path", "sha256"],
            "properties": {
                "key": { "$ref": "#/$defs/semanticRef" },
                "source_path": { "$ref": "#/$defs/nonEmpty" },
                "sha256": { "$ref": "#/$defs/sha256" }
            }
        },
        "compactTable": {
            "type": "object",
            "additionalProperties": false,
            "required": ["defaults", "columns", "rows"],
            "properties": {
                "defaults": { "type": "object" },
                "columns": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
                },
                "rows": {
                    "type": "array",
                    "items": { "type": "array" }
                }
            }
        },
        "compactFactSet": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "defaults", "columns", "rows"],
            "properties": {
                "key": { "$ref": "#/$defs/semanticRef" },
                "defaults": { "type": "object" },
                "columns": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": { "type": "string", "pattern": "^[a-z][a-z0-9_]*$" }
                },
                "rows": {
                    "type": "array",
                    "items": { "type": "array" }
                }
            }
        },
        "longTaskCompactCapacityCounts": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "claims",
                "claim_projections",
                "selector_members",
                "structure_families",
                "structure_references",
                "structure_arguments",
                "facts",
                "obligations",
                "assertions",
                "canonical_bytes"
            ],
            "properties": {
                "claims": { "type": "integer", "minimum": 0, "maximum": 1000000 },
                "claim_projections": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 2000000
                },
                "selector_members": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 5000000
                },
                "structure_families": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 1000000
                },
                "structure_references": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 10000000
                },
                "structure_arguments": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 50000000
                },
                "facts": { "type": "integer", "minimum": 0, "maximum": 1000000 },
                "obligations": { "type": "integer", "minimum": 0, "maximum": 2000000 },
                "assertions": { "type": "integer", "minimum": 0, "maximum": 5000000 },
                "canonical_bytes": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 268435456
                }
            }
        },
        "longTaskCompactCarrier": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "schema_version",
                "capacity",
                "selectors",
                "shared_structures",
                "claim_catalog",
                "claim_projections",
                "fact_sets",
                "proof_templates",
                "obligations",
                "assertion_projections",
                "exceptions"
            ],
            "properties": {
                "schema_version": { "const": "long-task-compact-carrier-v1" },
                "capacity": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["theoretical_ground_universe", "measured", "maximum"],
                    "properties": {
                        "theoretical_ground_universe": { "const": "not_materialized" },
                        "measured": { "$ref": "#/$defs/longTaskCompactCapacityCounts" },
                        "maximum": { "$ref": "#/$defs/longTaskCompactCapacityCounts" }
                    }
                },
                "selectors": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["key", "members"],
                        "properties": {
                            "key": { "$ref": "#/$defs/semanticRef" },
                            "members": {
                                "type": "array",
                                "uniqueItems": true,
                                "items": { "$ref": "#/$defs/semanticRef" }
                            }
                        }
                    }
                },
                "shared_structures": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                            "key",
                            "digest",
                            "boundary",
                            "parameter_count",
                            "template"
                        ],
                        "properties": {
                            "key": {
                                "type": "string",
                                "pattern": "^structure\\.[a-f0-9]{24}$"
                            },
                            "digest": { "$ref": "#/$defs/sha256" },
                            "boundary": { "$ref": "#/$defs/semanticRef" },
                            "parameter_count": { "type": "integer", "minimum": 0 },
                            "template": {}
                        }
                    }
                },
                "claim_catalog": { "$ref": "#/$defs/compactTable" },
                "claim_projections": { "$ref": "#/$defs/compactTable" },
                "fact_sets": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/compactFactSet" }
                },
                "proof_templates": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["key", "binding"],
                        "properties": {
                            "key": { "$ref": "#/$defs/semanticRef" },
                            "binding": { "type": "object" }
                        }
                    }
                },
                "obligations": { "$ref": "#/$defs/compactTable" },
                "assertion_projections": { "$ref": "#/$defs/compactTable" },
                "exceptions": {
                    "type": "array",
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["key", "target_ref", "rationale"],
                        "properties": {
                            "key": { "$ref": "#/$defs/semanticRef" },
                            "target_ref": { "$ref": "#/$defs/semanticRef" },
                            "rationale": { "$ref": "#/$defs/nonEmpty" }
                        }
                    }
                }
            }
        },
        "semanticFactBindings": {
            "type": "object",
            "additionalProperties": false,
            "required": ["manifest_ref", "facts", "proofs"],
            "properties": {
                "manifest_ref": { "$ref": "#/$defs/semanticRef" },
                "facts": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["fact_ref", "claim_ref", "applicability_ref"],
                        "properties": {
                            "fact_ref": { "$ref": "#/$defs/semanticRef" },
                            "fact_revision_digest": { "$ref": "#/$defs/sha256" },
                            "claim_ref": { "$ref": "#/$defs/semanticRef" },
                            "applicability_ref": { "$ref": "#/$defs/semanticRef" }
                        }
                    }
                },
                "proofs": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "oneOf": [
                            {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                    "proof_ref",
                                    "fact_ref",
                                    "method",
                                    "proof_surface",
                                    "evidence_capabilities",
                                    "authority",
                                    "check_ref",
                                    "assertion_ref"
                                ],
                                "properties": {
                                    "proof_ref": { "$ref": "#/$defs/semanticRef" },
                                    "obligation_revision_digest": { "$ref": "#/$defs/sha256" },
                                    "fact_ref": { "$ref": "#/$defs/semanticRef" },
                                    "method": { "$ref": "#/$defs/semanticRef" },
                                    "proof_surface": { "$ref": "#/$defs/proofSurface" },
                                    "evidence_capabilities": {
                                        "type": "array",
                                        "minItems": 1,
                                        "uniqueItems": true,
                                        "items": { "$ref": "#/$defs/evidenceCapability" }
                                    },
                                    "authority": { "const": "machine" },
                                    "check_ref": { "$ref": "#/$defs/semanticRef" },
                                    "assertion_ref": { "$ref": "#/$defs/semanticRef" }
                                }
                            },
                            {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                    "proof_ref",
                                    "fact_ref",
                                    "method",
                                    "proof_surface",
                                    "evidence_capabilities",
                                    "authority",
                                    "confirmation_ref"
                                ],
                                "properties": {
                                    "proof_ref": { "$ref": "#/$defs/semanticRef" },
                                    "obligation_revision_digest": { "$ref": "#/$defs/sha256" },
                                    "fact_ref": { "$ref": "#/$defs/semanticRef" },
                                    "method": { "$ref": "#/$defs/semanticRef" },
                                    "proof_surface": { "$ref": "#/$defs/proofSurface" },
                                    "evidence_capabilities": {
                                        "type": "array",
                                        "minItems": 1,
                                        "uniqueItems": true,
                                        "items": { "$ref": "#/$defs/evidenceCapability" }
                                    },
                                    "authority": { "const": "external_confirmation" },
                                    "confirmation_ref": { "$ref": "#/$defs/semanticRef" }
                                }
                            }
                        ]
                    }
                }
            }
        },
        "sha256": { "type": "string", "pattern": "^[a-f0-9]{64}$" },
        "nonEmpty": { "type": "string", "minLength": 1 },
        "nonEmptyStrings": {
            "type": "array",
            "items": { "$ref": "#/$defs/nonEmpty" }
        },
        "executionTargetCapability": {
            "enum": [
                "browser-runtime",
                "native-runtime",
                "desktop-runtime",
                "service-runtime",
                "process-runtime",
                "external-runtime",
                "cold-start",
                "production-root",
                "pointer-input",
                "keyboard-input",
                "touch-input",
                "viewport-control",
                "pixel-density-observation",
                "safe-area-observation",
                "motion-observation",
                "reduced-motion",
                "color-scheme-control",
                "text-scale-control",
                "localization-control",
                "rtl-control",
                "assistive-technology",
                "screen-reader",
                "physical-device",
                "device-orientation",
                "sensor-input",
                "camera-input",
                "haptic-output",
                "audio-output",
                "reduced-transparency",
                "increased-contrast",
                "bold-text-control",
                "button-shapes-control",
                "system-ui-observation",
                "ime-control",
                "permission-control",
                "network-state-control",
                "lifecycle-control",
                "window-state-control",
                "fold-state-control",
                "thermal-observation",
                "power-mode-control",
                "persistent-storage",
                "network-boundary"
            ]
        },
        "targetProfile": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "description",
                "required_state",
                "required_target_refs"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "description": { "$ref": "#/$defs/nonEmpty" },
                "required_state": {
                    "enum": [
                        "implementation_complete",
                        "target_profile_usable",
                        "production_release_ready"
                    ]
                },
                "required_target_refs": { "$ref": "#/$defs/keys" }
            }
        },
        "executionTarget": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "description",
                "role",
                "runtime_family",
                "root_entrypoint",
                "capabilities"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "description": { "$ref": "#/$defs/nonEmpty" },
                "role": { "enum": ["product", "support", "observer"] },
                "runtime_family": {
                    "enum": [
                        "browser",
                        "native",
                        "desktop",
                        "service",
                        "process",
                        "external"
                    ]
                },
                "root_entrypoint": { "$ref": "#/$defs/nonEmpty" },
                "root_argv": {
                    "type": "array",
                    "items": { "type": "string", "pattern": "^[^\\u0000]*$" }
                },
                "capabilities": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/executionTargetCapability" }
                }
            }
        },
        "stage": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "title", "depends_on", "gate_outcome"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "title": { "$ref": "#/$defs/nonEmpty" },
                "depends_on": { "$ref": "#/$defs/keys" },
                "gate_outcome": { "$ref": "#/$defs/key" }
            }
        },
        "keyedStatement": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "statement"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "statement": { "$ref": "#/$defs/nonEmpty" }
            }
        },
        "applicableStatement": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "statement", "applicability_refs"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "statement": { "$ref": "#/$defs/nonEmpty" },
                "applicability_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                }
            }
        },
        "claimApplicability": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "target_ref",
                "journey_role",
                "dimensions",
                "given_refs",
                "when_refs"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "target_ref": { "$ref": "#/$defs/key" },
                "journey_role": {
                    "enum": [
                        "success",
                        "degradation",
                        "recovery",
                        "stage_gate",
                        "conformance"
                    ]
                },
                "dimensions": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["key", "value"],
                        "properties": {
                            "key": { "$ref": "#/$defs/semanticRef" },
                            "value": { "$ref": "#/$defs/semanticRef" }
                        }
                    }
                },
                "given_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                },
                "when_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                }
            }
        },
        "keyedPath": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "path"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "path": { "$ref": "#/$defs/nonEmpty" }
            }
        },
        "sourceClaim": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "source_ref", "statement", "disposition"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "source_ref": { "type": "string", "pattern": "^[^#]+(?:#[^#]+)?$" },
                "statement": { "$ref": "#/$defs/nonEmpty" },
                "disposition": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "refs"],
                            "properties": {
                                "type": {
                                    "enum": [
                                        "claim",
                                        "global_constraint",
                                        "risk_fact",
                                        "external_confirmation"
                                    ]
                                },
                                "refs": { "$ref": "#/$defs/nonEmptyStrings" }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "refs"],
                            "properties": {
                                "type": { "const": "acceptance" },
                                "refs": {
                                    "type": "array",
                                    "minItems": 1,
                                    "maxItems": 1,
                                    "items": { "$ref": "#/$defs/nonEmpty" }
                                }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "ref"],
                            "properties": {
                                "type": { "const": "outcome_result" },
                                "ref": { "$ref": "#/$defs/nonEmpty" }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "reason"],
                            "properties": {
                                "type": { "const": "decision_required" },
                                "reason": { "$ref": "#/$defs/nonEmpty" }
                            }
                        }
                    ]
                }
            }
        },
        "risk": {
            "type": "object",
            "additionalProperties": false,
            "required": ["facts"],
            "properties": {
                "requested_level": {
                    "enum": ["auto", "standard", "strict"],
                    "default": "auto"
                },
                "facts": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "public_api_or_schema_change": {
                            "$ref": "#/$defs/keys",
                            "default": []
                        },
                        "persistent_data_change": { "$ref": "#/$defs/keys", "default": [] },
                        "data_migration": { "$ref": "#/$defs/keys", "default": [] },
                        "security_boundary_change": {
                            "$ref": "#/$defs/keys",
                            "default": []
                        },
                        "permission_boundary_change": {
                            "$ref": "#/$defs/keys",
                            "default": []
                        },
                        "irreversible_external_effect": {
                            "$ref": "#/$defs/keys",
                            "default": []
                        },
                        "critical_user_path": { "$ref": "#/$defs/keys", "default": [] },
                        "full_population_operation": {
                            "$ref": "#/$defs/keys",
                            "default": []
                        },
                        "multi_repository_change": {
                            "$ref": "#/$defs/keys",
                            "default": []
                        },
                        "weak_observability": { "$ref": "#/$defs/keys", "default": [] }
                    }
                }
            }
        },
        "keys": {
            "type": "array",
            "items": { "$ref": "#/$defs/key" },
            "uniqueItems": true
        },
        "global": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
                "applicability": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/claimApplicability" },
                    "default": []
                },
                "product": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "non_goals": {
                            "type": "array",
                            "items": { "$ref": "#/$defs/applicableStatement" },
                            "default": []
                        }
                    },
                    "default": {}
                },
                "technical": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "constraints": {
                            "type": "array",
                            "items": { "$ref": "#/$defs/applicableStatement" },
                            "default": []
                        },
                        "forbidden_paths": {
                            "type": "array",
                            "items": { "$ref": "#/$defs/keyedPath" },
                            "default": []
                        },
                        "forbidden_shortcuts": {
                            "type": "array",
                            "items": { "$ref": "#/$defs/applicableStatement" },
                            "default": []
                        }
                    },
                    "default": {}
                },
                "acceptance": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                        "checks": {
                            "type": "array",
                            "items": { "$ref": "#/$defs/check" },
                            "default": []
                        },
                        "counterfactual_controls": {
                            "type": "array",
                            "items": { "$ref": "#/$defs/globalCounterfactual" },
                            "default": []
                        },
                        "external_confirmations": {
                            "type": "array",
                            "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": [
                                    "key",
                                    "description",
                                    "owner",
                                    "kind",
                                    "impact_claims",
                                    "blocks_target"
                                ],
                                "properties": {
                                    "key": { "$ref": "#/$defs/key" },
                                    "description": { "$ref": "#/$defs/nonEmpty" },
                                    "owner": { "$ref": "#/$defs/nonEmpty" },
                                    "kind": {
                                        "enum": [
                                            "functional_prerequisite",
                                            "field_validation",
                                            "production_release_gate",
                                            "commercial_activation",
                                            "expert_authority"
                                        ]
                                    },
                                    "impact_claims": {
                                        "type": "array",
                                        "minItems": 1,
                                        "uniqueItems": true,
                                        "items": { "$ref": "#/$defs/nonEmpty" }
                                    },
                                    "blocks_target": { "type": "boolean" }
                                }
                            },
                            "default": []
                        }
                    },
                    "default": {}
                }
            }
        },
        "outcome": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "title",
                "stage",
                "applicability",
                "semantic_fact_bindings",
                "product",
                "technical",
                "acceptance"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "title": { "$ref": "#/$defs/nonEmpty" },
                "stage": { "$ref": "#/$defs/key" },
                "depends_on": { "$ref": "#/$defs/keys", "default": [] },
                "applicability": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/claimApplicability" }
                },
                "semantic_fact_bindings": {
                    "$ref": "#/$defs/semanticFactBindings"
                },
                "product": { "$ref": "#/$defs/product" },
                "technical": { "$ref": "#/$defs/technical" },
                "acceptance": { "$ref": "#/$defs/acceptance" }
            }
        },
        "product": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "observable_result",
                "result_applicability_refs",
                "success_path_required",
                "degradation_path_required",
                "owner",
                "control_relation_closure"
            ],
            "properties": {
                "observable_result": { "$ref": "#/$defs/nonEmpty" },
                "result_applicability_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                },
                "success_path_required": { "type": "boolean" },
                "degradation_path_required": { "type": "boolean" },
                "owner": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["label", "context_refs", "path_globs"],
                    "properties": {
                        "label": { "$ref": "#/$defs/nonEmpty" },
                        "context_refs": { "$ref": "#/$defs/nonEmptyStrings" },
                        "path_globs": { "$ref": "#/$defs/nonEmptyStrings" }
                    }
                },
                "requirements": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/requirement" },
                    "default": []
                },
                "owner_surfaces": { "$ref": "#/$defs/nonEmptyStrings", "default": [] },
                "controls": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/control" },
                    "default": []
                },
                "control_relation_closure": {
                    "$ref": "#/$defs/controlRelationClosure"
                },
                "control_relations": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/controlRelation" },
                    "default": []
                },
                "surface_bindings": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/surfaceBinding" },
                    "default": []
                },
                "non_completing_outcomes": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/applicableStatement" },
                    "default": []
                }
            },
            "allOf": [
                {
                    "if": {
                        "required": ["controls"],
                        "properties": { "controls": { "minItems": 1 } }
                    },
                    "then": {
                        "required": ["surface_bindings"],
                        "properties": { "surface_bindings": { "minItems": 1 } }
                    }
                }
            ]
        },
        "requirement": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "statement",
                "required_proof_surfaces",
                "applicability_refs"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "statement": { "$ref": "#/$defs/nonEmpty" },
                "required_proof_surfaces": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/proofSurface" }
                },
                "applicability_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                }
            }
        },
        "control": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "field_coverage"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "surface": { "type": "string", "default": "" },
                "region": { "type": "string", "default": "" },
                "location": { "type": "string", "default": "" },
                "control_type": { "type": "string", "default": "" },
                "label_content": { "type": "string", "default": "" },
                "user_task": { "type": "string", "default": "" },
                "visibility": { "type": "string", "default": "" },
                "availability": { "type": "string", "default": "" },
                "trigger": { "type": "string", "default": "" },
                "input": { "type": "string", "default": "" },
                "validation": { "type": "string", "default": "" },
                "default_value": { "type": "string", "default": "" },
                "interaction": { "type": "string", "default": "" },
                "navigation_result": { "type": "string", "default": "" },
                "loading_state": { "type": "string", "default": "" },
                "empty_state": { "type": "string", "default": "" },
                "success_state": { "type": "string", "default": "" },
                "failure_state": { "type": "string", "default": "" },
                "recovery": { "type": "string", "default": "" },
                "permission": { "type": "string", "default": "" },
                "feedback": { "type": "string", "default": "" },
                "accessibility": { "type": "string", "default": "" },
                "field_coverage": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/controlFieldCoverage" }
                }
            }
        },
        "controlField": {
            "enum": [
                "surface",
                "region",
                "location",
                "control_type",
                "label_content",
                "user_task",
                "visibility",
                "availability",
                "trigger",
                "input",
                "validation",
                "default_value",
                "interaction",
                "navigation_result",
                "loading_state",
                "empty_state",
                "success_state",
                "failure_state",
                "recovery",
                "permission",
                "feedback",
                "accessibility"
            ]
        },
        "controlFieldCoverage": {
            "oneOf": [
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["fields", "state", "applicability_refs"],
                    "properties": {
                        "fields": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/controlField" }
                        },
                        "state": { "const": "specified" },
                        "applicability_refs": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/key" }
                        }
                    }
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["fields", "state", "statement", "applicability_refs"],
                    "properties": {
                        "fields": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/controlField" }
                        },
                        "state": { "const": "not_applicable" },
                        "statement": { "$ref": "#/$defs/nonEmpty" },
                        "applicability_refs": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/key" }
                        }
                    }
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["fields", "state", "statement"],
                    "properties": {
                        "fields": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/controlField" }
                        },
                        "state": { "const": "unresolved" },
                        "statement": { "$ref": "#/$defs/nonEmpty" },
                        "applicability_refs": { "type": "array", "maxItems": 0 }
                    }
                }
            ]
        },
        "controlRelationClosure": {
            "oneOf": [
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["state", "statement", "applicability_refs"],
                    "properties": {
                        "state": { "const": "specified" },
                        "statement": { "$ref": "#/$defs/nonEmpty" },
                        "applicability_refs": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/key" }
                        }
                    }
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["state", "statement", "applicability_refs"],
                    "properties": {
                        "state": { "const": "not_applicable" },
                        "statement": { "$ref": "#/$defs/nonEmpty" },
                        "applicability_refs": {
                            "type": "array",
                            "minItems": 1,
                            "uniqueItems": true,
                            "items": { "$ref": "#/$defs/key" }
                        }
                    }
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["state", "statement"],
                    "properties": {
                        "state": { "const": "unresolved" },
                        "statement": { "$ref": "#/$defs/nonEmpty" },
                        "applicability_refs": { "type": "array", "maxItems": 0 }
                    }
                }
            ]
        },
        "controlRelation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "statement",
                "control_refs",
                "required_proof_surfaces",
                "applicability_refs"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "statement": { "$ref": "#/$defs/nonEmpty" },
                "control_refs": {
                    "type": "array",
                    "minItems": 2,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                },
                "required_proof_surfaces": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/proofSurface" }
                },
                "applicability_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                }
            }
        },
        "surfaceBinding": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "surface_ref",
                "target_ref",
                "control_refs",
                "route_binding_ref",
                "component_binding_refs",
                "root_journey_check_ref",
                "entry_action_ref",
                "design_targets",
                "acceptance_blockers"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "surface_ref": { "$ref": "#/$defs/nonEmpty" },
                "target_ref": { "$ref": "#/$defs/key" },
                "control_refs": { "$ref": "#/$defs/keys" },
                "route_binding_ref": { "$ref": "#/$defs/key" },
                "component_binding_refs": { "$ref": "#/$defs/keys" },
                "root_journey_check_ref": { "$ref": "#/$defs/key" },
                "entry_action_ref": { "$ref": "#/$defs/key" },
                "design_targets": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/designTarget" }
                },
                "acceptance_blockers": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/designAcceptanceBlocker" }
                }
            }
        },
        "designTarget": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "interpretation",
                "source_paths",
                "condition_keys",
                "claim_refs",
                "conformance_check_ref",
                "conformance_assertion_ref",
                "verification_method_bindings",
                "actual_artifact_path",
                "comparison_artifact_path"
            ],
            "oneOf": [
                {
                    "not": {
                        "anyOf": [
                            { "required": ["fact_model"] },
                            { "required": ["symbolic_method_bindings"] },
                            { "required": ["symbolic_certificate_binding"] }
                        ]
                    },
                    "properties": {
                        "verification_method_bindings": { "minItems": 1 }
                    }
                },
                {
                    "required": [
                        "fact_model",
                        "symbolic_method_bindings",
                        "symbolic_certificate_binding"
                    ],
                    "properties": {
                        "fact_model": { "const": "symbolic_rules_v2" },
                        "verification_method_bindings": { "maxItems": 0 },
                        "symbolic_method_bindings": { "minItems": 1 }
                    }
                }
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "fact_model": { "const": "symbolic_rules_v2" },
                "interpretation": { "enum": ["exact_target", "constraint"] },
                "source_paths": { "$ref": "#/$defs/nonEmptyStrings" },
                "condition_keys": { "$ref": "#/$defs/keys" },
                "claim_refs": { "$ref": "#/$defs/nonEmptyStrings" },
                "conformance_check_ref": { "$ref": "#/$defs/key" },
                "conformance_assertion_ref": { "$ref": "#/$defs/key" },
                "verification_method_bindings": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["method", "assertion_ref", "evidence_artifacts"],
                        "properties": {
                            "method": { "$ref": "#/$defs/designVerificationMethod" },
                            "assertion_ref": { "$ref": "#/$defs/key" },
                            "evidence_artifacts": {
                                "type": "array",
                                "minItems": 1,
                                "items": {
                                    "type": "object",
                                    "additionalProperties": false,
                                    "required": [
                                        "condition_key",
                                        "path",
                                        "observation_path",
                                        "fact_refs",
                                        "fact_expectations"
                                    ],
                                    "properties": {
                                        "condition_key": { "$ref": "#/$defs/key" },
                                        "path": { "$ref": "#/$defs/nonEmpty" },
                                        "observation_path": { "$ref": "#/$defs/nonEmpty" },
                                        "fact_refs": { "$ref": "#/$defs/designFactRefs" },
                                        "fact_expectations": {
                                            "type": "array",
                                            "minItems": 1,
                                            "items": { "$ref": "#/$defs/designFactExpectation" }
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "symbolic_method_bindings": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/designSymbolicVerificationBinding" }
                },
                "symbolic_certificate_binding": {
                    "$ref": "#/$defs/designSymbolicCertificateBinding"
                },
                "actual_artifact_path": { "$ref": "#/$defs/nonEmpty" },
                "comparison_artifact_path": { "$ref": "#/$defs/nonEmpty" }
            }
        },
        "designTypedLocator": {
            "type": "object",
            "additionalProperties": false,
            "required": ["resource_ref", "kind", "value"],
            "properties": {
                "resource_ref": { "$ref": "#/$defs/designFactKey" },
                "kind": {
                    "enum": [
                        "html_selector",
                        "html_inner_html",
                        "markdown_anchor",
                        "json_pointer",
                        "css_selector",
                        "css_custom_property",
                        "html_attribute",
                        "css_declaration",
                        "javascript_export",
                        "svg_selector",
                        "svg_inner_xml",
                        "svg_attribute",
                        "whole_resource"
                    ]
                },
                "value": { "$ref": "#/$defs/nonEmpty" }
            }
        },
        "designLocatedDigest": {
            "type": "object",
            "additionalProperties": false,
            "required": ["locator", "sha256"],
            "properties": {
                "locator": { "$ref": "#/$defs/designTypedLocator" },
                "sha256": { "$ref": "#/$defs/sha256" }
            }
        },
        "designFactExpectation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "fact_ref",
                "subject_ref",
                "variation_ref",
                "property_ref",
                "observation_sensitivity",
                "expected",
                "comparison",
                "oracle",
                "environment"
            ],
            "properties": {
                "fact_ref": { "$ref": "#/$defs/designFactKey" },
                "subject_ref": { "$ref": "#/$defs/designFactKey" },
                "variation_ref": { "$ref": "#/$defs/designFactKey" },
                "property_ref": { "$ref": "#/$defs/designFactKey" },
                "observation_sensitivity": { "enum": ["plain", "protected"] },
                "expected": { "$ref": "#/$defs/designLocatedDigest" },
                "comparison": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["comparator", "mode", "parameters", "tolerance", "mask"],
                    "properties": {
                        "comparator": {
                            "type": "string",
                            "pattern": "^(?:exact_value|numeric_delta|geometry_delta|pixel_diff|token_resolution|content_equal|state_equal|trace_equal|timeline_equal|reflow_equal|semantic_equal|asset_equal|custom\\.[a-z0-9][a-z0-9._-]*)$"
                        },
                        "mode": { "enum": ["exact", "tolerance"] },
                        "parameters": { "$ref": "#/$defs/designLocatedDigest" },
                        "tolerance": {
                            "oneOf": [
                                { "type": "null" },
                                { "$ref": "#/$defs/designLocatedDigest" }
                            ]
                        },
                        "mask": {
                            "oneOf": [
                                { "type": "null" },
                                { "$ref": "#/$defs/designLocatedDigest" }
                            ]
                        }
                    }
                },
                "oracle": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["key", "trust", "identity", "version", "sha256"],
                    "properties": {
                        "key": { "$ref": "#/$defs/designFactKey" },
                        "trust": { "enum": ["frozen_executable", "named_external_tcb"] },
                        "identity": { "$ref": "#/$defs/nonEmpty" },
                        "version": { "$ref": "#/$defs/nonEmpty" },
                        "sha256": {
                            "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/sha256" }]
                        }
                    }
                },
                "environment": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["key", "identity", "definition"],
                    "properties": {
                        "key": { "$ref": "#/$defs/designFactKey" },
                        "identity": { "$ref": "#/$defs/nonEmpty" },
                        "definition": { "$ref": "#/$defs/designLocatedDigest" }
                    }
                }
            }
        },
        "designQuantifier": {
            "type": "object",
            "additionalProperties": false,
            "required": ["kind", "minimum", "maximum"],
            "properties": {
                "kind": {
                    "enum": [
                        "one",
                        "all",
                        "any",
                        "none",
                        "exactly",
                        "at_least",
                        "at_most",
                        "range"
                    ]
                },
                "minimum": {
                    "oneOf": [{ "type": "null" }, { "type": "integer", "minimum": 0 }]
                },
                "maximum": {
                    "oneOf": [{ "type": "null" }, { "type": "integer", "minimum": 0 }]
                }
            }
        },
        "designSymbolicRuleExpectation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "obligation_ref",
                "fact_rule_ref",
                "region_sha256",
                "subject_or_relation_ref",
                "property_ref",
                "population_ref",
                "quantifier",
                "observation_sensitivity",
                "expected",
                "proof_surface",
                "observation_boundary",
                "comparison",
                "oracle",
                "environment",
                "protected_value_policy",
                "completion_effect"
            ],
            "properties": {
                "obligation_ref": { "$ref": "#/$defs/designFactKey" },
                "fact_rule_ref": { "$ref": "#/$defs/designFactKey" },
                "region_sha256": { "$ref": "#/$defs/sha256" },
                "subject_or_relation_ref": { "$ref": "#/$defs/designFactKey" },
                "property_ref": { "$ref": "#/$defs/designFactKey" },
                "population_ref": {
                    "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/designFactKey" }]
                },
                "quantifier": { "$ref": "#/$defs/designQuantifier" },
                "observation_sensitivity": { "enum": ["plain", "protected"] },
                "expected": { "$ref": "#/$defs/designLocatedDigest" },
                "proof_surface": { "$ref": "#/$defs/nonEmpty" },
                "observation_boundary": { "$ref": "#/$defs/nonEmpty" },
                "comparison": {
                    "$ref": "#/$defs/designFactExpectation/properties/comparison"
                },
                "oracle": {
                    "$ref": "#/$defs/designFactExpectation/properties/oracle"
                },
                "environment": {
                    "$ref": "#/$defs/designFactExpectation/properties/environment"
                },
                "protected_value_policy": { "$ref": "#/$defs/nonEmpty" },
                "completion_effect": { "$ref": "#/$defs/nonEmpty" }
            }
        },
        "designSymbolicVerificationBinding": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "method",
                "assertion_ref",
                "artifact_path",
                "observation_path",
                "rule_expectations"
            ],
            "properties": {
                "method": { "$ref": "#/$defs/designVerificationMethod" },
                "assertion_ref": { "$ref": "#/$defs/key" },
                "artifact_path": { "$ref": "#/$defs/nonEmpty" },
                "observation_path": { "$ref": "#/$defs/nonEmpty" },
                "rule_expectations": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/designSymbolicRuleExpectation" }
                }
            }
        },
        "designSymbolicCertificateExpectation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "certificate_ref",
                "fact_rule_refs",
                "omitted_axis_refs",
                "dependency_edge_refs",
                "canonical_rule_dag_sha256"
            ],
            "properties": {
                "certificate_ref": { "$ref": "#/$defs/designFactKey" },
                "fact_rule_refs": { "$ref": "#/$defs/designFactRefs" },
                "omitted_axis_refs": { "$ref": "#/$defs/designFactRefs" },
                "dependency_edge_refs": { "$ref": "#/$defs/designFactRefs" },
                "canonical_rule_dag_sha256": { "$ref": "#/$defs/sha256" },
                "source_noninterference_proof_sha256": { "$ref": "#/$defs/sha256" },
                "production_noninterference_proof_sha256": { "$ref": "#/$defs/sha256" }
            }
        },
        "designSymbolicCertificateBinding": {
            "type": "object",
            "additionalProperties": false,
            "required": ["assertion_ref", "artifact_path", "expectations", "metrics"],
            "properties": {
                "assertion_ref": { "$ref": "#/$defs/key" },
                "artifact_path": { "$ref": "#/$defs/nonEmpty" },
                "expectations": {
                    "type": "array",
                    "minItems": 1,
                    "items": {
                        "$ref": "#/$defs/designSymbolicCertificateExpectation"
                    }
                },
                "metrics": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "semantic_obligations",
                        "certificate_obligations",
                        "certificate_covered_omitted_axes",
                        "certificate_covered_dependency_edges",
                        "canonical_dag_nodes",
                        "canonical_partition_edges",
                        "canonical_bytes",
                        "theoretical_ground_cardinality"
                    ],
                    "properties": {
                        "semantic_obligations": { "type": "integer", "minimum": 0 },
                        "certificate_obligations": { "type": "integer", "minimum": 0 },
                        "certificate_covered_omitted_axes": {
                            "type": "integer",
                            "minimum": 0
                        },
                        "certificate_covered_dependency_edges": {
                            "type": "integer",
                            "minimum": 0
                        },
                        "canonical_dag_nodes": { "type": "integer", "minimum": 0 },
                        "canonical_partition_edges": {
                            "type": "integer",
                            "minimum": 0
                        },
                        "canonical_bytes": { "type": "integer", "minimum": 0 },
                        "theoretical_ground_cardinality": {
                            "type": "string",
                            "pattern": "^[1-9][0-9]*$"
                        }
                    }
                }
            }
        },
        "designAcceptanceBlocker": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "status",
                "refs",
                "source_item_refs",
                "verification_methods",
                "required_capabilities",
                "rationale"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "status": { "enum": ["machine_claim", "external_confirmation"] },
                "refs": {
                    "type": "array",
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/nonEmpty" }
                },
                "source_item_refs": { "$ref": "#/$defs/nonEmptyStrings" },
                "verification_methods": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/designVerificationMethod" }
                },
                "required_capabilities": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/executionTargetCapability" }
                },
                "rationale": { "$ref": "#/$defs/nonEmpty" }
            }
        },
        "designVerificationMethod": {
            "enum": [
                "layout_geometry",
                "visual_pixel",
                "design_token",
                "content",
                "component_state",
                "interaction_trace",
                "motion_timeline",
                "responsive_reflow",
                "input_method",
                "accessibility_semantics",
                "accessibility_navigation",
                "accessibility_visual",
                "gesture_trace",
                "scroll_navigation",
                "localization",
                "system_ui",
                "haptic_feedback",
                "sound_feedback",
                "asset_integrity"
            ]
        },
        "technical": {
            "type": "object",
            "additionalProperties": false,
            "required": ["expected_change_paths"],
            "properties": {
                "obligations": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/obligation" },
                    "default": []
                },
                "expected_change_paths": { "$ref": "#/$defs/nonEmptyStrings" },
                "allowed_support_paths": {
                    "$ref": "#/$defs/nonEmptyStrings",
                    "default": []
                },
                "forbidden_paths": { "$ref": "#/$defs/nonEmptyStrings", "default": [] },
                "forbidden_shortcuts": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/applicableStatement" },
                    "default": []
                },
                "bindings": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/binding" },
                    "default": []
                },
                "rollback_and_recovery": {
                    "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/rollback" }],
                    "default": null
                }
            }
        },
        "obligation": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "statement",
                "required_proof_surfaces",
                "applicability_refs"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "statement": { "$ref": "#/$defs/nonEmpty" },
                "required_proof_surfaces": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/proofSurface" }
                },
                "applicability_refs": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/key" }
                }
            }
        },
        "proofSurface": {
            "enum": [
                "ui_browser",
                "runtime_behavior",
                "api_contract",
                "data_state",
                "security_boundary",
                "population_coverage",
                "implementation_structure"
            ]
        },
        "binding": {
            "type": "object",
            "additionalProperties": false,
            "required": ["key", "kind", "target", "carrier_paths"],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "kind": { "enum": ["file", "path_glob", "verified"] },
                "target": { "$ref": "#/$defs/nonEmpty" },
                "carrier_paths": { "$ref": "#/$defs/nonEmptyStrings" },
                "existence": { "enum": ["existing", "planned"] },
                "verification_check_key": { "$ref": "#/$defs/key" }
            }
        },
        "rollback": {
            "type": "object",
            "additionalProperties": false,
            "required": ["rollback", "recovery", "verification_check_keys"],
            "properties": {
                "rollback": { "$ref": "#/$defs/nonEmpty" },
                "recovery": { "$ref": "#/$defs/nonEmpty" },
                "verification_check_keys": { "$ref": "#/$defs/keys" }
            }
        },
        "acceptance": {
            "type": "object",
            "additionalProperties": false,
            "required": ["checks"],
            "properties": {
                "checks": { "type": "array", "items": { "$ref": "#/$defs/check" } },
                "population": {
                    "oneOf": [{ "type": "null" }, { "$ref": "#/$defs/population" }],
                    "default": null
                },
                "counterfactual_controls": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/counterfactual" },
                    "default": []
                }
            }
        },
        "check": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "journey_roles",
                "execution_target",
                "scenario",
                "proof_surface",
                "runner",
                "verification_inputs"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "journey_roles": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": {
                        "enum": [
                            "success",
                            "degradation",
                            "recovery",
                            "stage_gate",
                            "conformance"
                        ]
                    }
                },
                "execution_target": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["target_ref", "entrypoint"],
                    "properties": {
                        "target_ref": { "$ref": "#/$defs/key" },
                        "entrypoint": { "enum": ["root", "internal"] }
                    }
                },
                "scenario": { "$ref": "#/$defs/scenario" },
                "proof_surface": { "$ref": "#/$defs/proofSurface" },
                "runner": { "$ref": "#/$defs/runner" },
                "verification_inputs": { "$ref": "#/$defs/nonEmptyStrings" },
                "input_paths": { "$ref": "#/$defs/nonEmptyStrings", "default": [] },
                "expected_output_paths": {
                    "$ref": "#/$defs/nonEmptyStrings",
                    "default": []
                },
                "artifact_globs": { "$ref": "#/$defs/nonEmptyStrings", "default": [] },
                "positive_assertions": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/assertion" },
                    "default": []
                },
                "negative_assertions": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/assertion" },
                    "default": []
                },
                "environment_requirements": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/environment" },
                    "default": []
                }
            }
        },
        "runner": {
            "type": "object",
            "additionalProperties": false,
            "required": ["type", "target", "effect"],
            "properties": {
                "type": {
                    "enum": [
                        "package_script",
                        "project_binary",
                        "node_oracle",
                        "playwright_test"
                    ]
                },
                "target": { "$ref": "#/$defs/nonEmpty" },
                "argv": { "$ref": "#/$defs/nonEmptyStrings", "default": [] },
                "cwd": { "$ref": "#/$defs/nonEmpty", "default": "." },
                "timeout_ms": {
                    "type": "integer",
                    "minimum": 100,
                    "maximum": 3600000,
                    "default": 30000
                },
                "effect": { "enum": ["read_only", "test_sandbox"] },
                "retry_policy": {
                    "enum": ["none", "transient_once"],
                    "default": "none"
                },
                "idempotent": { "type": "boolean", "default": false }
            }
        },
        "assertion": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "claims",
                "observation",
                "operator",
                "evidence_capabilities"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "criterion": { "$ref": "#/$defs/nonEmpty" },
                "claims": { "$ref": "#/$defs/nonEmptyStrings" },
                "applicability_ref": { "$ref": "#/$defs/key" },
                "observation": { "$ref": "#/$defs/nonEmpty" },
                "evidence_capabilities": {
                    "type": "array",
                    "minItems": 1,
                    "uniqueItems": true,
                    "items": { "$ref": "#/$defs/evidenceCapability" }
                },
                "operator": {
                    "enum": [
                        "equals",
                        "not_equals",
                        "contains",
                        "not_contains",
                        "matches",
                        "not_matches",
                        "greater_than",
                        "greater_or_equal",
                        "less_than",
                        "less_or_equal",
                        "truthy",
                        "falsy",
                        "exists",
                        "set_equals",
                        "subset_of",
                        "superset_of"
                    ]
                },
                "expected": true
            },
            "allOf": [
                {
                    "if": { "properties": { "claims": { "minItems": 1 } } },
                    "then": { "required": ["applicability_ref"] },
                    "else": { "not": { "required": ["applicability_ref"] } }
                },
                {
                    "if": {
                        "properties": {
                            "operator": {
                                "enum": [
                                    "equals",
                                    "not_equals",
                                    "contains",
                                    "not_contains",
                                    "matches",
                                    "not_matches",
                                    "greater_than",
                                    "greater_or_equal",
                                    "less_than",
                                    "less_or_equal",
                                    "set_equals",
                                    "subset_of",
                                    "superset_of"
                                ]
                            }
                        }
                    },
                    "then": { "required": ["expected"] }
                },
                {
                    "if": {
                        "properties": {
                            "operator": { "enum": ["exists", "truthy", "falsy"] }
                        }
                    },
                    "then": { "not": { "required": ["expected"] } }
                },
                {
                    "if": {
                        "properties": { "operator": { "enum": ["matches", "not_matches"] } }
                    },
                    "then": {
                        "properties": {
                            "expected": { "type": "string", "format": "regex" }
                        }
                    }
                },
                {
                    "if": {
                        "properties": {
                            "operator": {
                                "enum": [
                                    "greater_than",
                                    "greater_or_equal",
                                    "less_than",
                                    "less_or_equal"
                                ]
                            }
                        }
                    },
                    "then": { "properties": { "expected": { "type": "number" } } }
                },
                {
                    "if": {
                        "properties": {
                            "operator": { "enum": ["set_equals", "subset_of", "superset_of"] }
                        }
                    },
                    "then": { "properties": { "expected": { "type": "array" } } }
                }
            ]
        },
        "scenario": {
            "type": "object",
            "additionalProperties": false,
            "required": ["given", "when"],
            "properties": {
                "given": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/keyedStatement" }
                },
                "when": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/keyedStatement" }
                }
            }
        },
        "evidenceCapability": {
            "enum": [
                "presence",
                "interaction_trace",
                "state_delta",
                "cross_surface_consistency",
                "durable_readback",
                "boundary_invocation",
                "external_side_effect",
                "failure_injection",
                "visual_render",
                "design_conformance",
                "design_method",
                "design_symbolic_certificate",
                "semantic_fact",
                "target_runtime",
                "input_variation"
            ]
        },
        "environment": {
            "oneOf": [
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["key", "kind", "target"],
                    "properties": {
                        "key": { "$ref": "#/$defs/key" },
                        "kind": { "enum": ["executable", "file", "directory", "env_var"] },
                        "target": { "$ref": "#/$defs/nonEmpty" }
                    }
                },
                {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["key", "kind", "host", "port", "timeout_ms"],
                    "properties": {
                        "key": { "$ref": "#/$defs/key" },
                        "kind": { "const": "loopback_tcp" },
                        "host": { "enum": ["127.0.0.1", "::1", "localhost"] },
                        "port": { "type": "integer", "minimum": 1, "maximum": 65535 },
                        "timeout_ms": { "type": "integer", "minimum": 10, "maximum": 60000 }
                    }
                }
            ]
        },
        "population": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "check_key",
                "universe_binding_key",
                "claims",
                "observations",
                "exclusion_rules"
            ],
            "properties": {
                "check_key": { "$ref": "#/$defs/key" },
                "universe_binding_key": { "$ref": "#/$defs/key" },
                "claims": { "$ref": "#/$defs/nonEmptyStrings" },
                "observations": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": [
                        "universe_ids",
                        "eligible_ids",
                        "observed_ids",
                        "excluded_items"
                    ],
                    "properties": {
                        "universe_ids": { "$ref": "#/$defs/nonEmpty" },
                        "eligible_ids": { "$ref": "#/$defs/nonEmpty" },
                        "observed_ids": { "$ref": "#/$defs/nonEmpty" },
                        "excluded_items": { "$ref": "#/$defs/nonEmpty" }
                    }
                },
                "exclusion_rules": {
                    "type": "array",
                    "items": { "$ref": "#/$defs/keyedStatement" }
                }
            }
        },
        "counterfactual": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "binding_key",
                "claims",
                "check_key",
                "mutation",
                "expected_assertion_failures"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "binding_key": { "$ref": "#/$defs/key" },
                "claims": { "$ref": "#/$defs/nonEmptyStrings" },
                "check_key": { "$ref": "#/$defs/key" },
                "expected_assertion_failures": { "$ref": "#/$defs/keys" },
                "preserved_assertions": { "$ref": "#/$defs/keys", "default": [] },
                "allowed_fanout_assertions": {
                    "$ref": "#/$defs/keys",
                    "default": []
                },
                "mutation": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "paths"],
                            "properties": {
                                "type": { "const": "remove_paths" },
                                "paths": { "$ref": "#/$defs/nonEmptyStrings" }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "path", "fixture_path"],
                            "properties": {
                                "type": { "const": "replace_file" },
                                "path": { "$ref": "#/$defs/nonEmpty" },
                                "fixture_path": { "$ref": "#/$defs/nonEmpty" }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "path", "pointer", "value"],
                            "properties": {
                                "type": { "const": "replace_json_value" },
                                "path": { "$ref": "#/$defs/nonEmpty" },
                                "pointer": {
                                    "type": "string",
                                    "pattern": "^/(?:[^~/]|~[01])+(?:/(?:[^~/]|~[01])+)*$"
                                },
                                "value": true
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "path", "match", "replacement"],
                            "properties": {
                                "type": { "const": "replace_text" },
                                "path": { "$ref": "#/$defs/nonEmpty" },
                                "match": { "$ref": "#/$defs/nonEmpty" },
                                "replacement": { "type": "string" }
                            }
                        }
                    ]
                }
            }
        },
        "globalCounterfactual": {
            "type": "object",
            "additionalProperties": false,
            "required": [
                "key",
                "binding_ref",
                "claims",
                "check_key",
                "mutation",
                "expected_assertion_failures"
            ],
            "properties": {
                "key": { "$ref": "#/$defs/key" },
                "binding_ref": {
                    "type": "string",
                    "pattern": "^[a-z0-9][a-z0-9-]*\\.[a-z0-9][a-z0-9-]*$"
                },
                "claims": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/nonEmpty" }
                },
                "check_key": { "$ref": "#/$defs/key" },
                "expected_assertion_failures": {
                    "type": "array",
                    "minItems": 1,
                    "items": { "$ref": "#/$defs/key" },
                    "uniqueItems": true
                },
                "preserved_assertions": { "$ref": "#/$defs/keys", "default": [] },
                "allowed_fanout_assertions": {
                    "$ref": "#/$defs/keys",
                    "default": []
                },
                "mutation": {
                    "oneOf": [
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "paths"],
                            "properties": {
                                "type": { "const": "remove_paths" },
                                "paths": { "$ref": "#/$defs/nonEmptyStrings" }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "path", "fixture_path"],
                            "properties": {
                                "type": { "const": "replace_file" },
                                "path": { "$ref": "#/$defs/nonEmpty" },
                                "fixture_path": { "$ref": "#/$defs/nonEmpty" }
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "path", "pointer", "value"],
                            "properties": {
                                "type": { "const": "replace_json_value" },
                                "path": { "$ref": "#/$defs/nonEmpty" },
                                "pointer": {
                                    "type": "string",
                                    "pattern": "^/(?:[^~/]|~[01])+(?:/(?:[^~/]|~[01])+)*$"
                                },
                                "value": true
                            }
                        },
                        {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["type", "path", "match", "replacement"],
                            "properties": {
                                "type": { "const": "replace_text" },
                                "path": { "$ref": "#/$defs/nonEmpty" },
                                "match": { "$ref": "#/$defs/nonEmpty" },
                                "replacement": { "type": "string" }
                            }
                        }
                    ]
                }
            }
        }
    }
}
