Skip to content

COBOL: a CALL inside EXEC ... END-EXEC is not a COBOL CALL (#4304) - #4374

Merged
squid-protocol merged 3 commits into
mainfrom
fix/4304-exec-sql-call
Oct 4, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/4304-exec-sql-call

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Fixes #4304

What was broken

mainframe_boundary._CALL_LITERAL / _CALL_IDENTIFIER and the cobol calls_out rule scanned the whole code stream, EXEC blocks included. A DB2 stored-procedure call therefore became a COBOL program call:

  • EXEC SQL CALL MYSCHEMA.GETCUST (:WS-A) END-EXEC gave call_site_data CALL / identifier / MYSCHEMA and calls_out_to MYSCHEMA. The procedure name was lost; only the schema was kept.
  • EXEC SQL CALL UPDPROC END-EXEC gave CALL / identifier / UPDPROC.

sql_statement_data already recorded both, correctly, as verb CALL.

The fix

A CALL inside any EXEC <x> ... END-EXEC block (SQL, CICS, DLI, ...) belongs to that block:

  • mainframe_boundary._cobol_calls skips a CALL match inside an _EXEC_BLOCK span. EXEC CICS LINK/XCTL are read by their own pass and are unaffected.
  • The detector's calls_out scan blanks the spans matched by a new per-language rule key, _calls_out_masked_blocks (cobol only), before findall. Line breaks are kept.

A block never runs across another EXEC. So an EXEC with no END-EXEC before the next EXEC is not masked (the old reading), and a lost END-EXEC never hides the CALLs after it. This case is pinned by a test.

The optional acceptance item, carrying the procedure name on sql_statement_data, is not done here.

Evidence

tests/extraction/languages/test_cobol_exec_sql_call_4304.py (both tests fail on main). On the REPRO7 shape plus controls:

  • the boundary gives no SQL CALL sites;
  • CALL 'REALSUB', CALL WS-PGM and EXEC CICS LINK PROGRAM('CICSPGM') are kept;
  • an unterminated EXEC SQL CALL NOEND is left as before;
  • calls_out_to is REALSUB, WS-PGM, WORK-PARA.

A real scan (galaxyscope --db-only) of REPRO7 gives call_site_data 0 rows, sql_statement_data CALL ×2, and calls_out_to [].

Estate-crucible v0.3.0 (main → this branch)

edges       71 pass / 9 phantom  ->  73 / 7
call_sites  21 pass / 2 phantom  ->  23 / 0
H-0005 #4304 FAIL -> PASS  (CUSTDBIO: phantom CALL PRODPROC @39 / CUSTAUDT @42 and their calls_out_to edges)

Nothing else moves.

Golden masters

crucible_check.py --update --yes against the sibling language-crucible v1.7.0 (merged with main e4ada9d): no drift in either leg. As the issue says, the crucible has no EXEC SQL CALL.

Ground-truth ledger

update: no change. check: clean.

Local checks

tests/cobol_mainframe, tests/extraction and tests/core_engine (pinned corpora): 13,236 passed. mypy_audit / ruff_audit (0.16.0) / dead_key_audit --ci report nothing new. test_national_names passes: the EXEC patterns use \w classes.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo

squid-protocol and others added 3 commits October 4, 2026 19:25
`EXEC SQL CALL MYSCHEMA.GETCUST (:WS-A)` is a DB2 stored-procedure call, which
sql_statement_data already records. Both COBOL CALL readers scanned EXEC blocks
too. mainframe_boundary recorded `CALL / identifier / MYSCHEMA` in
call_site_data, and the calls_out rule put MYSCHEMA / UPDPROC in calls_out_to.
Both now skip a CALL inside any EXEC ... END-EXEC block (SQL, CICS, DLI, ...).
A block never runs across another EXEC, so a lost END-EXEC hides nothing after
it. The detector honours a new per-language `_calls_out_masked_blocks`
pattern.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
@github-actions

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review October 4, 2026 23:43
@squid-protocol
squid-protocol merged commit 52a5d82 into main Oct 4, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the fix/4304-exec-sql-call branch October 4, 2026 23:43
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.

COBOL engine: EXEC SQL CALL proc is recorded as a COBOL dynamic CALL (operand = the schema qualifier)

1 participant