{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "title": "Vayu run report export",
  "description": "The document POST /export/run-report writes for a finished load run (issue #2127), schema version 1. Built by allowlist: every member below is copied on purpose, and no other member is ever written. A breaking change bumps schemaVersion and is noted in docs/engine/api-reference.md.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema", "schemaVersion", "generatedAt", "engineVersion", "run", "verdict", "config",
    "report", "comparison", "notCarried"
  ],
  "properties": {
    "schema": {"const": "vayu.run-report"},
    "schemaVersion": {"const": 1},
    "generatedAt": {"description": "Epoch milliseconds.", "type": "integer"},
    "engineVersion": {"type": "string"},
    "run": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "id", "reference", "type", "status", "startTime", "endTime", "name", "comment",
        "baseline"
      ],
      "properties": {
        "id": {"type": "string"},
        "reference": {
          "description": "The Copy for agent run line, start in ISO-8601 UTC, URL cut to its path.",
          "type": "string",
          "pattern": "^Vayu run \""
        },
        "type": {"const": "load"},
        "status": {"enum": ["completed", "failed", "stopped"]},
        "startTime": {"type": "integer"},
        "endTime": {"type": "integer"},
        "name": {"type": ["string", "null"]},
        "comment": {"type": ["string", "null"]},
        "baseline": {"type": "boolean"}
      }
    },
    "verdict": {
      "type": "object",
      "additionalProperties": false,
      "required": ["state", "stoppedEarly", "reason"],
      "properties": {
        "state": {"enum": ["passed", "failed", "not_judged"]},
        "stoppedEarly": {"type": "boolean"},
        "reason": {
          "enum": [
            "stopped", "run_failed", "budgets_missed", "budgets_met", "budgets_met_with_errors",
            "budgets_met_with_assertion_failures", "budgets_met_with_element_errors",
            "budgets_met_with_teardown_failures", "drain_stopped", "no_budgets"
          ]
        }
      }
    },
    "config": {
      "type": "object",
      "additionalProperties": false,
      "required": ["method", "url", "headerNames", "paramNames", "body", "auth", "configuration"],
      "properties": {
        "method": {"type": ["string", "null"]},
        "url": {
          "description": "Credentials blanked by redact_url_credentials.",
          "type": ["string", "null"]
        },
        "headerNames": {"$ref": "#/definitions/names"},
        "paramNames": {"$ref": "#/definitions/names"},
        "body": {
          "type": "object",
          "additionalProperties": false,
          "required": ["mode", "bytes"],
          "properties": {"mode": {"type": "string"}, "bytes": {"type": ["integer", "null"]}}
        },
        "auth": {
          "type": "object",
          "additionalProperties": false,
          "required": ["mode"],
          "properties": {"mode": {"type": "string"}}
        },
        "configuration": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "mode": {"type": "string"},
            "duration": {"type": ["string", "number"]},
            "concurrency": {"type": "number"},
            "startConcurrency": {"type": "number"},
            "rampUpDuration": {"type": ["string", "number"]},
            "timeout": {"type": ["string", "number"]},
            "targetRps": {"type": "number"},
            "comment": {"type": "string"},
            "followRedirects": {"type": "boolean"},
            "maxRedirects": {"type": "number"},
            "httpVersion": {"type": "string"},
            "acceptEncoding": {"type": "boolean"},
            "expectContinue": {"type": "boolean"},
            "dataRowCount": {"type": "number"},
            "dataFileName": {"type": "string"},
            "dataFileHash": {"type": "string"},
            "dataFileCastNumbers": {"type": "boolean"},
            "carriedBudgets": {"$ref": "#/definitions/names"},
            "stepDuration": {"type": ["string", "number"]},
            "sloMs": {"type": "number"}
          }
        }
      }
    },
    "report": {
      "type": "object",
      "additionalProperties": false,
      "required": ["summary", "statusCodes", "errors"],
      "properties": {
        "summary": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "totalRequests", "successfulRequests", "failedRequests", "httpErrorRequests",
            "noResponseRequests", "cancelledRequests", "errorRate", "totalDurationSeconds",
            "avgRps", "testDuration", "sendRate", "throughput", "cleanupOverhead",
            "droppedRequests", "bytesSent", "bytesReceived",
            "httpVersionDowngraded", "throughputBytesPerSec"
          ],
          "properties": {
            "totalRequests": {"type": "number"},
            "successfulRequests": {"type": "number"},
            "failedRequests": {"type": "number"},
            "httpErrorRequests": {"type": "number"},
            "noResponseRequests": {"type": "number"},
            "cancelledRequests": {"type": "number"},
            "drainCut": {
              "description": "Present only when a Stop cut the drain of a run that ended on its own (issue #3538): cancelled is how many requests were still unanswered, all of them inside cancelledRequests and none in any other figure. Such a run is not judged (verdict.reason drain_stopped) unless a budget already failed it.",
              "type": "object",
              "additionalProperties": false,
              "required": ["cancelled"],
              "properties": {"cancelled": {"type": "integer", "minimum": 1}}
            },
            "errorRate": {"type": "number"},
            "totalDurationSeconds": {"type": "number"},
            "avgRps": {"type": "number"},
            "testDuration": {"type": "number"},
            "sendRate": {"type": "number"},
            "throughput": {"type": "number"},
            "setupOverhead": {"description": "Seconds from the load run's start to load start, the instant testDuration counts from: the run's configuration and its script.setup pass (issue #2894). Absent for a run stored before it, whose stored figure measured cleanup and is reported as cleanupOverhead.", "type": "number"},
            "cleanupOverhead": {"description": "Seconds from the end of load to the run's background threads joined, before the summary is written (issue #2894). A run stored before it reported this figure as setupOverhead.", "type": "number"},
            "peakConcurrency": {"description": "The most requests in flight at once. Absent where none was recorded: summary.partial or summary.summaryMissing (issue #2963).", "type": "number"},
            "droppedRequests": {"description": "Requests the maxInFlight cap refused at the instant they came due. Apart from skippedRequests; sent + skipped + dropped is the schedule's count for a constant_rps run that reaches its deadline.", "type": "number"},
            "skippedRequests": {"description": "Requests a constant_rps pacer chose not to send because its tick woke more than 100 ms late (issue #2911): the backlog past the catch-up cap is skipped, not sent in one burst. 0 when the load generator kept up; they lower rateControl.achievement, which is requestsSent over requestsExpected. Absent for a document written before it.", "type": "integer", "minimum": 0},
            "stalledMs": {"description": "The schedule time the skipped requests cover, skippedRequests over the target rate in milliseconds (issue #2911): how long the load generator stalled. Absent for a document written before it.", "type": "number", "minimum": 0},
            "avgQueueWaitMs": {"description": "Mean time a request queued before the wire. Absent where none was recorded: summary.partial or summary.summaryMissing (issue #2963).", "type": "number"},
            "bytesSent": {"type": "number"},
            "bytesReceived": {"type": "number"},
            "httpVersionDowngraded": {"type": "number"},
            "throughputBytesPerSec": {"type": "number"},
            "sendingDurationSeconds": {"description": "The window sendRate and rateControl divide by: load start to the end of sending, the end-of-run drain excluded (issue #2392). Absent for a run stored before it.", "type": "number"},
            "connectionReplays": {"description": "Requests libcurl re-sent on a new connection after the server dropped or refused a reused one before answering (issue #2799). Each is still one counted request and never an error; the target received this many more requests than totalRequests. Absent for a run stored before it.", "type": "integer", "minimum": 0},
            "avgInFlight": {"description": "Mean requests in flight over testDuration (issue #2821): the time requests spent submitted and not yet complete, queue wait included and a Stop's cancellation ending it, over the duration (issue #3567). Timer waits between requests and requests refused before the event loop are excluded. With no think time it equals the virtual user count. A run stored before issue #3567 carries the latency sum over testDuration instead; absent for a run stored before issue #2821.", "type": "number", "minimum": 0},
            "completedWhileSending": {"description": "Requests completed by the end of sendingDurationSeconds, before the end-of-run drain (issue #2882), so never above totalRequests: divided by sendingDurationSeconds it is the response rate while sending, where avgRps and throughput divide every completion by testDuration. Equal to totalRequests where sendingDurationSeconds is the whole testDuration. Absent for a run stored before it.", "type": "integer", "minimum": 0},
            "partial": {"description": "Present and true only for a run the engine died under and reconciled at the next start (issues #2895, #2905): the counts are its last saved tick's, not whole-run totals, and the latency section is absent, not zero (issue #2938): its rows were never flushed. The Markdown and HTML reports say so under the verdict.", "type": "boolean"},
            "summaryMissing": {"description": "Present and true only for a failed load run that stored no summary (issues #2895, #2905): the counts are not whole-run totals and the latency section is absent, not zero (issue #2938). The Markdown and HTML reports say so under the verdict.", "type": "boolean"}
          }
        },
        "latency": {
          "description": "Absent when the run recorded none: summary.partial, summary.summaryMissing (issue #2938), or a collection run in which no step sent.",
          "type": "object",
          "additionalProperties": false,
          "required": ["min", "max", "avg", "median", "p50", "p75", "p90", "p95", "p99", "p999"],
          "properties": {
            "min": {"type": "number"},
            "max": {"type": "number"},
            "avg": {"type": "number"},
            "median": {"type": "number"},
            "p50": {"type": "number"},
            "p75": {"type": "number"},
            "p90": {"type": "number"},
            "p95": {"type": "number"},
            "p99": {"type": "number"},
            "p999": {"type": "number"}
          }
        },
        "statusCodes": {"$ref": "#/definitions/codeCounts"},
        "rateControl": {
          "type": "object",
          "additionalProperties": false,
          "required": ["targetRps", "actualRps", "achievement"],
          "properties": {
            "targetRps": {"type": "number"},
            "actualRps": {"type": "number"},
            "achievement": {"description": "Percent: requestsSent over requestsExpected when both are present. Requests the pacer skipped (summary.skippedRequests) were never sent, so they lower it; the summary shows them beside it rather than hiding the shortfall.", "type": "number"},
            "requestsSent": {"description": "Absent for a run stored before issue #2392, as is requestsExpected.", "type": "number"},
            "requestsExpected": {"type": "number"}
          }
        },
        "errors": {
          "type": "object",
          "additionalProperties": false,
          "required": ["total", "withDetails", "types"],
          "properties": {
            "total": {"type": "number"},
            "withDetails": {"type": "number"},
            "types": {"$ref": "#/definitions/countMap"},
            "byStatusCode": {"$ref": "#/definitions/codeCounts"}
          }
        },
        "timingBreakdown": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "avgDnsMs": {"type": "number"},
            "avgConnectMs": {"type": "number"},
            "avgTlsMs": {"type": "number"},
            "avgFirstByteMs": {"type": "number"},
            "avgDownloadMs": {"type": "number"},
            "phases": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "dns": {"$ref": "#/definitions/phase"},
                "connect": {"$ref": "#/definitions/phase"},
                "tls": {"$ref": "#/definitions/phase"},
                "firstByte": {"$ref": "#/definitions/phase"},
                "download": {"$ref": "#/definitions/phase"}
              }
            }
          }
        },
        "stream": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "completions": {"type": "number"},
            "totalEvents": {"type": "number"},
            "capped": {"type": "number"},
            "eventsPerSecond": {"type": "number"},
            "events": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "min": {"type": "number"},
                "max": {"type": "number"},
                "p50": {"type": "number"},
                "p90": {"type": "number"},
                "p95": {"type": "number"},
                "p99": {"type": "number"},
                "count": {"type": "number"}
              }
            },
            "timeToFirstEvent": {
              "description": "Milliseconds from submission to each stream's first event; count is the completions that delivered one. Absent when none did.",
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "p50": {"type": "number"},
                "p95": {"type": "number"},
                "p99": {"type": "number"},
                "max": {"type": "number"},
                "count": {"type": "number"}
              }
            }
          }
        },
        "slowRequests": {
          "type": "object",
          "additionalProperties": false,
          "required": ["count", "thresholdMs", "percentage"],
          "properties": {
            "count": {"type": "number"},
            "thresholdMs": {"type": "number"},
            "tracesStored": {"type": "number"},
            "percentage": {"type": "number"}
          }
        },
        "sampling": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "errorsDropped": {"type": "number"},
            "successTracesDropped": {"type": "number"},
            "slowTracesDropped": {"type": "number"},
            "responseSamplesDropped": {"type": "number"},
            "exemplarsDropped": {"type": "number"},
            "sampleBodiesDropped": {"type": "number"},
            "responseBodiesCaptured": {"type": "number"},
            "responseSampleBudgetSpent": {"type": "boolean"}
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["code", "message"],
            "properties": {
              "code": {"type": "string"},
              "message": {
                "description": "Written by the engine; names user-chosen variable names at most.",
                "type": "string"
              },
              "count": {
                "description": "unresolved_tokens: requests sent with an unresolved variable. connection_replayed: requests re-sent on a new connection, equal to summary.connectionReplays. cookies_dropped: Set-Cookie headers libcurl's cookie engine discarded across the run.",
                "type": "number"
              },
              "names": {"$ref": "#/definitions/names"},
              "steps": {"type": "number"},
              "configured": {
                "description": "per_host_limit_raised: the eventLoopMaxPerHost setting the run read.",
                "type": "number"
              },
              "effective": {
                "description": "per_host_limit_raised: the per-host limit each event-loop worker ran with.",
                "type": "number"
              },
              "timers": {
                "description": "think_timer_skipped_open_loop: the enabled timers a constant-rate run skipped.",
                "type": "number"
              }
            }
          }
        },
        "scenario": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "iterations": {"type": "number"},
            "iterationsCompleted": {"type": "number"},
            "stepsExecuted": {"type": "number"},
            "passed": {"type": "number"},
            "failed": {"type": "number"},
            "skipped": {"type": "number"},
            "errored": {"type": "number"},
            "stepsStored": {"type": "number"},
            "stepsDropped": {"type": "number"},
            "virtualUsers": {"type": "number"},
            "iterationsAbandoned": {"type": "number"},
            "assertions": {
              "description": "A scenario load run's exact assertion population: assert.* outcomes, required extract.* misses and inline pm.test calls, counted on every completion; never the deferred sampled replay. Absent when the run made none.",
              "$ref": "#/definitions/assertionPopulation"
            },
            "steps": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "index": {"type": "number"},
                  "name": {"type": "string"},
                  "requestId": {"type": "string"},
                  "method": {"type": "string"},
                  "executed": {"type": "number"},
                  "errors": {"type": "number"},
                  "httpErrors": {"type": "number"},
                  "noResponse": {"type": "number"},
                  "unresolvedTokens": {"type": "number"},
                  "extractorMisses": {"type": "number"},
                  "preRequestScript": {"type": "string"},
                  "latency": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "min": {"type": "number"},
                      "p50": {"type": "number"},
                      "p95": {"type": "number"},
                      "p99": {"type": "number"},
                      "max": {"type": "number"}
                    }
                  },
                  "elements": {"type": "array", "items": {"$ref": "#/definitions/elementTally"}}
                }
              }
            },
            "transactions": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "name": {"type": "string"},
                  "count": {"type": "number"},
                  "errors": {"type": "number"},
                  "latency": {
                    "type": "object",
                    "additionalProperties": false,
                    "properties": {
                      "min": {"type": "number"},
                      "p50": {"type": "number"},
                      "p90": {"type": "number"},
                      "p95": {"type": "number"},
                      "p99": {"type": "number"},
                      "max": {"type": "number"}
                    }
                  }
                }
              }
            }
          }
        },
        "monitor": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "samples": {"type": "number"},
            "failures": {"type": "number"},
            "noMatchScrapes": {"type": "number"},
            "lastError": {"type": "string"},
            "series": {
              "type": "object",
              "additionalProperties": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "min": {"type": "number"},
                  "max": {"type": "number"},
                  "avg": {"type": "number"},
                  "count": {"type": "number"}
                }
              }
            }
          }
        },
        "testValidation": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "samplesTested": {"type": "number"},
            "testsPassed": {"type": "number"},
            "testsFailed": {"type": "number"},
            "successRate": {"type": "number"}
          }
        },
        "capacity": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "sloMs": {"type": "number"},
            "maxErrorPct": {"type": "number"},
            "stopReason": {"type": "string"},
            "maxHealthyConcurrency": {"type": "number"},
            "maxHealthyRps": {"type": "number"},
            "p99AtMaxHealthyMs": {"type": "number"},
            "kneeConcurrency": {"type": "number"},
            "kneeP99Ms": {"type": "number"},
            "kneeErrorPct": {"type": "number"},
            "saturationConcurrency": {"type": "number"},
            "saturationRps": {"type": "number"},
            "saturationP99Ms": {"type": "number"},
            "levels": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "concurrency": {"type": "number"},
                  "rps": {"type": "number"},
                  "p99Ms": {"type": "number"},
                  "errorPct": {"type": "number"},
                  "samples": {"type": "number"}
                }
              }
            }
          }
        },
        "coverage": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "operationsTotal": {"type": "number"},
            "operationsCovered": {"type": "number"},
            "declaredResponsesTotal": {"type": "number"},
            "declaredResponsesHit": {"type": "number"},
            "declaredResponseCoveragePct": {"type": "number"},
            "undeclaredStatusesSeen": {"type": "number"},
            "transportErrors": {"type": "number"},
            "undeclaredOperationRequests": {"type": "number"},
            "operations": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                  "operationId": {"type": "string"},
                  "method": {"type": "string"},
                  "path": {"type": "string"},
                  "sent": {"type": "number"},
                  "statusesSeen": {"type": "array", "items": {"type": "number"}},
                  "declaredHit": {"$ref": "#/definitions/names"},
                  "declaredMissed": {"$ref": "#/definitions/names"},
                  "undeclaredSeen": {"type": "array", "items": {"type": "number"}},
                  "transportErrors": {"type": "number"},
                  "otherStatusResponses": {"type": "number"},
                  "statusesTruncated": {"type": "number"}
                }
              }
            }
          }
        },
        "schemaValidation": {
          "description": "Counts only: the bounded failures[] examples carry validator messages about response bodies and are left out; failuresTotal keeps their number.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "sampled": {"type": "number"},
            "checked": {"type": "number"},
            "valid": {"type": "number"},
            "failed": {"type": "number"},
            "unevaluated": {"type": "number"},
            "failuresTotal": {"type": "number"},
            "exact": {"type": "boolean"},
            "failOnSchemaError": {"type": "boolean"},
            "uncheckedReasons": {"$ref": "#/definitions/countMap"},
            "unevaluatedKeywords": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "properties": {"keyword": {"type": "string"}, "count": {"type": "number"}}
              }
            }
          }
        },
        "lifecycle": {
          "description": "Outcomes only: a setup or teardown script's message, its messages and its console are left out.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "setup": {"$ref": "#/definitions/lifecycleOutcomes"},
            "teardown": {"$ref": "#/definitions/lifecycleOutcomes"}
          }
        },
        "elements": {"type": "array", "items": {"$ref": "#/definitions/elementTally"}},
        "thresholdValidation": {
          "type": "object",
          "additionalProperties": false,
          "required": ["checks", "passed", "failed", "verdict"],
          "properties": {
            "checks": {
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["metric", "limit", "passed", "evaluated"],
                "properties": {
                  "metric": {"type": "string"},
                  "limit": {"type": "number"},
                  "actual": {"type": "number"},
                  "passed": {"type": "boolean"},
                  "evaluated": {"type": "boolean"},
                  "assertionsExact": {
                    "description": "maxAssertionFailureRatePct only: assert.* outcomes and inline pm.test calls, counted on every completion.",
                    "$ref": "#/definitions/assertionPopulation"
                  },
                  "assertionsSampled": {
                    "description": "maxAssertionFailureRatePct only: the deferred pm.test replay over responses sampled at 1 in sampleRate (a long run's reservoir cap can make it sparser).",
                    "$ref": "#/definitions/assertionPopulation"
                  },
                  "sampleRate": {
                    "description": "The period assertionsSampled ran at (keep 1 in N); absent when it is empty.",
                    "type": "number"
                  }
                }
              }
            },
            "passed": {"type": "number"},
            "failed": {"type": "number"},
            "verdict": {"enum": ["passed", "failed"]}
          }
        },
        "assertions": {
          "description": "Every failed check a load run's verdict reads (issue #3537), the report's top-level assertions block. Each member is absent when the report does not hold it: a run stored before the block derives exact (and a single-request run's sampled) alone.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "exact": {
              "description": "assert.* outcomes, required extract.* misses and inline pm.test calls, counted on every completion.",
              "$ref": "#/definitions/assertionPopulation"
            },
            "sampled": {
              "description": "The deferred pm.test replay over sampled responses, testValidation's testsPassed and testsFailed.",
              "$ref": "#/definitions/assertionPopulation"
            },
            "errored": {
              "description": "Element executions that ended in error: an inline script that threw, an element that could not run.",
              "type": "number"
            },
            "teardownFailed": {
              "description": "lifecycle.teardown rows whose outcome is failed or error.",
              "type": "number"
            }
          }
        },
        "customMetrics": {
          "type": "object",
          "additionalProperties": {
            "type": "object",
            "additionalProperties": false,
            "required": ["type", "count"],
            "properties": {
              "type": {"enum": ["trend", "counter", "rate"]},
              "count": {"type": "number"},
              "p50": {"type": "number"},
              "p95": {"type": "number"},
              "p99": {"type": "number"},
              "max": {"type": "number"},
              "value": {"type": "number"}
            }
          }
        }
      }
    },
    "timeSeries": {
      "description": "Every tick of GET /runs/:id/metrics, allowlisted. Absent when the export asked for series: none.",
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "elapsed_seconds", "requests_completed", "requests_failed", "current_rps",
          "current_concurrency", "throughput", "error_rate", "status_codes"
        ],
        "properties": {
          "elapsed_seconds": {"type": "number"},
          "requests_completed": {"type": "number"},
          "requests_failed": {"type": "number"},
          "current_rps": {"type": "number"},
          "current_concurrency": {"type": "number"},
          "throughput": {"type": "number"},
          "error_rate": {"type": "number"},
          "status_codes": {"$ref": "#/definitions/codeCounts"},
          "status_seconds": {
            "description": "The responses that completed in the seconds the tick closed, by class (issue #2866). Absent on a tick stored before it; [] when the tick closed no second, which is still a run that counts by second. An entry that is not this shape is dropped by the export.",
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["second", "span", "counts"],
              "properties": {
                "second": {"description": "Seconds from load start.", "type": "integer", "minimum": 0},
                "span": {"description": "Consecutive seconds the counts cover; counts / span is a rate.", "type": "integer", "minimum": 1},
                "counts": {
                  "description": "2xx, 3xx, 4xx, 5xx, then no response or a code outside 200-599.",
                  "type": "array",
                  "minItems": 5,
                  "maxItems": 5,
                  "items": {"type": "integer", "minimum": 0}
                }
              }
            }
          },
          "latency_p50_ms": {"description": "Absent, like p95 and p99, for a second in which nothing completed (issue #2386); a tick stored before that issue has 0 there instead.", "type": "number"},
          "latency_p95_ms": {"type": "number"},
          "latency_p99_ms": {"type": "number"}
        }
      }
    },
    "comparison": {
      "description": "Null without baseRunId. Otherwise the run diffed against its base the way the app's compareReports diffs two reports (engine/tests/fixtures/run-compare-conformance.json pins the three implementations together).",
      "oneOf": [
        {"type": "null"},
        {
          "type": "object",
          "additionalProperties": false,
          "required": ["baseRunId", "baseReference", "differences", "deltas", "statusCodes"],
          "properties": {
            "baseRunId": {"type": "string"},
            "baseReference": {
              "description": "The base run's Copy for agent run line, as run.reference is written.",
              "type": "string",
              "pattern": "^Vayu run \""
            },
            "differences": {
              "description": "Every way the two runs were not the same experiment, in this order. When both reports carry metadata.runType, a mode, concurrency or target_rps only one recorded is a difference, its missing side 'not recorded'; otherwise a field only one report carries is unknown, not a difference (a data file excepted). base and target are formatted as the app shows them.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["field", "base", "target"],
                "properties": {
                  "field": {
                    "enum": [
                      "run_type", "mode", "concurrency", "target_rps", "duration", "status",
                      "http_version", "data_file", "request", "compression", "expect_continue"
                    ]
                  },
                  "base": {"type": "string"},
                  "target": {"type": "string"}
                }
              }
            },
            "deltas": {
              "description": "One entry per compared metric, in this order. A value a report lacks is null, and so is every figure computed from it; so is a figure the report flags as unrecorded (summary.summaryMissing nulls the summary metrics and latency of that run, summary.partial its latency alone). pctChange is null against a zero base.",
              "type": "array",
              "items": {
                "type": "object",
                "additionalProperties": false,
                "required": ["metric", "base", "target", "delta", "pctChange", "direction"],
                "properties": {
                  "metric": {
                    "enum": [
                      "latency.p50", "latency.p90", "latency.p95", "latency.p99", "latency.avg",
                      "latency.max", "summary.avgRps", "summary.throughput", "summary.errorRate",
                      "summary.totalRequests"
                    ]
                  },
                  "base": {"type": ["number", "null"]},
                  "target": {"type": ["number", "null"]},
                  "delta": {"type": ["number", "null"]},
                  "pctChange": {"type": ["number", "null"]},
                  "direction": {"enum": ["lower-is-better", "higher-is-better", "neutral"]}
                }
              }
            },
            "statusCodes": {
              "description": "Every code either run saw, a code one run never saw counting 0.",
              "type": "object",
              "additionalProperties": false,
              "patternProperties": {
                "^-?[0-9]+$": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["base", "target"],
                  "properties": {"base": {"type": "number"}, "target": {"type": "number"}}
                }
              }
            }
          }
        }
      ]
    },
    "notCarried": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["code", "message"],
        "properties": {
          "code": {
            "enum": ["traces_and_samples", "request_values", "message_text", "credential_refreshes"]
          },
          "message": {"type": "string"}
        }
      }
    }
  },
  "definitions": {
    "names": {"type": "array", "items": {"type": "string"}},
    "countMap": {"type": "object", "additionalProperties": {"type": "number"}},
    "codeCounts": {
      "description": "Status code to count. The report's own statusCodes is [[code, count], ...] pairs; the export writes an object.",
      "type": "object",
      "additionalProperties": false,
      "patternProperties": {"^-?[0-9]+$": {"type": "number"}}
    },
    "phase": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "p50": {"type": "number"},
        "p95": {"type": "number"},
        "p99": {"type": "number"},
        "max": {"type": "number"},
        "count": {"type": "number"},
        "mean": {"type": "number"}
      }
    },
    "elementTally": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "id": {"type": "string"},
        "kind": {"type": "string"},
        "name": {"type": "string"},
        "required": {"type": "boolean"},
        "passed": {"type": "number"},
        "failed": {"type": "number"},
        "missing": {"type": "number"},
        "error": {"type": "number"},
        "skipped": {"type": "number"},
        "deferred": {"type": "number"},
        "origin": {"$ref": "#/definitions/elementOrigin"}
      }
    },
    "elementOrigin": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "kind": {"type": "string"},
        "scope": {"type": "string"},
        "id": {"type": "string"},
        "name": {"type": "string"}
      }
    },
    "assertionPopulation": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "passed": {"type": "number"},
        "failed": {"type": "number"}
      }
    },
    "lifecycleOutcomes": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "id": {"type": "string"},
          "kind": {"type": "string"},
          "name": {"type": "string"},
          "origin": {"$ref": "#/definitions/elementOrigin"},
          "outcome": {"type": "string"},
          "waitedMs": {"type": "number"}
        }
      }
    }
  }
}
