File size: 2,472 Bytes
fbc9e3f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import argparse
import json
from pathlib import Path

def latest(pattern):
    files = sorted(Path(".").glob(pattern), key=lambda p: p.stat().st_mtime, reverse=True)
    return files[0] if files else None

def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("--latest", action="store_true")
    args = ap.parse_args()

    failed_json = latest("reports/failed_items_*.json")
    repair_jsonl = latest("data/repair_dataset_from_failed_items_*.jsonl")
    bench_json = latest("reports/bench_14b_champion*.json")

    print("==== DECISION SUMMARY ====")

    if bench_json:
        obj = json.loads(bench_json.read_text(encoding="utf-8"))
        print("LATEST_BENCH:", bench_json)
        print("SUMMARY:", json.dumps(obj.get("summary", {}), ensure_ascii=False))
    else:
        print("LATEST_BENCH: not found")

    print()

    if failed_json:
        obj = json.loads(failed_json.read_text(encoding="utf-8"))
        n = obj.get("num_failed_or_issued", 0)
        print("FAILED_JSON:", failed_json)
        print("FAILED_COUNT:", n)
        print("CATEGORY_COUNTS:", json.dumps(obj.get("category_counts", {}), ensure_ascii=False))
        print("ISSUE_COUNTS:", json.dumps(obj.get("issue_counts", {}), ensure_ascii=False))
        print()

        issue_counts = obj.get("issue_counts", {})
        if n == 0:
            print("RECOMMENDATION: ์‹คํŒจ ํ•ญ๋ชฉ์ด ์—†์œผ๋ฏ€๋กœ ์žฌํ•™์Šตํ•˜์ง€ ๋ง๊ณ  ํ˜„์žฌ ๋ชจ๋ธ์„ ์œ ์ง€ํ•˜์…”๋„ ๋ฉ๋‹ˆ๋‹ค.")
        elif any("possible_chinese_leakage" in k for k in issue_counts):
            print("RECOMMENDATION: ์ค‘๊ตญ์–ด leakage๊ฐ€ ์žˆ์œผ๋ฏ€๋กœ safety repair๋ฅผ ์šฐ์„ ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.")
        elif set(obj.get("category_counts", {}).keys()).issubset({"systemd", "jsonl", "cuda"}):
            print("RECOMMENDATION: ์ „์ฒด ์žฌํ•™์Šต๋ณด๋‹ค systemd/jsonl/cuda low-item repair๋งŒ ๊ณ ๋ คํ•˜์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค.")
        else:
            print("RECOMMENDATION: ์‹คํŒจ ๋ฒ”์œ„๊ฐ€ ๋„“์Šต๋‹ˆ๋‹ค. ์‹คํŒจ ํ•ญ๋ชฉ ๋‚ด์šฉ์„ ๋จผ์ € ๊ฒ€ํ† ํ•œ ๋’ค repair ๋ฒ”์œ„๋ฅผ ์ •ํ•˜์‹œ๋Š” ๊ฒŒ ์ข‹์Šต๋‹ˆ๋‹ค.")
    else:
        print("FAILED_JSON: not found")
        print("RECOMMENDATION: ๋จผ์ € 02_extract_failed_items.py๋ฅผ ์‹คํ–‰ํ•ด ์ฃผ์„ธ์š”.")

    print()

    if repair_jsonl:
        rows = sum(1 for _ in repair_jsonl.open("r", encoding="utf-8"))
        print("REPAIR_DATASET:", repair_jsonl)
        print("REPAIR_ROWS:", rows)
    else:
        print("REPAIR_DATASET: not created yet")

if __name__ == "__main__":
    main()