{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "schemas/artifact_root_resolution.schema.json",
  "title": "anu_v3.artifact_root_resolution.v1",
  "description": "task-2553+46 §3.C — canonical ANU workspace root resolution + collector artifact lookup verdict. The canonical root /home/jay/workspace is searched FIRST; an autoset/current-cwd false-miss must NEVER alone yield RESULT_MISSING (regression 10/11). RESULT_MISSING/DISPATCH_NOT_RECEIVED are FORBIDDEN when the canonical root has the artifact.",
  "type": "object",
  "oneOf": [
    {
      "title": "ResolvedRoots",
      "required": [
        "schema",
        "canonical_root",
        "autoset_cwd_root",
        "events_dir",
        "reports_dir",
        "schedule_history_dir",
        "canonical_root_present",
        "events_dir_present",
        "search_order"
      ],
      "properties": {
        "schema": { "type": "string", "const": "anu_v3.artifact_root_resolution.v1" },
        "canonical_root": { "type": "string", "const": "/home/jay/workspace" },
        "autoset_cwd_root": { "type": "string" },
        "events_dir": { "type": "string" },
        "reports_dir": { "type": "string" },
        "schedule_history_dir": { "type": "string" },
        "canonical_root_present": { "type": "boolean" },
        "events_dir_present": { "type": "boolean" },
        "search_order": {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 2,
          "description": "Canonical root FIRST, autoset second — proves §3.C re-check ordering."
        }
      },
      "additionalProperties": true
    },
    {
      "title": "CollectorLookupResult",
      "required": [
        "schema",
        "task_id",
        "verdict",
        "registry_verdict",
        "canonical_root",
        "events_dir",
        "autoset_only_miss_blocked"
      ],
      "properties": {
        "schema": { "type": "string", "const": "anu_v3.collector_artifact_lookup.v1" },
        "task_id": { "type": "string", "minLength": 1 },
        "verdict": {
          "type": "string",
          "enum": [
            "NORMAL_COLLECTOR_COMPLETED",
            "RESULT_PRESENT",
            "RESULT_MISSING",
            "BOT_STALE",
            "TRACK_MISMATCH",
            "PENDING_FAILSAFE"
          ]
        },
        "registry_verdict": {
          "type": "string",
          "enum": [
            "NORMAL_CALLBACK_COMPLETED",
            "NORMAL_CALLBACK_PENDING",
            "NO_LEDGER_RECORD",
            "TRACK_MISMATCH"
          ]
        },
        "canonical_root": { "type": "string", "const": "/home/jay/workspace" },
        "events_dir": { "type": "string" },
        "result_present_canonical": { "type": "boolean" },
        "collector_result_present_canonical": { "type": "boolean" },
        "done_present_canonical": { "type": "boolean" },
        "autoset_cwd_root": { "type": "string" },
        "autoset_only_miss_blocked": {
          "type": "boolean",
          "description": "True iff the autoset cwd lacked memory/events and the canonical root was re-checked before any missing verdict (§3.C / regression 11)."
        },
        "schedule_history_seen": { "type": "boolean" },
        "dispatch_stale": { "type": "boolean" },
        "reasons": { "type": "array", "items": { "type": "string" } }
      },
      "additionalProperties": true
    }
  ]
}
