Skip to content

Fix #590: Strict parsing tests for jcl structural signatures - #731

Merged
squid-protocol merged 1 commit into
mainfrom
fix/590-jcl-strict-parsing-v2
Jul 29, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/590-jcl-strict-parsing-v2

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Part of #518, closes #590.

Adds strict positive/negative and ReDoS regression coverage in
tests/core_engine/test_language_standards_strict.py for all 9 non-None jcl structural
signatures. Found and fixed 4 real bugs plus one real gap in jcl's rules dict. Kept narrow per
scope discussion -- no new signature keys added beyond what #590 already checklists (a few of
jcl's None signatures, e.g. planned_debt/fragile_debt/spec_exposure, look like plausible
future additions since they'd just reuse existing shared patterns, but that's out of scope here).

Real bugs found and fixed

  1. structural_boundaries/import required a name segment. Missing the very common unnamed
    continuation-DD/INCLUDE form (// DD DSN=..., concatenating a dataset onto the
    preceding DD with no ddname of its own -- routine JCL, e.g. STEPLIB concatenation). Name is
    now optional.
  2. Six rules used \s+ for a name/label-to-keyword gap (structural_boundaries,
    func_start, class_start, import, state_mutation, ownership). Since \s matches \n
    under re.M, this let a name on one physical line falsely bind to a keyword (or value)
    starting an entirely different line with no // prefix of its own -- confirmed e.g.
    "//STEP01\nEXEC PGM=FOO" incorrectly registers STEP01 as a real EXEC step. Bounded all six
    to [ \t]+.
  3. state_mutation was completely unanchored, matching "SET" anywhere in the scanned text --
    including inline SYSIN card data (//SYSIN DD * ... /*), which is arbitrary payload data,
    not a JCL statement. Anchored to a real //name SET var=value statement line.
  4. _dependency_capture was missing entirely for jcl, unlike nearly every other language in
    the registry with a non-None import -- the dependency graph never captured which member a
    job/proc pulls in via INCLUDE. Added, capturing the MEMBER= name.

All fixes independently verified: old-pattern-reproduces / new-pattern-fixes for each regression.

Verification (all gates)

  • Strict test file: 1452 passed
  • Full default suite: 2393 passed, 1 deselected, 1 xfailed -- no regressions
  • ruff/mypy/dead-key audits clean (3 pre-existing mypy findings confirmed non-deterministic and
    unrelated via repeated git stash reproduction -- same count, different specific
    files/lines each run, even with my diff stashed away)
  • golden_crucible via tests/tools/crucible_check.py: real diff found (120 differences,
    confined to exactly 6 real .jcl-extension files in the cics-genapp mainframe corpus repo --
    confirmed via direct golden_diff.deep_compare(), not just the truncated test-failure message
    -- matching the structural_boundaries/import unnamed-statement fix's intent). Fixtures
    regenerated and re-verified clean in both venvs.

🤖 Generated with Claude Code

Adds strict positive/negative and ReDoS regression coverage in
tests/core_engine/test_language_standards_strict.py for all 9 non-None
jcl structural signatures. Found and fixed 4 real bugs plus one real gap
in jcl's rules dict (kept narrow per issue scope -- no new signature keys
added beyond what #590 already checklists).

Real bugs found and fixed:

1. `structural_boundaries`/`import` required a name segment (`+`) between
   `//` and the statement keyword, missing the very common unnamed
   continuation-DD/INCLUDE form (`//         DD DSN=...`, concatenating a
   dataset onto the preceding DD with no ddname of its own -- routine JCL,
   e.g. STEPLIB concatenation). Name is now optional (`*`).

2. `structural_boundaries`, `func_start`, `class_start`, `import`,
   `state_mutation`, and `ownership` all used `\s+` for the gap between a
   name/label and its keyword/value. Since `\s` matches `\n` under `re.M`,
   this let a name on one physical line falsely bind to a keyword (or, for
   ownership, a value) starting an entirely different line with no `//`
   prefix of its own -- confirmed e.g. "//STEP01\nEXEC PGM=FOO" incorrectly
   registers STEP01 as a real EXEC step. JCL statements never span a
   physical line via bare whitespace. Bounded all six to `[ \t]+`.

3. `state_mutation` was completely unanchored (`\bSET\s+NAME=`), matching
   "SET" anywhere in the scanned text -- including inline SYSIN card data
   (`//SYSIN DD *` ... `/*`), which is arbitrary payload data, not a JCL
   statement. Anchored to a real `//name SET var=value` statement line.

4. `_dependency_capture` was missing entirely for jcl, unlike nearly every
   other language in the registry with a non-None `import` -- the
   dependency graph never captured which member a job/proc pulls in via
   INCLUDE. Added, capturing the MEMBER= name.

All fixes independently verified: old-pattern-reproduces / new-pattern-
fixes for each regression.

Verification: strict test file (1452 passed), full default suite (2393
passed, 1 deselected, 1 xfailed, no regressions), ruff/mypy/dead-key audits
clean (3 pre-existing mypy findings confirmed non-deterministic/unrelated
via repeated git-stash reproduction), golden_crucible verified via
tests/tools/crucible_check.py: real diff found (120 differences, confined
to exactly 6 real .jcl files in the cics-genapp mainframe corpus repo,
matching the structural_boundaries/import fix's intent), fixtures
regenerated and re-verified clean in both venvs.

Part of #518, closes #590.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit f759642 into main Jul 29, 2026
38 of 39 checks passed
@squid-protocol
squid-protocol deleted the fix/590-jcl-strict-parsing-v2 branch July 29, 2026 01:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Strict parsing tests: jcl structural signatures

1 participant