{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:benchx:schema:measurement-result:0.1.0",
  "title": "BenchX measurement result ingest object",
  "description": "One measurement attempt for one quantity and one workload variant, as reported by a producer. See docs/design/benchmark-result-schema.md section 5. Producers report coordinates and evidence; comparison identity, series, and series points are derived by the server and are never part of this message. Conditions such as temperature or load are sibling results sharing attempt_key, not coordinates; whether a coordinate splits history is decided by a projection, by default the project's identity policy (schemas/identity-policy/0.1.0).",
  "$comment": "Rules the schema cannot express and the server enforces at ingest: the primary subject component's source, when present, equals the top-level source URI; a quantity's unit never changes once used in a project; at most one estimate summary per estimator declaration; results sharing an attempt_key agree on the fields listed in section 5.3; identical (producer, ingest_key) payloads are idempotent and differing ones conflict; UCUM unit syntax; interval lower bounds not exceeding upper bounds; completed_repetitions never exceeding attempted_repetitions, and likewise completed never exceeding attempted at each repetition level; exactly one provenance.references entry per compound input role; comparison profiles (section 5.5) are checked by the comparator, not here. A result without project or benchmark is thin (section 4.1): valid, comparable within its run, and joinable to tracked series only through an approved mapping.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema_version",
    "producer",
    "ingest_key",
    "attempt_key",
    "source",
    "revision",
    "coordinates",
    "measurement",
    "provenance"
  ],
  "properties": {
    "schema_version": {
      "description": "Message contract version this object conforms to.",
      "const": "benchx/measurement-result/0.1.0"
    },
    "producer": {
      "description": "Stable, namespaced identity of the adapter or harness that produced this message, plus its software and mapping versions. Only the name is part of the idempotency key.",
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "version", "mapping_version"],
      "properties": {
        "name": { "$ref": "#/$defs/token" },
        "version": { "$ref": "#/$defs/nonEmptyString" },
        "mapping_version": {
          "description": "Version of the native-to-BenchX mapping applied by the producer.",
          "$ref": "#/$defs/nonEmptyString"
        }
      }
    },
    "ingest_key": {
      "description": "Producer-scoped idempotency key. Unique per result under one producer name; must distinguish workload variant, quantity, and attempt.",
      "$ref": "#/$defs/token"
    },
    "attempt_key": {
      "description": "Globally namespace-qualified key, such as a URI-like key or UUID, shared by every result from one concrete execution of one workload variant. A retry gets a new key.",
      "$ref": "#/$defs/token"
    },
    "project": {
      "description": "Namespace for project-defined names and policy. Optional only for thin local results.",
      "$ref": "#/$defs/token"
    },
    "source": {
      "description": "Designated subject source whose revisions form the history axis.",
      "$ref": "#/$defs/sourceRef"
    },
    "revision": {
      "description": "Subject revision measured, keyed by the clean VCS identifier. Dirty state is a provenance flag.",
      "$ref": "#/$defs/revisionRef"
    },
    "benchmark": {
      "description": "Exact code that defined and executed the workload. A reported coordinate that policy normally maps to a declared benchmark version. Optional only for thin local results with no benchmark repository. The revision may be omitted when the benchmark code has no version control; provenance.benchmark_tree then identifies it and benchmark_dirty is dirty.",
      "type": "object",
      "additionalProperties": false,
      "required": ["source"],
      "properties": {
        "source": { "$ref": "#/$defs/sourceRef" },
        "revision": { "$ref": "#/$defs/revisionRef" }
      }
    },
    "coordinates": {
      "description": "Reported coordinates: what was measured and under which conditions. Fingerprinted as reported; identity policy projects them into comparison identity.",
      "type": "object",
      "additionalProperties": false,
      "required": ["workload", "subject", "protocol", "environment"],
      "properties": {
        "workload": {
          "description": "Workload variant: a named operation plus one resolved parameter assignment.",
          "type": "object",
          "additionalProperties": false,
          "required": ["name"],
          "properties": {
            "name": { "$ref": "#/$defs/token" },
            "parameters": {
              "description": "One concrete parameter assignment. Values are primitives or arrays of primitives. A baseline-versus-variant study uses a `role` parameter.",
              "type": "object",
              "additionalProperties": { "$ref": "#/$defs/parameterValue" }
            },
            "dataset": {
              "description": "Identity of the input data. Part of the workload variant, so runs on different data never share a variant.",
              "type": "object",
              "additionalProperties": false,
              "required": ["name"],
              "properties": {
                "name": { "$ref": "#/$defs/token" },
                "version": { "$ref": "#/$defs/nonEmptyString" },
                "sha256": { "$ref": "#/$defs/sha256" },
                "parameters": {
                  "description": "Generation parameters such as row count or seed.",
                  "type": "object",
                  "additionalProperties": { "$ref": "#/$defs/parameterValue" }
                }
              }
            }
          }
        },
        "subject": {
          "description": "Implementation or system under test. Exactly one component has role 'primary' and is the designated source; other components are pinned coordinates.",
          "type": "object",
          "additionalProperties": false,
          "required": ["name", "components"],
          "properties": {
            "name": { "$ref": "#/$defs/token" },
            "components": {
              "type": "array",
              "minItems": 1,
              "items": { "$ref": "#/$defs/subjectComponent" },
              "contains": {
                "type": "object",
                "properties": { "role": { "const": "primary" } },
                "required": ["role"]
              },
              "minContains": 1,
              "maxContains": 1
            },
            "configuration": {
              "description": "How the artifact under test was built or configured: build type, compiler, flags, JIT/AOT mode, backend.",
              "type": "object"
            }
          }
        },
        "protocol": {
          "description": "How the subject is exercised and measured: protocol version, warmup and calibration policy, timer.",
          "type": "object"
        },
        "environment": {
          "description": "Host or allocation shared by every result of the attempt.",
          "type": "object",
          "additionalProperties": false,
          "required": ["schema_version", "identity"],
          "properties": {
            "schema_version": {
              "description": "Identity schema that defines which identity fields exist and how they are hashed.",
              "$ref": "#/$defs/token"
            },
            "identity": {
              "description": "Fields that define environment identity under the named schema.",
              "type": "object",
              "minProperties": 1
            },
            "system": {
              "description": "Facts about the system the attempt ran on that do not name the host: kernel, C library, drivers, image digest, runtime, the allowlisted process environment. null means read but undeterminable.",
              "type": "object"
            }
          }
        },
        "resource_selection": {
          "description": "Optional resource this result applies to within the environment: CPU/core set, GPU UUID or device index, accelerator partition.",
          "type": "object",
          "minProperties": 1
        }
      }
    },
    "measurement": {
      "description": "The measured quantity, its outcome, and producer evidence. Like the estimator, the quantity says what the number is, not what produced it, so it is never a coordinate.",
      "type": "object",
      "additionalProperties": false,
      "required": ["quantity", "status"],
      "properties": {
        "quantity": {
          "description": "Measured quantity and its canonical UCUM unit. Distinct measurement semantics require distinct names.",
          "type": "object",
          "additionalProperties": false,
          "required": ["name", "unit"],
          "properties": {
            "name": { "$ref": "#/$defs/token" },
            "unit": { "$ref": "#/$defs/nonEmptyString" },
            "direction": { "enum": ["lower-is-better", "higher-is-better"] },
            "deterministic": { "type": "boolean" }
          }
        },
        "kind": {
          "description": "measurand: what the attempt set out to measure. condition: a state the system passed through during the attempt, recorded beside its measurands (an influence quantity, in metrology terms; section 4.4). A property of this result, not of the quantity: load average is a condition beside a timing benchmark and a measurand in a load study.",
          "enum": ["measurand", "condition"],
          "default": "measurand"
        },
        "status": { "enum": ["success", "partial", "censored", "error", "skipped"] },
        "reason": {
          "description": "Machine-readable lowercase token such as 'timeout' or 'resource-exhausted.memory'. Required for every status except success.",
          "type": "string",
          "pattern": "^[a-z0-9]+([.-][a-z0-9]+)*$"
        },
        "constraint": { "$ref": "#/$defs/constraint" },
        "observations": {
          "description": "Observation batch: finite values in the quantity's canonical unit after declared normalization. Numbers, or structured observations carrying per-observation metadata.",
          "type": "array",
          "minItems": 1,
          "items": {
            "oneOf": [
              { "type": "number" },
              { "$ref": "#/$defs/structuredObservation" }
            ]
          }
        },
        "derivation": {
          "description": "For a compound result with a pairwise batch: the per-pair rule that produced the observations, declared as a compound estimator at input_level observations (section 4.5).",
          "allOf": [ { "$ref": "#/$defs/estimator" }, { "required": ["inputs"] } ]
        },
        "summaries": {
          "description": "Typed producer summaries. Server-derived values never appear here.",
          "type": "array",
          "minItems": 1,
          "items": { "$ref": "#/$defs/summary" }
        }
      },
      "allOf": [
        {
          "if": { "properties": { "status": { "const": "success" } } },
          "then": {
            "anyOf": [
              { "required": ["observations"] },
              { "properties": { "summaries": { "contains": { "$ref": "#/$defs/estimateSummary" } } }, "required": ["summaries"] }
            ],
            "not": { "required": ["constraint"] }
          }
        },
        {
          "if": { "properties": { "status": { "const": "partial" } } },
          "then": {
            "required": ["reason"],
            "anyOf": [
              { "required": ["observations"] },
              { "properties": { "summaries": { "contains": { "$ref": "#/$defs/estimateSummary" } } }, "required": ["summaries"] }
            ],
            "not": { "required": ["constraint"] }
          }
        },
        {
          "if": { "properties": { "status": { "const": "censored" } } },
          "then": {
            "required": ["reason", "constraint"],
            "not": { "anyOf": [ { "required": ["observations"] }, { "required": ["summaries"] } ] }
          }
        },
        {
          "if": { "properties": { "status": { "enum": ["error", "skipped"] } } },
          "then": {
            "required": ["reason"],
            "not": { "anyOf": [ { "required": ["observations"] }, { "required": ["summaries"] }, { "required": ["constraint"] } ] }
          }
        }
      ]
    },
    "procedure": {
      "description": "Realized batch-wide acquisition details. Per-observation metadata belongs on structured observations instead.",
      "type": "object",
      "properties": {
        "inner_iterations": { "type": "integer", "minimum": 1 },
        "attempted_repetitions": { "type": "integer", "minimum": 1 },
        "completed_repetitions": { "type": "integer", "minimum": 0 },
        "repetition_levels": {
          "description": "Realized counterpart of a multi-level protocol.repetitions, outermost level first. Counts are totals over the attempt, so 20 processes of 3 values each attempt 20 processes and 60 values. attempted_repetitions and completed_repetitions remain the totals at the innermost level.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["unit", "attempted", "completed"],
            "properties": {
              "unit": { "$ref": "#/$defs/token" },
              "attempted": { "type": "integer", "minimum": 1 },
              "completed": { "type": "integer", "minimum": 0 }
            }
          }
        },
        "warmups_performed": { "type": "integer", "minimum": 0 },
        "duration_seconds": { "type": "number", "minimum": 0 },
        "caches_cleared": {
          "description": "Caches actually dropped during the attempt, in order.",
          "type": "array",
          "items": { "$ref": "#/$defs/token" }
        },
        "slot": {
          "description": "Position of this attempt in the run's realized order across all sides, zero-based. The intended schedule is protocol.schedule.",
          "type": "integer",
          "minimum": 0
        },
        "timeout_seconds": {
          "description": "Limit the run author imposed on the attempt, recorded whether or not it fired. An attempt stopped by it is error with reason timeout, not censored.",
          "type": "number",
          "exclusiveMinimum": 0
        },
        "round": {
          "description": "Position of this attempt in an interleaved run, monotone per run and kept by a retry. Attempts with the same round number across sides of a comparison are paired.",
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "provenance": {
      "description": "Audit metadata. Nothing here enters comparison identity.",
      "type": "object",
      "additionalProperties": false,
      "required": ["started_at", "subject_dirty", "benchmark_dirty"],
      "$comment": "A tree id is required whenever the matching dirty flag is clean or dirty, and absent when it is unknown.",
      "allOf": [
        {
          "if": { "properties": { "subject_dirty": { "enum": ["clean", "dirty"] } } },
          "then": { "required": ["subject_tree"] },
          "else": { "not": { "required": ["subject_tree"] } }
        },
        {
          "if": { "properties": { "benchmark_dirty": { "enum": ["clean", "dirty"] } } },
          "then": { "required": ["benchmark_tree"] },
          "else": { "not": { "required": ["benchmark_tree"] } }
        }
      ],
      "properties": {
        "run_key": {
          "description": "Grouping key assigned by the run author: scheduler, CLI, or CI system.",
          "$ref": "#/$defs/token"
        },
        "labels": {
          "description": "Caller-supplied labels for selecting sides of a comparison, such as {\"env\": \"numpy-2.0\"}. Never enter identity.",
          "type": "object",
          "additionalProperties": { "$ref": "#/$defs/nonEmptyString" }
        },
        "native_id": {
          "description": "Identifier of this result in the producer's native system.",
          "$ref": "#/$defs/nonEmptyString"
        },
        "started_at": {
          "description": "Measurement start on the producer's clock. The only fact that orders attempts across runs; ingest time is never used.",
          "$ref": "#/$defs/timestamp"
        },
        "ended_at": { "$ref": "#/$defs/timestamp" },
        "subject_dirty": { "$ref": "#/$defs/dirtyState" },
        "subject_tree": {
          "description": "Content hash of the measured subject checkout: the git tree object id of the working tree, or a native equivalent. Equal ids mean identical code regardless of commit.",
          "$ref": "#/$defs/treeId"
        },
        "benchmark_dirty": {
          "description": "unknown when no benchmark repository exists or its state could not be determined.",
          "$ref": "#/$defs/dirtyState"
        },
        "benchmark_tree": {
          "description": "Content hash of the measured benchmark checkout, as for subject_tree.",
          "$ref": "#/$defs/treeId"
        },
        "runner": {
          "description": "Audit-only identity of the runner software.",
          "type": "object",
          "additionalProperties": false,
          "required": ["name"],
          "properties": {
            "name": { "$ref": "#/$defs/nonEmptyString" },
            "version": { "$ref": "#/$defs/nonEmptyString" }
          }
        },
        "original_unit": {
          "description": "Unit used by the producer before normalization to the canonical unit.",
          "$ref": "#/$defs/nonEmptyString"
        },
        "source_payload_uri": { "$ref": "#/$defs/uri" },
        "source_payload_sha256": { "$ref": "#/$defs/sha256" },
        "ci_uri": { "$ref": "#/$defs/uri" },
        "references": {
          "description": "Stable references to other results in the same run: compound-estimator inputs by role, or an anchor measurement. Never enter identity.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["role", "result"],
            "properties": {
              "role": { "$ref": "#/$defs/token" },
              "result": { "$ref": "#/$defs/resultRef" }
            }
          }
        },
        "artifacts": {
          "description": "External evidence such as large observation sets, profiles, or histograms.",
          "type": "array",
          "items": { "$ref": "#/$defs/artifact" }
        },
        "info": {
          "description": "Open descriptive metadata: logs, notes, corrections.",
          "type": "object"
        }
      }
    },
    "quality": {
      "description": "Immutable producer-side validation and warnings. Store-side quarantine and exclusion are separate state.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "warnings": {
          "type": "array",
          "items": { "$ref": "#/$defs/token" }
        },
        "validation": {
          "description": "Producer-observed validation facts. The verdict that acts on them is decision policy.",
          "type": "object",
          "properties": {
            "correctness": {
              "description": "Outcome of a harness-run correctness check against expected output.",
              "enum": ["pass", "fail"]
            }
          }
        }
      }
    }
  },
  "allOf": [
    {
      "$comment": "A compound declaration, in an estimate summary or in measurement.derivation, needs provenance.references so each input role resolves to a stored result.",
      "if": {
        "required": ["measurement"],
        "properties": {
          "measurement": {
            "anyOf": [
              { "required": ["derivation"] },
              {
                "required": ["summaries"],
                "properties": {
                  "summaries": {
                    "contains": { "required": ["estimator"], "properties": { "estimator": { "required": ["inputs"] } } }
                  }
                }
              }
            ]
          }
        }
      },
      "then": { "properties": { "provenance": { "required": ["references"] } } }
    },
    {
      "$comment": "A benchmark without a revision is identified by its tree alone, and an unversioned tree cannot be shown to be clean.",
      "if": { "required": ["benchmark"], "properties": { "benchmark": { "not": { "required": ["revision"] } } } },
      "then": {
        "properties": {
          "provenance": {
            "required": ["benchmark_tree"],
            "properties": { "benchmark_dirty": { "const": "dirty" } }
          }
        }
      }
    }
  ],
  "$defs": {
    "nonEmptyString": { "type": "string", "minLength": 1 },
    "token": {
      "description": "Non-empty string without whitespace.",
      "type": "string",
      "minLength": 1,
      "pattern": "^\\S+$"
    },
    "uri": { "type": "string", "minLength": 1, "format": "uri" },
    "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
    "treeId": {
      "description": "Lowercase hex content hash of a working tree: 40 characters for git SHA-1 repositories, 64 for SHA-256 ones or other hash schemes.",
      "type": "string",
      "pattern": "^([0-9a-f]{40}|[0-9a-f]{64})$"
    },
    "dirtyState": {
      "description": "Working-tree state of the measured checkout. unknown is distinct from clean so comparators can reject anything not known to be clean.",
      "enum": ["clean", "dirty", "unknown"]
    },
    "timestamp": {
      "description": "RFC 3339 UTC timestamp.",
      "type": "string",
      "format": "date-time",
      "$comment": "format is an annotation in draft 2020-12; the pattern is the assertion.",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}(\\.[0-9]+)?Z$"
    },
    "finiteNumber": { "type": "number" },
    "primitive": { "type": ["string", "number", "boolean", "null"] },
    "parameterValue": {
      "oneOf": [
        { "$ref": "#/$defs/primitive" },
        { "type": "array", "items": { "$ref": "#/$defs/primitive" } }
      ]
    },
    "sourceRef": {
      "type": "object",
      "additionalProperties": false,
      "required": ["uri"],
      "properties": {
        "uri": { "$ref": "#/$defs/uri" },
        "type": {
          "description": "Source kind, such as git, hg, or dataset.",
          "$ref": "#/$defs/token"
        }
      }
    },
    "revisionRef": {
      "type": "object",
      "additionalProperties": false,
      "required": ["key"],
      "properties": {
        "key": {
          "description": "Clean VCS identifier or other native revision key.",
          "$ref": "#/$defs/token"
        },
        "native_order": {
          "description": "Optional order metadata from the native system when the source cannot supply topology.",
          "type": "integer"
        },
        "native_time": { "$ref": "#/$defs/timestamp" }
      }
    },
    "resultRef": {
      "description": "Stable reference to a stored result.",
      "type": "object",
      "additionalProperties": false,
      "required": ["producer", "ingest_key"],
      "properties": {
        "producer": { "$ref": "#/$defs/token" },
        "ingest_key": { "$ref": "#/$defs/token" }
      }
    },
    "subjectComponent": {
      "type": "object",
      "additionalProperties": false,
      "required": ["role"],
      "properties": {
        "role": { "$ref": "#/$defs/token" },
        "source": { "$ref": "#/$defs/uri" },
        "revision": { "$ref": "#/$defs/token" }
      },
      "if": { "properties": { "role": { "const": "primary" } } },
      "then": {
        "$comment": "The primary component's revision is the top-level revision; its source, if given, must equal the top-level source URI.",
        "not": { "required": ["revision"] }
      },
      "else": {
        "$comment": "Non-primary components are pinned coordinates.",
        "required": ["source", "revision"]
      }
    },
    "estimator": {
      "description": "Estimator declaration. Name, method version, parameters, input level, and input roles enter the estimator fingerprint.",
      "type": "object",
      "additionalProperties": false,
      "required": ["name", "method_version", "input_level"],
      "properties": {
        "name": { "$ref": "#/$defs/token" },
        "method_version": { "$ref": "#/$defs/token" },
        "input_level": { "enum": ["observations", "estimates"] },
        "parameters": {
          "description": "Details that can alter the value, such as percentile interpolation.",
          "type": "object"
        },
        "inputs": {
          "description": "Semantic input roles of a compound estimator.",
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["role", "quantity"],
            "properties": {
              "role": { "$ref": "#/$defs/token" },
              "quantity": { "$ref": "#/$defs/token" }
            }
          }
        }
      },
      "if": { "properties": { "input_level": { "const": "estimates" } } },
      "then": { "required": ["inputs"] }
    },
    "structuredObservation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["value"],
      "properties": {
        "value": { "$ref": "#/$defs/finiteNumber" },
        "ordinal": { "type": "integer", "minimum": 0 },
        "slot": {
          "description": "Position of this observation in the run's realized order across all sides, for observation-level interleaving.",
          "type": "integer",
          "minimum": 0
        },
        "time": { "$ref": "#/$defs/timestamp" },
        "group": { "$ref": "#/$defs/token" },
        "pair": { "$ref": "#/$defs/token" },
        "included": { "type": "boolean" },
        "exclusion_reason": { "$ref": "#/$defs/token" }
      }
    },
    "constraint": {
      "description": "Quantitative constraint for censored results: kind, finite bound(s), inclusivity of each bound present, and cause. Fields present must match the kind.",
      "type": "object",
      "additionalProperties": false,
      "required": ["kind", "cause"],
      "properties": {
        "kind": { "enum": ["lower_bound", "upper_bound", "interval"] },
        "lower": { "$ref": "#/$defs/finiteNumber" },
        "upper": { "$ref": "#/$defs/finiteNumber" },
        "lower_inclusive": { "type": "boolean" },
        "upper_inclusive": { "type": "boolean" },
        "cause": { "$ref": "#/$defs/token" }
      },
      "allOf": [
        {
          "if": { "properties": { "kind": { "const": "lower_bound" } } },
          "then": { "required": ["lower", "lower_inclusive"], "not": { "anyOf": [ { "required": ["upper"] }, { "required": ["upper_inclusive"] } ] } }
        },
        {
          "if": { "properties": { "kind": { "const": "upper_bound" } } },
          "then": { "required": ["upper", "upper_inclusive"], "not": { "anyOf": [ { "required": ["lower"] }, { "required": ["lower_inclusive"] } ] } }
        },
        {
          "if": { "properties": { "kind": { "const": "interval" } } },
          "then": { "required": ["lower", "upper", "lower_inclusive", "upper_inclusive"] }
        }
      ]
    },
    "summarySource": {
      "description": "Every summary in an ingest object is producer evidence.",
      "const": "producer"
    },
    "estimateSummary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "estimator", "value", "source"],
      "properties": {
        "type": { "const": "estimate" },
        "estimator": { "$ref": "#/$defs/estimator" },
        "value": { "$ref": "#/$defs/finiteNumber" },
        "source": { "$ref": "#/$defs/summarySource" }
      }
    },
    "statisticSummary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "name", "value", "source"],
      "properties": {
        "type": { "const": "statistic" },
        "name": { "$ref": "#/$defs/token" },
        "value": { "$ref": "#/$defs/finiteNumber" },
        "method": { "$ref": "#/$defs/nonEmptyString" },
        "source": { "$ref": "#/$defs/summarySource" }
      }
    },
    "intervalSummary": {
      "description": "Confidence or coverage interval for a named statistic at a stated level.",
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "statistic", "level", "lower", "upper", "source"],
      "properties": {
        "type": { "enum": ["confidence_interval", "coverage_interval"] },
        "statistic": { "$ref": "#/$defs/token" },
        "level": { "type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 1 },
        "lower": { "$ref": "#/$defs/finiteNumber" },
        "upper": { "$ref": "#/$defs/finiteNumber" },
        "method": { "$ref": "#/$defs/nonEmptyString" },
        "source": { "$ref": "#/$defs/summarySource" }
      }
    },
    "sourceBoundsSummary": {
      "description": "Opaque bounds whose exact semantics are unknown. The label preserves source terminology such as stat, sys, range, or error.",
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "label", "source"],
      "anyOf": [ { "required": ["lower"] }, { "required": ["upper"] } ],
      "properties": {
        "type": { "const": "source_bounds" },
        "statistic": { "$ref": "#/$defs/token" },
        "label": { "$ref": "#/$defs/nonEmptyString" },
        "lower": { "$ref": "#/$defs/finiteNumber" },
        "upper": { "$ref": "#/$defs/finiteNumber" },
        "source": { "$ref": "#/$defs/summarySource" }
      }
    },
    "standardUncertaintySummary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "statistic", "value", "source"],
      "properties": {
        "type": { "const": "standard_uncertainty" },
        "statistic": { "$ref": "#/$defs/token" },
        "value": { "type": "number", "minimum": 0 },
        "method": { "$ref": "#/$defs/nonEmptyString" },
        "source": { "$ref": "#/$defs/summarySource" }
      }
    },
    "expandedUncertaintySummary": {
      "type": "object",
      "additionalProperties": false,
      "required": ["type", "statistic", "value", "source"],
      "anyOf": [ { "required": ["coverage_factor"] }, { "required": ["level"] } ],
      "properties": {
        "type": { "const": "expanded_uncertainty" },
        "statistic": { "$ref": "#/$defs/token" },
        "value": { "type": "number", "minimum": 0 },
        "coverage_factor": { "type": "number", "exclusiveMinimum": 0 },
        "level": { "type": "number", "exclusiveMinimum": 0, "exclusiveMaximum": 1 },
        "method": { "$ref": "#/$defs/nonEmptyString" },
        "source": { "$ref": "#/$defs/summarySource" }
      }
    },
    "summary": {
      "oneOf": [
        { "$ref": "#/$defs/estimateSummary" },
        { "$ref": "#/$defs/statisticSummary" },
        { "$ref": "#/$defs/intervalSummary" },
        { "$ref": "#/$defs/sourceBoundsSummary" },
        { "$ref": "#/$defs/standardUncertaintySummary" },
        { "$ref": "#/$defs/expandedUncertaintySummary" }
      ]
    },
    "artifact": {
      "type": "object",
      "additionalProperties": false,
      "required": ["kind", "media_type", "uri", "sha256"],
      "properties": {
        "kind": { "$ref": "#/$defs/token" },
        "media_type": { "$ref": "#/$defs/nonEmptyString" },
        "schema": { "$ref": "#/$defs/nonEmptyString" },
        "uri": { "$ref": "#/$defs/uri" },
        "sha256": { "$ref": "#/$defs/sha256" }
      }
    }
  }
}
