{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "schemas/auto_remediation_plan.schema.json",
  "title": "anu_v3.auto_remediation_plan.v1",
  "description": "task-2612 Track C — auto remediation plan. Critical7이 아니면 ANU-Codex loop로 자동 remediation하여 all-settled까지 진행하는 구조의 plan 생성부. 2604유형(global ledger SHA false-positive→track-scoped invariant 교정), 2605유형(stage claim/test mismatch→spy/monkeypatch 실호출 증명 보강), 2609유형(coverage gap→coverage 보강)을 새 task ID remediation spec 골격(목표/필수/금지/expected_files/9-R)으로 변환한다. plan only — 실제 dispatch/코드수정은 본 산출 아님. Critical7 또는 shared invariant 파손 시에만 HOLD_FOR_CHAIR, 그 외 non-Critical은 AUTO_REMEDIATION_HOLD 자동 수렴.",
  "type": "object",
  "required": [
    "schema",
    "plan_id",
    "remediation_of",
    "issue_type",
    "disposition",
    "severity",
    "plan_only",
    "dispatch_performed",
    "spec_skeleton",
    "shared_invariant_preserved",
    "hold_for_chair",
    "reasons"
  ],
  "properties": {
    "schema": { "const": "anu_v3.auto_remediation_plan.v1" },
    "plan_id": {
      "type": "string",
      "description": "새로 발급되는 remediation task ID (예: task-2604-AR1). 본 track 산출 아님 — dispatch 전 plan 식별자."
    },
    "remediation_of": {
      "type": "string",
      "description": "원 HOLD task ID (예: task-2604)."
    },
    "issue_type": {
      "enum": [
        "GLOBAL_LEDGER_SHA_FALSE_POSITIVE",
        "STAGE_CLAIM_TEST_MISMATCH",
        "COVERAGE_GAP"
      ],
      "description": "2604 / 2605 / 2609 유형."
    },
    "disposition": {
      "enum": ["AUTO_REMEDIATION_HOLD", "HOLD_FOR_CHAIR"],
      "description": "non-Critical → AUTO_REMEDIATION_HOLD 자동 수렴 · Critical7 또는 shared invariant 파손 → HOLD_FOR_CHAIR."
    },
    "severity": {
      "enum": ["LOW", "MEDIUM", "HIGH", "CRITICAL"]
    },
    "is_critical7": {
      "type": "boolean",
      "description": "Critical7 분류 (TrackB critical7_classifier 소유 — 본 planner는 입력으로만 소비)."
    },
    "plan_only": {
      "const": true,
      "description": "본 산출은 plan 골격 생성만 — 실 dispatch/코드수정 0 (불변)."
    },
    "dispatch_performed": {
      "const": false,
      "description": "planner는 dispatch/subprocess/cokacdir/merge/PR 0 (불변)."
    },
    "shared_invariant_preserved": { "type": "boolean" },
    "hold_for_chair": { "type": "boolean" },
    "reasons": {
      "type": "array",
      "items": { "type": "string" }
    },
    "source_evidence_refs": {
      "type": "array",
      "items": { "type": "string" },
      "description": "원 HOLD 근거 (read-only consume) 파일 경로."
    },
    "spec_skeleton": {
      "type": "object",
      "required": [
        "task_id",
        "title",
        "goal",
        "must",
        "forbidden",
        "expected_files",
        "nine_r"
      ],
      "properties": {
        "task_id": { "type": "string" },
        "title": { "type": "string" },
        "executor_hint": { "type": "string" },
        "goal": {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1,
          "description": "목표."
        },
        "must": {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1,
          "description": "필수."
        },
        "forbidden": {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1,
          "description": "금지."
        },
        "expected_files": {
          "type": "array",
          "items": { "type": "string" },
          "minItems": 1,
          "description": "expected_files allowlist (DISJOINT 강제)."
        },
        "nine_r": {
          "type": "object",
          "required": ["go_ready_criteria", "relint_required"],
          "properties": {
            "go_ready_criteria": {
              "type": "array",
              "items": { "type": "string" },
              "minItems": 1
            },
            "relint_required": { "type": "boolean" }
          },
          "additionalProperties": true
        }
      },
      "additionalProperties": true
    }
  },
  "allOf": [
    {
      "if": {
        "properties": { "disposition": { "const": "HOLD_FOR_CHAIR" } }
      },
      "then": {
        "properties": { "hold_for_chair": { "const": true } }
      }
    },
    {
      "if": {
        "properties": { "disposition": { "const": "AUTO_REMEDIATION_HOLD" } }
      },
      "then": {
        "properties": { "hold_for_chair": { "const": false } }
      }
    }
  ],
  "additionalProperties": true
}
