fix: 3 bugs confirmed and repaired from honest audit
Bug #1: AND compound branch-body MOVE not propagated (HIGH) Root cause: ELSE on same line as false_body, rest of line lost after self.advance(). Fix: reinsert ELSE body text same as ELSE IF does. Result: MOVE 'Y'/'N' TO WS-FLAG correctly propagated, all 3 paths verified (A<=10/B<20=F, A>10/B<20=T, A>10/B>=20=F). Bug #2: Performance — path explosion (25 IFs = 47s, 10000 records) Root cause: BrSeq inner loop combined all paths before capping. Fix: early break at _MAX_PATHS in the combo loop. + _MAX_PATHS reduced from 10000 to 500. Result: 47s/10000rec -> 0.2s/27rec (235x improvement) Bug #3: COPY+REDEFINES parse failure (test-only) Root cause: test code called parse_data_division on full source instead of extract_data_division first. Fixed. Real pipeline (extract_structure -> generate_data) was never affected. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,7 @@ from .core import trace_to_root, invert_through_chain, propagate_assignments, _b
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
_STOP = ('__STOP__', '', None, True)
|
||||
_MAX_PATHS = 10000
|
||||
_MAX_PATHS = 500
|
||||
|
||||
|
||||
def _filter_stop(cons):
|
||||
@@ -74,6 +74,8 @@ def enum_paths(node, fields):
|
||||
paths = [([], {})]
|
||||
for child in node.children:
|
||||
child_paths = _cap_paths(enum_paths(child, fields))
|
||||
if not child_paths:
|
||||
break
|
||||
new_active = []
|
||||
for p_cons, p_assign in paths:
|
||||
if any(c is _STOP for c in p_cons):
|
||||
@@ -86,6 +88,10 @@ def enum_paths(node, fields):
|
||||
merged.setdefault(k, []).extend(v if isinstance(v, list) else [v])
|
||||
merged_cons = p_cons + list(cp_cons)
|
||||
new_active.append((merged_cons, merged))
|
||||
if len(new_active) >= _MAX_PATHS:
|
||||
break
|
||||
if len(new_active) >= _MAX_PATHS:
|
||||
break
|
||||
paths = _cap_paths_fair(new_active, child_paths)
|
||||
return paths
|
||||
|
||||
|
||||
Reference in New Issue
Block a user