{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/rulebase/main/json-schema/rulebase-practice-simulation-dry-run-schema.json",
  "title": "PracticeSimulationDryRun",
  "description": "The latest dry run, of any spec.",
  "x-generated": "2026-10-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rulebase-openapi.json#/components/schemas/PracticeSimulationDryRun",
  "type": [
    "object",
    "null"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "passed",
        "failed",
        "error"
      ],
      "description": "`failed`: the simulation cannot be passed or gives credit without the work (see failures). `error`: the check itself broke (see error); run it again."
    },
    "version": {
      "type": "integer"
    },
    "spec_sha256": {
      "type": "string"
    },
    "stale": {
      "type": "boolean",
      "description": "The spec has changed since this run; it no longer counts for publishing."
    },
    "progress": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "phase": {
          "type": "string"
        },
        "done": {
          "type": "integer"
        },
        "total": {
          "type": "integer"
        }
      },
      "required": [
        "phase",
        "done",
        "total"
      ],
      "description": "While queued or running: world runs done of total (the good path plus one fumble per milestone)."
    },
    "error": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "string"
    },
    "started_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "finished_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "duration_ms": {
      "type": [
        "integer",
        "null"
      ]
    },
    "good_path": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "steps": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "done",
                  "failed",
                  "skipped"
                ]
              },
              "at_seconds": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "error": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "status",
              "at_seconds",
              "error"
            ]
          }
        },
        "milestones": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "met": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "title",
              "met"
            ]
          }
        },
        "prohibited_actions": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "title": {
                "type": "string"
              },
              "happened": {
                "type": "boolean"
              }
            },
            "required": [
              "id",
              "title",
              "happened"
            ]
          }
        },
        "rules": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "fired": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "fired"
            ]
          }
        },
        "duration_ms": {
          "type": "integer"
        }
      },
      "required": [
        "steps",
        "milestones",
        "prohibited_actions",
        "rules",
        "duration_ms"
      ],
      "description": "What the scripted good agent did and how it was graded."
    },
    "fumbles": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "milestone_id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "passed",
              "failed",
              "error"
            ],
            "description": "`passed`: skipping the milestone's steps missed it, as it should."
          },
          "skipped_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "observed": {
            "type": "string"
          }
        },
        "required": [
          "milestone_id",
          "title",
          "status",
          "skipped_steps",
          "observed"
        ]
      },
      "description": "The good path played once per milestone without that milestone's steps."
    },
    "failures": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "target": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "milestone",
                  "prohibited_action",
                  "rule",
                  "persona",
                  "setup",
                  "spec"
                ]
              },
              "id": {
                "type": "string",
                "description": "Milestone, prohibited action, rule or persona id."
              },
              "index": {
                "type": "integer",
                "description": "Setup step index."
              }
            },
            "required": [
              "kind"
            ],
            "description": "The spec row the issue belongs to."
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "target",
          "message"
        ]
      },
      "description": "Why it failed; each pins to a spec row."
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "target": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "milestone",
                  "prohibited_action",
                  "rule",
                  "persona",
                  "setup",
                  "spec"
                ]
              },
              "id": {
                "type": "string",
                "description": "Milestone, prohibited action, rule or persona id."
              },
              "index": {
                "type": "integer",
                "description": "Setup step index."
              }
            },
            "required": [
              "kind"
            ],
            "description": "The spec row the issue belongs to."
          },
          "message": {
            "type": "string"
          }
        },
        "required": [
          "target",
          "message"
        ]
      }
    }
  },
  "required": [
    "id",
    "status",
    "version",
    "spec_sha256",
    "stale",
    "progress",
    "error",
    "created_at",
    "started_at",
    "finished_at",
    "duration_ms",
    "good_path",
    "fumbles",
    "failures",
    "warnings"
  ]
}