feat: config-driven multi-scenario + gcda accumulation fix + gcov merge fix
Config-driven architecture: - coverage_dates: YAML-driven date replacement for LEAVE_RECORDS - row_overrides: per-scenario field overrides (e.g. STATUS='9') - delete_all_rows: per-scenario table emptying for empty-cursor tests gcda accumulation fix (V3 bug #7): - Delete .gcda before each scenario run to prevent GnuCOBOL accumulation - Force-copy scenario gcda (skip mtime check) - Copy scenario DB to CWD data/kin.db for CONNECT TO path resolution Multi-run gcov merge fix: - Always merge multi-run gcov data regardless of generate_coverage flag - Fix v3_root UnboundLocalError in cleanup path Other fixes: - _make_key_unique: skip WHERE-constrained columns to avoid PK conflict - incremental_supplement: support fields_dict for base record generation - check_coverage: use structure coverage data if available - orchestrator.py: filter _-prefixed fields in TestCase; merge Agent2Data cases
This commit is contained in:
@@ -1358,11 +1358,33 @@ def run_coverage(branch_tree, branch_paths_with_assigns, fields,
|
||||
def check_coverage(structure: dict, test_records: list[dict]) -> dict:
|
||||
total_paragraphs = structure.get("total_paragraphs", 0)
|
||||
total_branches = structure.get("total_branches", 0)
|
||||
decision_points = structure.get("decision_points", [])
|
||||
has_data = len(test_records) > 0
|
||||
|
||||
paragraph_rate = 1.0 if (total_paragraphs > 0 and has_data) else 0.0
|
||||
|
||||
cov = structure.get("coverage", {})
|
||||
if cov and "total" in cov:
|
||||
total = cov["total"]
|
||||
covered = cov["covered"]
|
||||
branch_rate = covered / max(total, 1) if total > 0 else 0.0
|
||||
decision_rate = branch_rate
|
||||
|
||||
uncovered = []
|
||||
for dp in cov.get("decision_points", []):
|
||||
if dp["covered"] < dp["branches"]:
|
||||
uncovered.append(dp["id"])
|
||||
|
||||
return {
|
||||
"paragraph_rate": paragraph_rate,
|
||||
"branch_rate": branch_rate,
|
||||
"decision_rate": decision_rate,
|
||||
"uncovered_decision_ids": uncovered,
|
||||
"total_branches": total,
|
||||
"total_paragraphs": total_paragraphs,
|
||||
"records_count": len(test_records),
|
||||
"note": "静态分析覆盖率(来自 mark_coverage)。精确数据通过 gcov 获取。",
|
||||
}
|
||||
|
||||
return {
|
||||
"paragraph_rate": paragraph_rate,
|
||||
"branch_rate": 0.0,
|
||||
|
||||
Reference in New Issue
Block a user