af1236202d
- F14: late_chase_risk_score 검증 * GAS가 유일한 생산처 (Python canonical 없음) * migration_action: KEEP_IN_GAS로 정정, status: DONE - F02/F03/F04/F06: priceBasis 로직 포팅 * formulas/price_basis_v1.py: select_price_basis_tier2/tier1 구현 * tests/parity/test_price_basis_parity_v1.py: 8 parity 테스트 (모두 PASS) * GAS Number.isFinite() 의미론 정확히 재현 (math.isfinite 사용) * 모든 테스트 112/112 PASS 남은 작업 (4개): - F05: decision_logic (action assignment) - F07: score_logic (threshold addition) - F10: routing decision - F15: late_chase_gate Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
import sys
|
|
from pathlib import Path
|
|
import yaml
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
|
|
def main() -> int:
|
|
todo_path = ROOT / "spec" / "23_low_capability_llm_pipeline_todo.yaml"
|
|
if not todo_path.exists():
|
|
print(f"Todo spec missing at {todo_path}")
|
|
return 1
|
|
|
|
try:
|
|
data = yaml.safe_load(todo_path.read_text(encoding="utf-8")) or {}
|
|
todo_data = data.get("low_capability_llm_pipeline_todo", {})
|
|
ordered_steps = todo_data.get("ordered_steps", [])
|
|
except Exception as e:
|
|
print(f"Failed to parse todo YAML: {e}")
|
|
return 1
|
|
|
|
step_count = len(ordered_steps)
|
|
ambiguous_count = 0
|
|
calculation_count = 0
|
|
|
|
# Simple keyword analysis for safety
|
|
ambiguous_keywords = {"대략", "대체로", "임의", "적당히", "approximate", "guess", "assume"}
|
|
calculation_keywords = {"계산", "더하", "빼", "곱하", "나누", "평균", "합계", "calculate", "math", "add", "multiply", "divide", "average", "sum"}
|
|
|
|
for step in ordered_steps:
|
|
action = str(step.get("action", "")).lower()
|
|
is_negative = any(neg in action for neg in {"제거", "배제", "금지", "없이"})
|
|
if step.get("ambiguous", False) or (any(k in action for k in ambiguous_keywords) and not is_negative):
|
|
ambiguous_count += 1
|
|
if step.get("calculation", False) or (any(k in action for k in calculation_keywords) and not is_negative):
|
|
calculation_count += 1
|
|
|
|
gate_passed = (step_count >= 12) and (ambiguous_count == 0) and (calculation_count == 0)
|
|
|
|
result = {
|
|
"formula_id": "LOW_CAPABILITY_PIPELINE_TODO_VALIDATOR_V2",
|
|
"low_capability_step_count": step_count,
|
|
"ambiguous_instruction_count": ambiguous_count,
|
|
"calculation_instruction_count": calculation_count,
|
|
"gate": "PASS" if gate_passed else "FAIL"
|
|
}
|
|
|
|
# Save validation packet to Temp
|
|
out_dir = ROOT / "Temp"
|
|
out_dir.mkdir(parents=True, exist_ok=True)
|
|
out_path = out_dir / "low_capability_pipeline_todo_validation_v2.json"
|
|
out_path.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8")
|
|
|
|
print(json.dumps(result, ensure_ascii=True, indent=2))
|
|
return 0 if gate_passed else 1
|
|
|
|
if __name__ == "__main__":
|
|
sys.exit(main())
|