Repository navigation
Fix #590: Strict parsing tests for jcl structural signatures - #731
Merged
Merged
Conversation
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]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #518, closes #590.
Adds strict positive/negative and ReDoS regression coverage in
tests/core_engine/test_language_standards_strict.pyfor all 9 non-Nonejclstructuralsignatures. Found and fixed 4 real bugs plus one real gap in jcl's
rulesdict. Kept narrow perscope discussion -- no new signature keys added beyond what #590 already checklists (a few of
jcl's
Nonesignatures, e.g.planned_debt/fragile_debt/spec_exposure, look like plausiblefuture additions since they'd just reuse existing shared patterns, but that's out of scope here).
Real bugs found and fixed
structural_boundaries/importrequired a name segment. Missing the very common unnamedcontinuation-DD/INCLUDE form (
// DD DSN=..., concatenating a dataset onto thepreceding DD with no ddname of its own -- routine JCL, e.g. STEPLIB concatenation). Name is
now optional.
\s+for a name/label-to-keyword gap (structural_boundaries,func_start,class_start,import,state_mutation,ownership). Since\smatches\nunder
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 registersSTEP01as a real EXEC step. Bounded all sixto
[ \t]+.state_mutationwas 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=valuestatement line._dependency_capturewas missing entirely for jcl, unlike nearly every other language inthe registry with a non-
Noneimport-- the dependency graph never captured which member ajob/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)
unrelated via repeated
git stashreproduction -- same count, different specificfiles/lines each run, even with my diff stashed away)
golden_crucibleviatests/tools/crucible_check.py: real diff found (120 differences,confined to exactly 6 real
.jcl-extension files in thecics-genappmainframe corpus repo --confirmed via direct
golden_diff.deep_compare(), not just the truncated test-failure message-- matching the
structural_boundaries/importunnamed-statement fix's intent). Fixturesregenerated and re-verified clean in both venvs.
🤖 Generated with Claude Code