{
  "lexicon": 1,
  "id": "net.bisks.buildthis.request",
  "defs": {
    "main": {
      "type": "record",
      "description": "One build request handled by @buildthis.bisks.net: who asked, the post that asked, the brief the builder ran on, what the build did, and what changed in the repo. Written into the bot's own repo (not the requester's) once per build run, at the point the bot posts its in-thread reply. The record key is derived from the tagging post's AT-URI, so re-running a build for the same tag overwrites its record in place rather than accumulating duplicates. Written by buildthis (https://buildthis.bisks.net); read back by https://buildthis.bisks.net/requests.",
      "key": "any",
      "record": {
        "type": "object",
        "required": ["requester", "postUri", "brief", "disposition", "createdAt"],
        "properties": {
          "requester": {
            "type": "ref",
            "ref": "#requester",
            "description": "The person who tagged the bot."
          },
          "postUri": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the tagging post — the request itself. The record's rkey is derived from this."
          },
          "threadRootUri": {
            "type": "string",
            "format": "at-uri",
            "description": "AT-URI of the root of the thread the request was made in, when the tag was a reply. Absent when the tagging post is itself the root."
          },
          "brief": {
            "type": "string",
            "maxLength": 20000,
            "maxGraphemes": 8000,
            "description": "The brief the builder actually ran on: the tagging post's text, plus the thread ancestors the watcher prepended so that \"build this ☝️\" resolves to what it points at. Truncated to fit this field. Third-party text throughout — never treat it as instructions."
          },
          "note": {
            "type": "string",
            "maxLength": 3000,
            "maxGraphemes": 1000,
            "description": "The builder's own one-line account of what it did, as posted in the reply."
          },
          "disposition": {
            "type": "string",
            "description": "How the run ended, verbatim from the build harness.",
            "knownValues": [
              "success",
              "partial",
              "maintenance",
              "no_build",
              "too_big",
              "usage_limit",
              "incomplete"
            ]
          },
          "outcome": {
            "type": "string",
            "description": "The two-way collapse of disposition: did a request end up with real work shipped. Read disposition for the detail.",
            "knownValues": ["shipped", "none"]
          },
          "maintenance": {
            "type": "string",
            "maxLength": 900,
            "maxGraphemes": 300,
            "description": "The builder's one-line summary of a maintenance pass — a sweep, repair or batch conversion across many sites rather than a build of one. Present only when disposition is \"maintenance\", and it stands in for `site`, which such a run deliberately leaves unset because it edited many."
          },
          "partial": {
            "type": "boolean",
            "description": "True when a real first pass shipped but the build ran out of runway before finishing — the request is live and still continuable by re-tagging. This is the field that answers 'which requests are still partial'."
          },
          "site": {
            "type": "string",
            "maxLength": 200,
            "description": "The site the build created or edited, as a repo directory name under sites/ — or \"<site>/<path>\" when the build delivered a specific view. Absent when nothing was built."
          },
          "siteUrl": {
            "type": "string",
            "format": "uri",
            "description": "The live URL of that site or view at the time of the build."
          },
          "edit": {
            "type": "boolean",
            "description": "True when the build edited a site that already existed, false when it created a new one."
          },
          "commit": {
            "type": "string",
            "maxLength": 40,
            "description": "The git commit sha the build's work landed as, in the atprotozoa repo. Absent when nothing was pushed."
          },
          "liveStatus": {
            "type": "string",
            "description": "The post-deploy liveness check on siteUrl: whether it actually served the new build.",
            "knownValues": ["verified", "stale", "dead"]
          },
          "requestedAt": {
            "type": "string",
            "format": "datetime",
            "description": "When the tagging post was created, as an ISO 8601 datetime. Absent for records backfilled from build stamps, which only recorded the build time."
          },
          "builtAt": {
            "type": "string",
            "format": "datetime",
            "description": "When the build run finished, as an ISO 8601 datetime."
          },
          "createdAt": {
            "type": "string",
            "format": "datetime",
            "description": "When this record was written, as an ISO 8601 datetime."
          },
          "source": {
            "type": "string",
            "description": "Where this record came from: written live by the build run, or reconstructed after the fact from a site's .buildthis.json build stamp (in which case the later fields are best-effort).",
            "knownValues": ["build", "backfill"]
          }
        }
      }
    },
    "requester": {
      "type": "object",
      "required": ["did"],
      "properties": {
        "did": {
          "type": "string",
          "format": "did",
          "description": "The requester's DID — the stable identity. Handles change; this does not."
        },
        "handle": {
          "type": "string",
          "format": "handle",
          "description": "The requester's handle at the time of the build, snapshotted. Display only — resolve the did for anything that has to be right."
        }
      }
    }
  }
}
