feat: phase2 review fixes

- TIME injection: change from spaces to '2500' (hour>23) for NUMVAL trigger
- Runner: add .resolve() to work_dir to fix chdir+relative path breakage
- Coverage: per-target field overrides for DP#9-#12 (START-DATE=20240115 etc.)
- .gitignore: add compilation artifacts, temp scripts, test outputs
This commit is contained in:
hangshuo652
2026-07-15 21:46:28 +08:00
parent f3be17e5eb
commit 54d4e81240
13 changed files with 769 additions and 188 deletions
+36 -1
View File
@@ -373,6 +373,11 @@ def _mark_search(dp, cons, fields=None):
if base_c == base_cond:
branch_masks[i] = True
break
# Also check reversed constraints (subject field references table element)
base_c2 = re.sub(r'\s*\(.*?\)\s*$', '', str(c[2]))
if base_c2 == base_cond:
branch_masks[i] = True
break
else:
leaves = list(collect_leaves(cond_tree))
assignment = {}
@@ -458,15 +463,26 @@ def locate_decision_lines(decision_points, raw_source):
for dp in decision_points:
patterns = _build_search_patterns(dp)
start = used_indices.get(dp.label, -1) + 1
found = False
for i in range(start, len(lines)):
line = lines[i]
for pat in patterns:
if re.search(pat, line):
dp.source_line = i + 1
used_indices[dp.label] = i
found = True
break
if dp.source_line:
if found:
break
# Multi-line fallback: compound conditions (AND/OR) may span >1 line
if not found and dp.kind == 'IF':
short_pat = _build_short_if_pattern(dp)
if short_pat:
for i in range(start, len(lines)):
if re.search(short_pat, lines[i]):
dp.source_line = i + 1
used_indices[dp.label] = i
break
def _normalize(text):
@@ -501,6 +517,25 @@ def _build_search_patterns(dp):
return patterns
def _build_short_if_pattern(dp):
"""Build a pattern matching just the first clause of a compound IF condition."""
if dp.kind != 'IF':
return None
cond = dp.label
if not cond:
return None
# Split on AND/OR to get first clause only
parts = re.split(r'\s+(AND|OR)\s+', cond, maxsplit=1, flags=re.IGNORECASE)
first_clause = parts[0].strip()
if first_clause == cond:
return None # Not a compound condition
norm = _normalize(first_clause)
esc = re.escape(norm)
esc = esc.replace(r'\ ', r'\s+')
esc = esc.replace(r'\'', r"['\"]")
return r'\bIF\b\s+' + esc
# ── HTML 报告(详情页)──
_DETAIL_HTML = '''<!DOCTYPE html>