{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://cernly.dev/schema/map.v1.schema.json",
  "title": "Cernly map (map.json) v1",
  "description": "Derived from one facts file by the rules (https://cernly.dev/how/map/). Deterministic: same facts + same rules version + same settings = byte-identical file, canonical JSON like the scan. Every derived item names the fact keys it comes from in `from`; the evidence (file + line) is in those facts, the map adds none of its own. Draft, like scan v1.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schema", "scan", "rules_version", "catalogue_version", "settings", "stacks", "links", "images", "attached", "parties", "internal", "unknown", "own", "ai_tools", "findings"],
  "properties": {
    "schema": { "const": "cernly.map/v1" },
    "scan": {
      "type": "object",
      "additionalProperties": false,
      "required": ["repo", "commit", "schema", "extractor", "sha256"],
      "description": "The facts file this map was derived from",
      "properties": {
        "repo": { "type": "string" },
        "commit": { "type": "string" },
        "schema": { "type": "string" },
        "extractor": { "type": "string", "description": "Extractor version of the scan" },
        "sha256": { "type": "string", "pattern": "^[0-9a-f]{64}$", "description": "Of the facts file bytes as read" }
      }
    },
    "rules_version": { "type": "string" },
    "catalogue_version": { "type": "string", "description": "Version of the provider catalogue the rules used (https://cernly.dev/how/catalogue/)" },
    "settings": {
      "type": "object",
      "additionalProperties": false,
      "required": ["default_branch"],
      "description": "Operator settings the rules used",
      "properties": {
        "default_branch": { "type": "string" },
        "confirmations": { "type": "array", "items": { "$ref": "#/$defs/confirmation" }, "description": "Confirmations in effect when the map was derived (https://cernly.dev/how/stacks/), in id order" }
      }
    },
    "stacks": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["stack", "role", "manual", "reasons"],
        "properties": {
          "stack": { "type": "string", "description": "Key of the stack fact" },
          "name": { "type": "string", "description": "Declared display name" },
          "role": { "enum": ["production", "production (unconfirmed)", "none"] },
          "derived_role": { "enum": ["production", "production (unconfirmed)", "none"], "description": "What the rules derived, when a declaration replaced it" },
          "declared": { "$ref": "#/$defs/declarant" },
          "confirmed": { "$ref": "#/$defs/confirmed" },
          "manual": { "type": "boolean", "description": "A workflow_dispatch path starts this stack" },
          "reasons": {
            "type": "array",
            "description": "One verdict per workflow job that starts the stack; the stack takes the strongest",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["workflow", "job", "role", "detail"],
              "properties": {
                "workflow": { "type": "string" },
                "job": { "type": "string" },
                "role": { "enum": ["production", "production (unconfirmed)", "none"] },
                "detail": { "type": "string" },
                "unreadable": { "type": "array", "items": { "type": "string" }, "description": "if: terms the rules cannot read, as normalised" },
                "test_job": { "$ref": "#/$defs/test_job", "description": "The job is a test job, so it never makes the stack production (https://cernly.dev/how/stacks/)" }
              }
            }
          }
        }
      }
    },
    "links": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["service", "recipe", "contexts", "sources", "precision", "via", "from"],
        "properties": {
          "service": { "type": "string" },
          "recipe": { "type": "string" },
          "contexts": { "type": "array", "items": { "type": "string" }, "description": "Build contexts the link was built with; empty when none is known, and then sources is empty too" },
          "sources": { "type": "array", "items": { "type": "string" }, "description": "Repo paths: the recipe's sources inside each context" },
          "precision": { "enum": ["module", "binary"] },
          "via": { "type": "array", "items": { "enum": ["compose_build", "image_build"] } },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "images": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["service", "image_repo", "class", "from"],
        "properties": {
          "service": { "type": "string" },
          "image_repo": { "type": "string" },
          "class": { "enum": ["third_party"] },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "ci_images": {
      "type": "array",
      "description": "Images a CI job builds that no Compose service of the repo runs (https://cernly.dev/how/map/). One per recipe (Dockerfile and stage). Never production: where it runs is not in this repo. Optional: maps from rules before 0.3.0 lack it.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["image", "recipe", "dockerfile", "target", "image_repos", "builds", "pushes", "contexts", "sources", "precision", "test_only", "deployment", "detail", "from"],
        "properties": {
          "image": { "type": "string", "pattern": "^ci_image:", "description": "ci_image:<dockerfile>:<stage>; the subject of attached[] and parties[].services" },
          "recipe": { "type": "string", "description": "Key of the image_recipe fact" },
          "dockerfile": { "type": "string" },
          "target": { "type": "string", "description": "The stage built: the named target, or the final stage's name" },
          "image_repos": { "type": "array", "items": { "type": "string" }, "description": "image_repo of every build, as written" },
          "builds": {
            "type": "array",
            "description": "Every CI job that builds it",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["build", "workflow", "job", "events", "branches"],
              "properties": {
                "build": { "type": "string", "description": "Key of the image_build fact" },
                "workflow": { "type": "string" },
                "job": { "type": "string" },
                "job_name": { "type": "string" },
                "job_line": { "type": "integer", "minimum": 1 },
                "line": { "type": "integer", "minimum": 1, "description": "The step that builds it, or reaches the script that does" },
                "events": { "type": "array", "items": { "type": "string" } },
                "branches": { "type": "array", "items": { "type": "string" } },
                "test_job": { "$ref": "#/$defs/test_job", "description": "The job is a test job (applied to the steps after the build, https://cernly.dev/how/stacks/)" }
              }
            }
          },
          "pushes": {
            "type": "array",
            "description": "Registry repositories it is pushed to, as written, tag stripped; empty when no push is seen",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["target", "by", "build"],
              "properties": {
                "target": { "type": "string" },
                "by": { "enum": ["push", "docker_push"], "description": "push: the build command pushes all its tags (image_build push); docker_push: a later step of the same job" },
                "build": { "type": "string" },
                "workflow": { "type": "string" },
                "job": { "type": "string" },
                "line": { "type": "integer", "minimum": 1, "description": "docker_push: the step's line" }
              }
            }
          },
          "contexts": { "type": "array", "items": { "type": "string" } },
          "sources": { "type": "array", "items": { "type": "string" }, "description": "Repo paths: the recipe's sources inside each context, as for links" },
          "precision": { "enum": ["module", "binary"] },
          "test_only": { "type": "boolean", "description": "Every CI job that builds it is a test job; kept and marked, never hidden" },
          "deployment": { "enum": ["not_seen"], "description": "not_seen: nothing in this repo shows where it runs" },
          "detail": { "type": "string", "description": "The image in words, as the app and the report show it" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "attached": {
      "type": "array",
      "description": "Facts that live in a linked service's code, or an image built in CI (service is then its ci_image key): dependency, env_var, outbound_host whose evidence lies in a link source. Nothing filtered; scope as the fact has it.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["service", "fact", "kind", "source", "from"],
        "properties": {
          "service": { "type": "string" },
          "fact": { "type": "string" },
          "kind": { "enum": ["dependency", "env_var", "outbound_host"] },
          "scope": { "type": "string", "description": "The fact's own scope (prod, dev, test, build, unknown), when it has one" },
          "internal": { "type": "string", "description": "Repo folder, when the dependency is an internal package (https://cernly.dev/how/facts/)" },
          "source": { "type": "string", "description": "The link source the evidence lies in" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "parties": {
      "type": "array",
      "description": "Outside parties from the provider catalogue (https://cernly.dev/how/catalogue/). A party is on a service when one of its matching facts is attached to that service.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "name", "category", "kind", "grade", "services", "signals"],
        "properties": {
          "id": { "type": "string" },
          "name": { "type": "string" },
          "category": { "type": "string" },
          "kind": { "enum": ["provider", "protocol"], "description": "protocol: names no provider (S3 API, SMTP)" },
          "grade": { "enum": ["confirmed", "single"], "description": "confirmed: two or more signal kinds agree; single: one kind" },
          "services": { "type": "array", "items": { "type": "string" }, "description": "Service and data store keys; empty when only facts on no service match" },
          "confirmed": { "$ref": "#/$defs/confirmed" },
          "signals": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["kind", "fact"],
              "properties": {
                "kind": { "enum": ["sdk", "env", "host", "image"] },
                "fact": { "type": "string" }
              }
            }
          }
        }
      }
    },
    "internal": {
      "type": "array",
      "description": "Protocols served by a data store in the same stack (S3 by MinIO): left off the outside parties",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "service", "datastore", "from"],
        "properties": {
          "id": { "type": "string" },
          "service": { "type": "string" },
          "datastore": { "type": "string" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "unknown": {
      "type": "array",
      "description": "Host hints no catalogue entry claims: the unknown bucket. AI naming comes later and stays suggested until a human confirms.",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["host", "usage", "from"],
        "properties": {
          "host": { "type": "string" },
          "usage": { "enum": ["request", "default", "env_hint", "mention"], "description": "Strongest way it was seen; a mention is a literal not shown to be called" },
          "confirmed": { "$ref": "#/$defs/confirmed", "description": "Approved as a supplier in the application" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "own": {
      "type": "array",
      "description": "The organisation's own hosts: on a declared own domain, or served by a route of the repo (https://cernly.dev/how/plugins/), or both. Never an outside party, never unknown",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["host", "domain", "from"],
        "anyOf": [{ "required": ["declared"] }, { "required": ["served_by"] }, { "required": ["confirmed"] }],
        "properties": {
          "host": { "type": "string" },
          "domain": { "type": "string", "description": "The declared domain, or the host itself when it is only served" },
          "declared": { "$ref": "#/$defs/declarant" },
          "confirmed": { "$ref": "#/$defs/confirmed", "description": "Claimed as own in the application, as domains.own" },
          "served_by": { "type": "array", "items": { "type": "string" }, "description": "route facts whose site address is this host" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "routes": {
      "type": "array",
      "description": "Web server routes (route facts) placed in the stack whose service mounts the config file. An upstream that names a service or data store of that stack is an edge (to); any other upstream stays as written. One entry per route, mounting service and upstream",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["route", "sites", "match", "action", "from"],
        "properties": {
          "route": { "type": "string" },
          "stack": { "type": "string", "description": "Absent: no compose service mounts the file" },
          "via": { "type": "string", "description": "The service that mounts the file" },
          "sites": { "type": "array", "items": { "type": "string" } },
          "match": { "type": "string", "description": "Methods and paths, a named matcher, or * for everything" },
          "action": { "enum": ["proxy", "fastcgi", "respond", "redirect", "file_server"] },
          "upstream": { "type": "string" },
          "to": { "type": "string" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "ai_tools": {
      "type": "array",
      "description": "AI coding tools the repo is set up for (agent_config facts): repo-level proof, not which change a tool wrote",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["tool", "name", "files", "from"],
        "properties": {
          "tool": { "type": "string" },
          "name": { "type": "string" },
          "files": { "type": "integer", "minimum": 1 },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "findings": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["rule", "subject", "detail", "from"],
        "properties": {
          "rule": { "enum": ["no_code_link", "link_conflict", "production_unconfirmed", "image_pinning", "party_unconfirmed", "driver_without_store"] },
          "subject": { "type": "string", "description": "Fact key the finding is about" },
          "grade": { "enum": ["floating", "unknown", "exact"], "description": "image_pinning: how the image is pinned (https://cernly.dev/how/facts/); exact means a full version without digest" },
          "image": { "type": "string", "description": "image_pinning: the image repository without tag (registry/repository), so a new tag of the same repository reads as an upgrade (https://cernly.dev/how/gate/)" },
          "detail": { "type": "string" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "tests": {
      "type": "array",
      "description": "Test suites per service and the commands that run them (https://cernly.dev/how/plugins/): a test_suite whose folders lie in a link's sources is on that service; a test_run of the suite's language covers it in its own folder (maven, gradle and pytest also in the folders below). No coverage is measured. Absent without test_suite facts",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["suite", "language", "framework", "files", "runs", "from"],
        "properties": {
          "service": { "type": "string", "description": "Service fact key; absent when the suite lies on no linked service" },
          "suite": { "type": "string" },
          "language": { "type": "string" },
          "framework": { "type": "string" },
          "files": { "type": "integer", "minimum": 1 },
          "runs": { "type": "array", "items": { "type": "string" }, "description": "test_run keys; empty when no command found runs the suite" },
          "jobs": {
            "type": "array",
            "description": "CI jobs that reach one of the runs",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["workflow", "job"],
              "properties": { "workflow": { "type": "string" }, "job": { "type": "string" } }
            }
          },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "tables": {
      "type": "array",
      "description": "Database tables merged across schema sources by qualified name, with columns whose name looks sensitive (https://cernly.dev/how/map/). Absent without db_table facts",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["table", "from"],
        "properties": {
          "table": { "type": "string", "description": "Qualified name as the facts give it" },
          "schema": { "type": "string", "description": "The part before the last dot; absent when the name has none" },
          "from": { "type": "array", "minItems": 1, "items": { "type": "string" }, "description": "db_table fact keys, one per source" },
          "check": {
            "type": "array",
            "description": "Columns whose name matches the fixed word list: check encryption and access, not a verdict",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": ["column", "word", "from"],
              "properties": {
                "column": { "type": "string" },
                "word": { "type": "string", "description": "The word list entry that matched" },
                "from": { "type": "array", "minItems": 1, "items": { "type": "string" } }
              }
            }
          }
        }
      }
    },
    "confirmations": {
      "type": "array",
      "description": "What each confirmation in settings did to this map (https://cernly.dev/how/stacks/). Absent without confirmations",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["id", "kind", "subject", "value", "reason", "by", "at", "status"],
        "properties": {
          "id": { "type": "integer", "minimum": 1 },
          "kind": { "type": "string" },
          "subject": { "type": "string" },
          "value": { "type": "string" },
          "reason": { "type": "string" },
          "by": { "type": "string" },
          "issuer": { "type": "string" },
          "person": { "type": "string" },
          "at": { "type": "string" },
          "status": { "enum": ["applied", "overridden", "no_subject", "ignored"], "description": "overridden: a declaration in the scan wins; no_subject: this scan has no such stack, party or host" }
        }
      }
    },
    "dismissed": {
      "type": "array",
      "description": "Parties and hosts a person said are not suppliers (https://cernly.dev/how/stacks/): moved here from parties and unknown, so they stay visible",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["subject", "kind", "name", "confirmed", "from"],
        "properties": {
          "subject": { "type": "string" },
          "kind": { "enum": ["party", "host"] },
          "name": { "type": "string" },
          "confirmed": { "$ref": "#/$defs/confirmed" },
          "from": { "type": "array", "items": { "type": "string" } }
        }
      }
    },
    "modules": {
      "type": "object",
      "additionalProperties": false,
      "required": ["packages", "edges", "cycles", "services"],
      "description": "The import graph of the repo's own packages (rules 0.8.0, https://cernly.dev/how/map/): import facts as edges, the packages they name as nodes. Absent without import facts.",
      "properties": {
        "packages": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["package", "language", "dir", "fan_in", "fan_out", "depth"],
            "properties": {
              "package": { "type": "string" },
              "language": { "type": "string" },
              "dir": { "type": "string" },
              "module": { "type": "string" },
              "fan_in": { "type": "integer", "minimum": 0, "description": "Packages of the repo that import it" },
              "fan_out": { "type": "integer", "minimum": 0, "description": "Packages of the repo it imports" },
              "depth": { "type": "integer", "minimum": 0, "description": "Longest chain of imports below it; a cycle counts as one step" },
              "cycle": { "type": "boolean" }
            }
          }
        },
        "edges": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["from", "to", "lines", "facts"],
            "properties": {
              "from": { "type": "string" },
              "to": { "type": "string" },
              "lines": { "type": "integer", "minimum": 1, "description": "Import lines that prove the edge" },
              "facts": { "type": "array", "items": { "type": "string" } }
            }
          }
        },
        "cycles": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["packages", "from"],
            "properties": {
              "packages": { "type": "array", "items": { "type": "string" } },
              "from": { "type": "array", "items": { "type": "string" } }
            }
          }
        },
        "services": {
          "type": "array",
          "description": "The packages each linked service or image built in CI reaches: from its recipe's resolved Go entrypoints, else every package in its sources",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["service", "reach", "packages", "from"],
            "properties": {
              "service": { "type": "string" },
              "reach": { "enum": ["entrypoints", "sources"] },
              "roots": { "type": "array", "items": { "type": "string" } },
              "packages": { "type": "array", "items": { "type": "string" } },
              "from": { "type": "array", "items": { "type": "string" } }
            }
          }
        }
      }
    },
    "metrics": {
      "type": "object",
      "additionalProperties": false,
      "required": ["total", "production", "services"],
      "description": "Surface metrics (rules 0.8.0; items since 0.10.0, https://cernly.dev/how/map/), counted from this map: in total, in the stacks whose role is production or production (unconfirmed), and per service. Size and coupling are context, never the headline. Absent in maps of rules before 0.8.0.",
      "properties": {
        "total": { "$ref": "#/$defs/surface" },
        "production": { "$ref": "#/$defs/surface" },
        "services": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["service", "role", "outside_parties", "data_stores", "columns_to_check", "unpinned_images", "routes", "size"],
            "properties": {
              "service": { "type": "string", "description": "A service key or a ci_image key" },
              "role": { "type": "string", "description": "Its stack's role; none for an image built in CI" },
              "outside_parties": { "type": "integer", "minimum": 0 },
              "data_stores": { "type": "integer", "minimum": 0, "description": "Data stores of its stack it depends on" },
              "columns_to_check": { "type": "integer", "minimum": 0, "description": "Columns to check of tables whose schema lies in its sources" },
              "unpinned_images": { "type": "integer", "minimum": 0, "description": "image_pinning findings on it or its recipe" },
              "routes": { "type": "integer", "minimum": 0, "description": "Routes that reach it" },
              "size": { "$ref": "#/$defs/size" },
              "coupling": { "$ref": "#/$defs/coupling" },
              "items": { "$ref": "#/$defs/service_items", "unevaluatedProperties": false }
            }
          }
        }
      }
    }
  },
  "$defs": {
    "surface": {
      "type": "object",
      "additionalProperties": false,
      "required": ["outside_parties", "data_stores", "columns_to_check", "unpinned_images", "production_stacks", "routes", "size"],
      "properties": {
        "outside_parties": { "type": "integer", "minimum": 0 },
        "data_stores": { "type": "integer", "minimum": 0 },
        "columns_to_check": { "type": "integer", "minimum": 0 },
        "unpinned_images": { "type": "integer", "minimum": 0 },
        "production_stacks": { "type": "integer", "minimum": 0 },
        "routes": { "type": "integer", "minimum": 0 },
        "size": { "$ref": "#/$defs/size" },
        "coupling": { "$ref": "#/$defs/coupling" },
        "items": {
          "description": "What each count counts (rules 0.10.0); each list as long as its count. Absent before rules 0.10.0",
          "allOf": [{ "$ref": "#/$defs/service_items" }],
          "required": ["production_stacks"],
          "properties": { "production_stacks": { "type": "array", "items": { "type": "string" }, "description": "Stack keys" } },
          "unevaluatedProperties": false
        }
      }
    },
    "service_items": {
      "type": "object",
      "required": ["outside_parties", "data_stores", "columns_to_check", "unpinned_images", "routes"],
      "description": "What a service's counts count (rules 0.10.0), so every number traces to its facts. Absent before rules 0.10.0",
      "properties": {
        "outside_parties": { "type": "array", "items": { "type": "string" }, "description": "Party ids; each party lists its signal facts" },
        "data_stores": { "type": "array", "items": { "type": "string" }, "description": "datastore keys" },
        "columns_to_check": { "type": "array", "items": { "type": "string" }, "description": "table.column; the table lists its facts" },
        "unpinned_images": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["subject", "detail"],
            "properties": { "subject": { "type": "string" }, "detail": { "type": "string" } },
            "description": "An image_pinning finding"
          }
        },
        "routes": { "type": "array", "items": { "type": "string" }, "description": "route keys" }
      }
    },
    "size": {
      "type": "object",
      "additionalProperties": false,
      "required": ["files", "lines", "test_files", "test_lines", "languages"],
      "description": "Source files and physical lines from source_size facts; a file counts once. test_files and test_lines count the test code among them again, on their own",
      "properties": {
        "files": { "type": "integer", "minimum": 0 },
        "lines": { "type": "integer", "minimum": 0 },
        "test_files": { "type": "integer", "minimum": 0 },
        "test_lines": { "type": "integer", "minimum": 0 },
        "languages": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": ["language", "files", "lines"],
            "properties": {
              "language": { "type": "string" },
              "files": { "type": "integer", "minimum": 1 },
              "lines": { "type": "integer", "minimum": 0 }
            }
          }
        }
      }
    },
    "coupling": {
      "type": "object",
      "additionalProperties": false,
      "required": ["packages", "imports", "max_fan_in", "max_fan_out", "cycles", "depth"],
      "properties": {
        "packages": { "type": "integer", "minimum": 1 },
        "imports": { "type": "integer", "minimum": 0 },
        "max_fan_in": { "type": "integer", "minimum": 0 },
        "max_fan_out": { "type": "integer", "minimum": 0 },
        "cycles": { "type": "integer", "minimum": 0 },
        "depth": { "type": "integer", "minimum": 0 }
      }
    },
    "test_job": {
      "type": "object",
      "additionalProperties": false,
      "required": ["by", "match", "line"],
      "description": "A test job (https://cernly.dev/how/stacks/). Evidence: the workflow file at line",
      "properties": {
        "by": { "enum": ["job_id", "job_name", "step_name", "runner"], "description": "What matched: a name, or only test runners after the stack starts or the image is built" },
        "match": { "type": "string", "description": "The name, or the first test runner command, as written" },
        "line": { "type": "integer", "minimum": 1, "description": "Line of the job or step in the workflow file" }
      }
    },
    "declarant": {
      "type": "object",
      "additionalProperties": false,
      "required": ["by"],
      "description": "Who declared it (https://cernly.dev/how/config/): the repo's hint file (.cernly.yml) or the operator",
      "properties": {
        "by": { "enum": ["repo", "operator"] },
        "line": { "type": "integer", "minimum": 1 }
      }
    },
    "confirmation": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "kind", "subject", "value", "reason", "by", "at"],
      "description": "A decision a person made in the application (https://cernly.dev/how/stacks/), never a fact. Declarations in the scan win over it",
      "properties": {
        "id": { "type": "integer", "minimum": 1, "description": "The entry in the instance's trail" },
        "kind": { "type": "string", "description": "stack_role, party, host or driver" },
        "subject": { "type": "string", "description": "A stack key, party:<id>, host:<host>, or for driver a dependency key" },
        "value": { "type": "string", "description": "stack_role: production or none; party: approved or not_supplier; host: approved, not_supplier or own; driver: store:<the store it talks to, as a person names it> or not_used" },
        "reason": { "type": "string" },
        "by": { "type": "string", "description": "Display name" },
        "issuer": { "type": "string" },
        "person": { "type": "string", "description": "The sign-in provider's subject for the person" },
        "at": { "type": "string", "description": "When it was made, RFC 3339" }
      }
    },
    "confirmed": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "value", "by", "at"],
      "description": "The confirmation an item carries (https://cernly.dev/how/stacks/)",
      "properties": {
        "id": { "type": "integer", "minimum": 1 },
        "value": { "type": "string" },
        "by": { "type": "string" },
        "at": { "type": "string" },
        "overridden": { "type": "boolean", "description": "A declaration in the scan says otherwise, and wins" }
      }
    }
  }
}
