feat: WBS-1.5 공식 라이프사이클 레지스트리 269개 공식 마이그레이션 및 대조 검증
This commit is contained in:
+2105
-265
File diff suppressed because it is too large
Load Diff
@@ -20,33 +20,64 @@ def _status_value(row: dict[str, Any]) -> str:
|
|||||||
def main() -> int:
|
def main() -> int:
|
||||||
ap = argparse.ArgumentParser()
|
ap = argparse.ArgumentParser()
|
||||||
ap.add_argument("--registry", default="spec/13_formula_registry.yaml")
|
ap.add_argument("--registry", default="spec/13_formula_registry.yaml")
|
||||||
|
ap.add_argument("--lifecycle", default="spec/51_formula_lifecycle_registry.yaml")
|
||||||
args = ap.parse_args()
|
args = ap.parse_args()
|
||||||
|
|
||||||
|
# 1. Read spec/13_formula_registry.yaml
|
||||||
path = ROOT / args.registry
|
path = ROOT / args.registry
|
||||||
data = yaml.safe_load(path.read_text(encoding="utf-8"))
|
data = yaml.safe_load(path.read_text(encoding="utf-8"))
|
||||||
formulas = ((data or {}).get("formula_registry") or {}).get("formulas") or {}
|
formulas = ((data or {}).get("formula_registry") or {}).get("formulas") or {}
|
||||||
|
|
||||||
families: dict[str, list[str]] = defaultdict(list)
|
families: dict[str, list[str]] = defaultdict(list)
|
||||||
for fid, row in formulas.items():
|
for fid in formulas.keys():
|
||||||
family = fid.rsplit("_V", 1)[0]
|
family = fid.rsplit("_V", 1)[0]
|
||||||
families[family].append(fid)
|
families[family].append(fid)
|
||||||
active_count = sum(
|
|
||||||
1
|
# 2. Read spec/51_formula_lifecycle_registry.yaml
|
||||||
for fid, row in formulas.items()
|
lifecycle_path = ROOT / args.lifecycle
|
||||||
if _status_value(row) == "active"
|
if not lifecycle_path.exists():
|
||||||
)
|
print(f"Lifecycle registry not found: {lifecycle_path}")
|
||||||
inferred_count = sum(1 for row in formulas.values() if not str((row or {}).get("status") or "").strip())
|
return 1
|
||||||
|
lifecycle_data = yaml.safe_load(lifecycle_path.read_text(encoding="utf-8"))
|
||||||
|
lifecycle_formulas = lifecycle_data.get("formulas", [])
|
||||||
|
|
||||||
|
lifecycle_map = {f.get("formula_id"): f.get("lifecycle_state") for f in lifecycle_formulas if f.get("formula_id")}
|
||||||
|
|
||||||
|
# 3. Validation logic
|
||||||
|
missing_ids = []
|
||||||
|
invalid_state_ids = []
|
||||||
|
valid_states = {"ACTIVE", "DEPRECATED", "DATA_GATED", "PENDING"}
|
||||||
|
|
||||||
|
for fid in formulas.keys():
|
||||||
|
state = lifecycle_map.get(fid)
|
||||||
|
if not state:
|
||||||
|
missing_ids.append(fid)
|
||||||
|
elif state not in valid_states:
|
||||||
|
invalid_state_ids.append((fid, state))
|
||||||
|
|
||||||
|
missing_status_count = len(missing_ids) + len(invalid_state_ids)
|
||||||
|
gate = "PASS" if missing_status_count == 0 else "FAIL"
|
||||||
|
|
||||||
|
if missing_ids:
|
||||||
|
print(f"Missing formula registrations in 51_formula_lifecycle_registry.yaml: {missing_ids}")
|
||||||
|
if invalid_state_ids:
|
||||||
|
print(f"Invalid lifecycle states detected: {invalid_state_ids}")
|
||||||
|
|
||||||
result = {
|
result = {
|
||||||
"formula_id": "FORMULA_VERSION_LIFECYCLE_V1",
|
"formula_id": "FORMULA_VERSION_LIFECYCLE_V1",
|
||||||
"formula_count": len(formulas),
|
"formula_count": len(formulas),
|
||||||
"missing_status_count": 0,
|
"missing_status_count": missing_status_count,
|
||||||
"inferred_active_count": inferred_count,
|
"inferred_active_count": 0,
|
||||||
"family_count": len(families),
|
"family_count": len(families),
|
||||||
"active_count": active_count,
|
"active_count": sum(1 for state in lifecycle_map.values() if state == "ACTIVE"),
|
||||||
"gate": "PASS",
|
"gate": gate,
|
||||||
}
|
}
|
||||||
|
|
||||||
out = ROOT / "Temp" / "formula_version_lifecycle_v1.json"
|
out = ROOT / "Temp" / "formula_version_lifecycle_v1.json"
|
||||||
out.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8")
|
out.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8")
|
||||||
print(json.dumps(result, ensure_ascii=False, indent=2))
|
print(json.dumps(result, ensure_ascii=False, indent=2))
|
||||||
return 0
|
|
||||||
|
return 0 if gate == "PASS" else 1
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@@ -665,6 +665,7 @@ def main() -> int:
|
|||||||
"03_risk_policy.yaml", "04_strategy_rules.yaml",
|
"03_risk_policy.yaml", "04_strategy_rules.yaml",
|
||||||
"13_formula_registry.yaml", "13b_harness_formulas.yaml",
|
"13_formula_registry.yaml", "13b_harness_formulas.yaml",
|
||||||
"12_field_dictionary.yaml",
|
"12_field_dictionary.yaml",
|
||||||
|
"51_formula_lifecycle_registry.yaml", # 290+ formula lifecycle registry (Proposal51-P1)
|
||||||
"formula_golden_cases_v2.yaml", # BCH-V1 골든케이스 — 공식 수 증가로 50KB 초과 허용
|
"formula_golden_cases_v2.yaml", # BCH-V1 골든케이스 — 공식 수 증가로 50KB 초과 허용
|
||||||
"formula_golden_cases_nf.yaml", # NF1~NF5 Python-harness 보조 공식 명세 golden cases
|
"formula_golden_cases_nf.yaml", # NF1~NF5 Python-harness 보조 공식 명세 golden cases
|
||||||
"calibration_registry.yaml", # CALIB-V1 임계값 레지스트리
|
"calibration_registry.yaml", # CALIB-V1 임계값 레지스트리
|
||||||
|
|||||||
Reference in New Issue
Block a user