init: cobol-java migration verification platform v3 (42 tests, JCL module)
This commit is contained in:
@@ -10,6 +10,7 @@ from runners.cobol_runner import CobolRunner
|
||||
from runners.data_writer import DataWriter
|
||||
from agents.agent1_parser import Agent1Parser
|
||||
from agents.agent2_data import Agent2Data
|
||||
from agents.agent3_diagnostic import Agent3Diagnostic
|
||||
from agents.llm import LLMClient
|
||||
from comparator.aligner import align_records
|
||||
from comparator.field_compare import compare_field
|
||||
@@ -31,6 +32,9 @@ def run_pipeline(cfg: Config, cpath: str, cbl: str, java: str, map_path: str) ->
|
||||
llm = LLMClient(model=cfg.llm_model, timeout=cfg.llm_timeout, cache_dir=cfg.llm_cache_dir)
|
||||
tree = Agent1Parser(llm).parse(text)
|
||||
vr.llm_cost += 0.002
|
||||
vr.debug["field_tree"] = [{"name":f.name,"level":f.level,"pic":f.pic,"usage":f.usage,
|
||||
"offset":f.offset,"length":f.length,"redefines":f.redefines}
|
||||
for f in tree.flatten().values()]
|
||||
if not tree.fields:
|
||||
return _done(vr, t0, "BLOCKED", 2)
|
||||
if vr.llm_cost > cfg.max_llm_cost:
|
||||
@@ -38,6 +42,8 @@ def run_pipeline(cfg: Config, cpath: str, cbl: str, java: str, map_path: str) ->
|
||||
|
||||
suite = Agent2Data(llm).design(tree, cfg.coverage_default, cfg.runner_mode == "spark")
|
||||
vr.llm_cost += 0.002
|
||||
vr.debug["test_cases"] = [{"id":tc.id,"fields":tc.fields,"targets":tc.coverage_targets} for tc in suite.test_cases]
|
||||
vr.debug["spark_config"] = {"records":suite.spark_config.num_records} if suite.has_spark else None
|
||||
|
||||
bundle = TestDataBundle(base_path=Path("test-data-bundle"))
|
||||
bundle.ensure_dirs()
|
||||
@@ -51,6 +57,7 @@ def run_pipeline(cfg: Config, cpath: str, cbl: str, java: str, map_path: str) ->
|
||||
|
||||
cob = CobolRunner()
|
||||
build = cob.compile(cbl, cfg.dialect)
|
||||
vr.debug["cobol_build"] = {"ok": build.success, "log": build.log[-300:]}
|
||||
if not build.success:
|
||||
return _done(vr, t0, "BLOCKED", 2)
|
||||
co = Path("cobol_out.bin")
|
||||
@@ -61,6 +68,7 @@ def run_pipeline(cfg: Config, cpath: str, cbl: str, java: str, map_path: str) ->
|
||||
return _done(vr, t0, "BLOCKED", 2)
|
||||
runner: Runner = SparkJavaRunner(cfg.spark_master) if cfg.runner_mode == "spark" else NativeJavaRunner()
|
||||
jb = runner.compile(java)
|
||||
vr.debug["java_build"] = {"ok": jb.success, "log": jb.log[-300:]}
|
||||
if not jb.success:
|
||||
return _done(vr, t0, "BLOCKED", 2)
|
||||
inp = str(bundle.spark_input_dir() if cfg.runner_mode == "spark" else bundle.native_input())
|
||||
@@ -95,6 +103,14 @@ def run_pipeline(cfg: Config, cpath: str, cbl: str, java: str, map_path: str) ->
|
||||
vr.status = "PASS" if m == 0 else "MISMATCH"
|
||||
vr.exit_code = 0 if m == 0 else 1
|
||||
|
||||
diag = Agent3Diagnostic(llm)
|
||||
for fr in frs:
|
||||
if fr.status in ("MISMATCH", "NOT_SET", "NPE"):
|
||||
try:
|
||||
fr.suggestion = diag.analyze(fr) or ""
|
||||
except:
|
||||
pass
|
||||
|
||||
rd = Path(f"reports/{vr.program}") / vr.timestamp
|
||||
rd.mkdir(parents=True, exist_ok=True)
|
||||
g = ReportGenerator()
|
||||
|
||||
Reference in New Issue
Block a user