{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/proptastic/proptastic/main/contract/schemas/report/v1.json",
  "title": "proptastic's report, v1",
  "description": "`report.json` in `report/` in proptastic's directory of the project the CLI ran (`build/proptastic/report/`, or `target/proptastic/report/` under Maven), written by `run` and `fuzz` with `--report=json`, a default (decision 76). It holds what the run knows of each property, from the files the library left: the manifest, each property's event as the library wrote it, its saved counterexample and its corpus. It's the same for every host and every edition, apart from the build's own test report, so `explain`, Veritastic and the HTML report read it. Within v1 a report only gains fields: read what you know, and ignore a field you don't.",
  "type": "object",
  "required": ["schema", "edition", "tool", "command", "project", "host", "ran", "started", "durationMs", "exitCode", "asked", "totals", "overridden", "warnings", "changes", "properties"],
  "properties": {
    "schema": { "const": "proptastic.report/v1" },
    "edition": { "enum": ["java", "rust", "swift"], "description": "The edition the CLI ran." },
    "tool": {
      "type": "object",
      "required": ["name", "version"],
      "properties": {
        "name": { "const": "proptastic" },
        "version": { "type": "string", "description": "The CLI's version." }
      }
    },
    "command": { "enum": ["run", "fuzz"], "description": "The command that wrote it." },
    "project": { "type": "string", "description": "The project's directory, absolute." },
    "host": { "enum": ["gradle", "maven"], "description": "The build tool whose test runner ran the properties, as the edition's `hosts` binding (E19) names it. Within v1 a host may be added." },
    "ran": { "type": "string", "description": "The build's command, as a person would type it." },
    "started": { "type": "string", "format": "date-time", "description": "When the CLI started the build, in UTC to the millisecond." },
    "durationMs": { "type": "integer", "minimum": 0 },
    "exitCode": { "type": "integer", "minimum": 0, "description": "What the CLI exited with: 0 every property passed, 1 one failed, 3 the build failed and no property did." },
    "asked": {
      "type": "object",
      "description": "The settings asked for on the line, each option's value as typed, `--replay` as `true`; an option not given is absent.",
      "properties": {
        "seed": { "type": "string" },
        "tries": { "type": "string" },
        "profile": { "type": "string" },
        "replay": { "type": "boolean" },
        "noShrink": { "type": "boolean" },
        "only": { "type": "array", "items": { "type": "string" } },
        "at": { "type": "array", "items": { "type": "string" } }
      }
    },
    "totals": {
      "type": "object",
      "required": ["passed", "failed", "didntRun", "added", "registered"],
      "properties": {
        "passed": { "type": "integer", "minimum": 0 },
        "failed": { "type": "integer", "minimum": 0 },
        "didntRun": { "type": "integer", "minimum": 0, "description": "Properties chosen that the build ran no test for." },
        "added": { "type": "integer", "minimum": 0, "description": "Properties a later run registered, added since the manifest was written." },
        "registered": { "type": ["integer", "null"], "minimum": 0, "description": "On a first run, how many properties the manifests have now; `null` on a later run." }
      }
    },
    "overridden": {
      "type": "array",
      "description": "Each setting asked for that the build or a chain beat, as `run-finished` carries it (decision 49).",
      "items": {
        "type": "object",
        "required": ["setting", "option", "asked", "ran", "by", "properties"],
        "properties": {
          "setting": { "enum": ["seed", "tries", "profile"] },
          "option": { "type": "string" },
          "asked": { "type": "string" },
          "ran": { "type": "string" },
          "by": { "enum": ["build", "chain"] },
          "properties": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "fuzz": {
      "type": ["object", "null"],
      "description": "What `fuzz` searched, on a fuzz run's report; absent or `null` on `run`'s (decision 56).",
      "required": ["guided", "durationMs", "tries", "kept", "hangs", "crashes"],
      "properties": {
        "guided": { "type": "boolean", "description": "Whether the search was coverage-guided, by a worker with the agent, rather than rounds of the host." },
        "why": { "type": ["string", "null"], "description": "Why it ran host rounds, when it did." },
        "cover": { "type": ["string", "null"], "description": "The packages coverage was added to, as the agent was given them." },
        "durationMs": { "type": "integer", "minimum": 0, "description": "How long it searched." },
        "tries": { "type": "integer", "minimum": 0, "description": "Inputs tried, across every property." },
        "valid": { "type": ["integer", "null"], "minimum": 0, "description": "Tries no filter or assumption rejected; `null` in host rounds." },
        "branchesReached": { "type": ["integer", "null"], "minimum": 0, "description": "Branches reached in the covered packages; `null` in host rounds." },
        "branchesLoaded": { "type": ["integer", "null"], "minimum": 0, "description": "Branches in the covered classes loaded, of which `branchesReached` were reached; `null` in host rounds." },
        "kept": { "type": "integer", "minimum": 0, "description": "Inputs the search kept: a count of inputs, never coverage." },
        "hangs": { "type": "array", "items": { "type": "string" }, "description": "Each input that ran past its limit, as the file it was written to." },
        "crashes": { "type": "array", "items": { "type": "string" }, "description": "Each input running when a worker ended, as the file it was written to." }
      }
    },
    "warnings": { "type": "array", "items": { "type": "string" }, "description": "What else the person should know, as the human formats' `!` lines say it." },
    "changes": {
      "description": "What changed since the last report in the same place, by the manifest's ids; `null` when there was none to compare with.",
      "oneOf": [
        {
          "type": "object",
          "required": ["newlyFailing", "fixed"],
          "properties": {
            "newlyFailing": { "type": "array", "items": { "type": "string" }, "description": "Properties that passed last time, or weren't there, and failed now." },
            "fixed": { "type": "array", "items": { "type": "string" }, "description": "Properties that failed last time and passed now." }
          }
        },
        { "type": "null" }
      ]
    },
    "properties": {
      "type": "array",
      "description": "Each property the run chose or registered, in order of `id`.",
      "items": { "$ref": "#/$defs/property" }
    }
  },
  "$defs": {
    "property": {
      "type": "object",
      "required": ["id", "name", "module", "task", "at", "verdict", "event", "counterexample", "corpus"],
      "properties": {
        "id": { "type": "string", "description": "The property's exact id, the manifest's." },
        "name": { "type": "string", "description": "As a failure's header names it: `SortTest#sortKeepsSize`." },
        "module": { "type": "string", "description": "The module's directory from the project, `.` for the project's own." },
        "task": { "type": ["string", "null"], "description": "The host's task that ran it, the manifest's `task` (decision 75)." },
        "at": {
          "description": "Where its `forAll` is, the manifest's `at`.",
          "oneOf": [
            {
              "type": "object",
              "required": ["path", "line"],
              "properties": { "path": { "type": "string" }, "line": { "type": "integer", "minimum": 1 } }
            },
            { "type": "null" }
          ]
        },
        "verdict": { "enum": ["passed", "failed", "didntRun"], "description": "What this run found of it." },
        "event": {
          "type": ["object", "null"],
          "description": "Its event this run, as the library wrote it: a `property-passed` or `property-failed` of `proptastic.events/v1`, with everything the library knows (how sure, the model and its outcomes, classify's counts, targets, the counterexample, `fails for any`, the pin and rerun lines); `null` when it didn't run."
        },
        "counterexample": {
          "description": "The counterexample saved for it after the run, which the library replays first; `null` when none is saved.",
          "oneOf": [
            {
              "type": "object",
              "required": ["id", "file"],
              "properties": {
                "id": { "type": "string", "pattern": "^c[0-9a-f]{8}$" },
                "file": { "type": "string", "description": "The counterexample file, from the project." }
              }
            },
            { "type": "null" }
          ]
        },
        "corpus": { "type": "integer", "minimum": 0, "description": "The inputs kept in its corpus, under `.proptastic/corpus/<name>/`: a count of inputs, never coverage." }
      }
    }
  }
}
