schema_version: 2026-06-03-canonical-artifact-resolver-v2
formula_id: CANONICAL_ARTIFACT_RESOLVER_V2
supersedes: CANONICAL_ARTIFACT_RESOLVER_V1
purpose: >
  산출물 단일 진실원장과 stale reference 차단.
  RC5 수정: 동일 개념의 다중 버전이 상호충돌·기술부채를 만든다.
  버전별 1개 canonical만 게이트 입력으로 허용.

# ── canonical 버전 맵 (개념별 최신·권위 버전 단일 지정) ─────────────────────
canonical_versions:
  smart_cash_recovery:
    canonical: smart_cash_recovery_v9.json
    deprecated:
      - smart_cash_recovery_v8.json
      - smart_cash_recovery_v7.json
      - smart_cash_recovery_v6.json
      - smart_cash_recovery_v5.json
      - smart_cash_recovery_v4.json
      - smart_cash_recovery_v3.json
    gate_input_allowed: smart_cash_recovery_v9.json
    note: "v9부터 VALUE_PRESERVING_CASH_RAISE_V9 정책 적용 (BREACH_FULL_LIQUIDATION 금지)"

  distribution_risk_score:
    canonical: distribution_risk_score_v4.json
    deprecated:
      - distribution_risk_score_v3.json
      - distribution_risk_score_v2.json
    gate_input_allowed: distribution_risk_score_v4.json

  final_execution_decision:
    canonical: final_execution_decision_v4.json
    deprecated:
      - final_execution_decision_v3.json
      - final_execution_decision_v2.json
      - final_execution_decision_v1.json
    gate_input_allowed: final_execution_decision_v4.json

  alpha_lead_threshold_optimizer:
    canonical: alpha_lead_threshold_optimizer_v3.json
    deprecated:
      - alpha_lead_threshold_optimizer_v2.json
      - alpha_lead_threshold_optimizer_v1.json
    gate_input_allowed: alpha_lead_threshold_optimizer_v3.json

  pass_100_criteria:
    canonical: pass_100_criteria_v3.json
    deprecated:
      - pass_100_criteria_v2.json
      - pass_100_criteria_v1.json
    gate_input_allowed: pass_100_criteria_v3.json
    note: "v3에 RELEASE_GATE_TRUTH_V1 추가됨 (TASK-001)"

  prediction_accuracy_harness:
    canonical: prediction_accuracy_harness_v5.json
    deprecated:
      - prediction_accuracy_harness_v4.json
      - prediction_accuracy_harness_v3.json
      - prediction_accuracy_harness_v2.json
    gate_input_allowed: prediction_accuracy_harness_v5.json

  smart_money_liquidity_evidence_gate:
    canonical: smart_money_liquidity_evidence_gate_v5.json
    deprecated:
      - smart_money_liquidity_evidence_gate_v4.json
      - smart_money_liquidity_evidence_gate_v3.json
      - smart_money_liquidity_evidence_gate_v2.json
    gate_input_allowed: smart_money_liquidity_evidence_gate_v5.json

  canonical_metrics:
    canonical: canonical_metrics_v4.json
    deprecated:
      - canonical_metrics_v3.json
      - canonical_metrics_v2.json
      - canonical_metrics_v1.json
    gate_input_allowed: canonical_metrics_v4.json

  anti_late_entry_pullback_gate:
    canonical: anti_late_entry_pullback_gate_v4.json
    deprecated:
      - anti_late_entry_pullback_gate_v3.json
    gate_input_allowed: anti_late_entry_pullback_gate_v4.json

# ── 이전 단일 원천 우선순위 (하위호환 유지) ─────────────────────────────────
canonical_source_precedence:
  - final_decision_packet_active
  - final_execution_decision_v4
  - smart_cash_recovery_v9
  - smart_cash_recovery_v8
  - engine_audit_v1
  - sell_engine_audit_v1

required_outputs:
  - canonical_metrics.cash_shortfall_min_krw
  - distinct_cash_shortfall_values
  - stale_artifact_reference_count

acceptance_criteria:
  canonical_per_concept: {op: "==", target: 1, note: "개념별 canonical == 1 (다중 권위본 0건)"}
  gate_input_canonical_pct: {op: "==", target: 100, note: "게이트 입력 파일 100%가 canonical map에 존재"}

python_tool: tools/build_canonical_artifact_resolver_v1.py
validator: tools/validate_canonical_artifact_resolver_v1.py
