Skip to content

fix: CALL/LINK/XCTL/EXEC PGM prefer the member named for the program (#4419) - #4426

Merged
squid-protocol merged 2 commits into
mainfrom
fix/4419-call-member-name
Oct 5, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fix/4419-call-member-name

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What was broken

Forks of a program (ORDV#OLD) keep the original PROGRAM-ID. ORDVAL. The invocation resolver indexed by PROGRAM-ID and broke ties by path proximity only, so ORDMAIN's CALL 'ORDVAL' resolved to the dead fork ORDV#OLD.cbl (H-0050), drawing the call edge, fan-in and reachability there.

Fix

invocation_resolver._pick_program, the one tie-break behind CALL, CICS LINK/XCTL, JCL EXEC PGM= (and CSD transaction PROGRAM): when several members declare the PROGRAM-ID, the member whose stem equals the target wins (nearest among them). If none is named for it, today's nearest rule stays and the pick is reported: resolve_invocations(..., ambiguities=...) collects {src_path, target, chosen, candidates}, surfaced as program_id_ambiguities in the scan summary (present only when non-empty). A single declarer is never ambiguous.

Before -> after

tests/cobol_mainframe/test_call_member_name_4419.py (new, 8 tests): fork shape for CALL, LINK, XCTL (fork nearer than the live member, so proximity alone picks the fork), JCL EXEC PGM, CSD transaction; no-matching-member case (nearest kept + ambiguity reported); single declarer; case/extension-insensitive stem match. Real scan of estate-crucible v0.4.0: ORDMAIN CALL ORDVAL -> ORDVAL.cbl, H-0050 FAIL (4 not passing) -> PASS.

Golden masters

Both legs unchanged; scope check: 0 differences vs origin/main (goldens contain no shared-PROGRAM-ID case, summary key absent when empty).

Ground-truth ledger

No change.

Estate-crucible

Horrors passing 58/60 -> 59/60 (H-0050). Checks: pass 1369->1372, fail 13->11, missing 1->0, phantom 4->3. call_sites 46/3 -> 47/2, dead 10/1 -> 11/0, file_edges 23/0/1/1 -> 24/0/0/0. Audits: mypy, ruff, dead_key PASS.

Fixes #4419

🤖 Generated with Claude Code

https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo

@github-actions

github-actions Bot commented Oct 5, 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 5, 2026 10:32
…name

# Conflicts:
#	gitgalaxy/galaxyscope.py
@squid-protocol
squid-protocol merged commit 9983451 into main Oct 5, 2026
32 checks passed
@squid-protocol
squid-protocol deleted the fix/4419-call-member-name branch October 5, 2026 10:46
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 call resolution: CALL 'X' resolves to a forked member that also says PROGRAM-ID X instead of the member named X

1 participant