meta:
  title: "Harness Governance Contract"
  version: "2026-05-22-v1"
  purpose: "하네스 준수 강제: 문서 지침 + 검증기 + 실행 게이트의 3중 잠금"

governance:
  required_layers:
    - name: "static_guide"
      required_files:
        - "AGENTS.md"
        - "spec/07_output_schema.yaml"
        - "spec/19_harness_contract.yaml"
    - name: "machine_validation"
      required_validators:
        - "tools/validate_specs.py"
        - "tools/validate_harness_context.py"
        - "tools/validate_report_quality.py"
    - name: "execution_gate"
      required_runners:
        - "tools/validate_engine_harness_gate.py"
        - "tools/run_engine_harness_gate.ps1"
        - "tools/run_yolo_full_cycle.ps1"

hardlocks:
  - id: "HG001"
    rule: "coverage_strict_100_required"
    fail_condition: "measure_harness_coverage --strict-100 미통과"
  - id: "HG002"
    rule: "watch_transparency_required"
    fail_condition: "WATCH_LEDGER_OK 미충족"
  - id: "HG003"
    rule: "satellite_proposal_sheet_required"
    fail_condition: "SATELLITE_PROPOSAL_SHEET_OK 미충족"
  - id: "HG004"
    rule: "strategy_harness_required"
    fail_condition: "STRATEGY_HARNESS_V2_OK 미충족"

gate_validity_rules:
  NON_VACUOUS_PASS_GUARD_V1:
    formula_id: NON_VACUOUS_PASS_GUARD_V1
    rationale: >
      row_count=0 또는 sample_n < min_samples 인데 gate=PASS인 항목은
      점수 분자를 부풀린다. effective_n 미달 게이트는 WATCH_PENDING_SAMPLE로 강제 강등.
    min_samples_default: 30
    min_samples_exceptions:
      rebound_efficiency_score: 30   # 이전 4 → 30으로 상향
      late_rebound_bucket_score: 30
    enforcement:
      - "effective_n < min_samples 이면 gate를 PASS로 둘 수 없다"
      - "강등된 게이트는 release/pass_100 집계 분자(PASS count)에 포함 금지"
      - "강등 라벨: WATCH_PENDING_SAMPLE"
      - "보고서 해당 셀에 '[PASS_INVALID_LOW_N: n={effective_n} < {min}]' 라벨 부착"
    effective_n_fields:
      - sample_count
      - row_count
      - evaluated_count
      - samples
      - n
    output:
      - Temp/vacuous_pass_audit_v1.json
      - operational_report.json.summary.vacuous_pass_gate_count
    python_tool: tools/build_vacuous_pass_audit_v1.py
    gs_coverage: "gas_apex_runtime_core.gs:guardNonVacuousPass_()"
    validator: "tools/validate_harness_governance_contract.py --check non_vacuous_pass"

operations:
  release_policy:
    - "failed_checks 비어있지 않으면 배포/실행 차단"
    - "gap_alert=true 이면 배포/실행 차단"
    - "vacuous_pass_gate_count > 0 이면 배포/실행 차단 (NON_VACUOUS_PASS_GUARD_V1)"
