Skip to content

Refraction tools: three regexes with quadratic scaling (baselined by the #3214 sweep) #3222

Closed

Description

@squid-protocol

Part of #3122. Found by the #3214 sweep (tests/tools/tool_regex_redos.py), which records these in tests/cobol_mainframe/tool_regex_redos_baseline.json so that CI fails only on new offenders.

# site pattern input it runs over measured (local, 2026-09-19)
1 cobol_dag_architect.py ~L96 re.finditer \bOPEN\s+((?:INPUT|OUTPUT|I-O|EXTEND)\b[^.]*)\. whole program 0.76s on 40k chars of OPEN INPUT with no period
2 cobol_graveyard_finder.py ~L308 re.findall (re.I) (?:==)?([A-Z0-9_\-]+)(?:==)?\s+BY\s+… one COPY statement's REPLACING clause (short in practice) 0.63s on 4k chars of A
3 cobol_jcl_forge.py ~L55 (re.I) SELECT\s+([A-Z0-9\-]+)\s+ASSIGN\s+(?:TO\s+)?([A-Z0-9\-]+)[^.]*\. whole program 1.0s at 160k chars of SELECT X ASSIGN X , ~16x for 4x the input

Patterns 1 and 3 have the shape #3205 fixed for EXEC CICS … END-EXEC.: an unbounded run up to a required terminator is rescanned from every start. Pattern 2 is an unbounded name before a required BY.

Direction. Bound each run the way #3205 did, then drop its baseline entry.

Proof.

  • python tests/tools/tool_regex_redos.py --ci reports each entry as "no longer reproduces".
  • python tests/tools/refraction_snapshot.py check, plus --corpus … locally, shows the generated output unchanged, or the PR explains the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginelegacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingsecuritySecurity-relevant dependency updates and patches

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions