{
  "$id": "https://schema.rtemis.org/artifact/report/v1/schema.json",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "rtemis report artifact",
  "description": "One immutable version of an rtemis harness artifact holding rendered output, and the records every number in it came from. `name` and `version` say which revision of which artifact; `id` is a BLAKE3 digest over the RFC 8785 canonical form of `content`, so it says whether two versions are the same document.",
  "type": "object",
  "properties": {
    "id": {
      "description": "Digest of `content`, as `blake3:<hex>` over its RFC 8785 canonical form. The algorithm travels with the digest rather than being implied, so a later one can be introduced without rewriting what is already recorded -- the property `DataFingerprint` gets from carrying `algorithm` and `encoding` beside each hash.",
      "type": "string"
    },
    "type": {
      "description": "Which of the five this is.",
      "type": "string",
      "const": "report"
    },
    "name": {
      "description": "The artifact's name within its study, stable across versions.",
      "type": "string"
    },
    "version": {
      "description": "Which revision this is, from 1, contiguous within a name.",
      "type": "integer",
      "minimum": 1
    },
    "created": {
      "description": "When this version was written, RFC 3339 in UTC.",
      "type": "string"
    },
    "origin": {
      "description": "Who authored this version.",
      "type": "string",
      "enum": ["user_edit", "agent_revision", "applied_patch", "run_result"]
    },
    "content": {
      "description": "Rendered output, and where every number in it came from.",
      "type": "object",
      "properties": {
        "rendered": {
          "description": "The rendered report, as Markdown.",
          "type": "string"
        },
        "records": {
          "description": "The record versions it drew from. Every number in `rendered` traces to a field of one of these. The list is what makes that checkable rather than asserted, and it is why a report references records instead of embedding their values.",
          "type": "array",
          "items": {
            "description": "Which version of which artifact, and what it hashed to when referenced. The name and version locate it -- they are what the store is keyed by. The digest is what makes the reference *evidence*: a report that cites a record says which bytes it read, so a later reader can tell whether they are the bytes still there.",
            "type": "object",
            "properties": {
              "name": {
                "description": "The referenced artifact's name.",
                "type": "string"
              },
              "version": {
                "description": "Which version of it.",
                "type": "integer",
                "minimum": 1
              },
              "id": {
                "description": "What that version's content hashed to, as `blake3:<hex>`.",
                "type": "string"
              }
            },
            "additionalProperties": false,
            "required": ["name", "version", "id"]
          }
        }
      },
      "additionalProperties": false,
      "required": ["rendered", "records"]
    }
  },
  "additionalProperties": false,
  "required": ["id", "type", "name", "version", "created", "origin", "content"]
}
