Skip to content

Decide whether call/exec edges should feed the dependency graph (pagerank, popularity, blast radius) #3237

Closed

Description

@squid-protocol

#3200 added edge_data rows with edge_kind 'call' and 'exec' — the mainframe call graph (COBOL CALL, CICS LINK/XCTL, JCL EXEC PGM=). It deliberately left them out of the dependency DiGraph, so pagerank_score, popularity, internal_dependency_links, betweenness, closeness, the archetypes and every risk score are byte-for-byte unchanged by it.

That was the conservative choice, taken so the feature could ship with a zero-diff golden master and one reviewable question deferred rather than bundled. This issue is that question.

The case for folding them in

A mainframe repository's dependency graph is currently built from COPY/INCLUDE edges alone, which are compile-time relations. The runtime topology — which program calls which, which job runs which program — is invisible to every graph metric. On cics-banking-sample-application-cbsa that is 144 call sites across 31 programs, including a genuine hub: ABNDPROC is LINKed from 124 sites in 23 different programs and has a popularity of 0. "Blast radius" is exactly the question a caller graph answers, and for this language family the engine currently answers it from the wrong edge set.

The case against

  • A CALL is not a build dependency. Deleting a COPY target breaks compilation; deleting a CALL target does not, and the existing metrics are documented in those terms.
  • CICS LINK is frequently an error path (ABNDPROC is the abend handler). Counting it as coupling would rank the abend handler as the most architecturally central program in CBSA, which is defensible as "most depended-on" and misleading as "highest blast radius".
  • It moves published numbers for every mainframe repo, so it needs a golden-master bless and a before/after on real corpora.

What a fix needs to decide

  1. All kinds, or only some? (exec — a job running a program — is a much stronger claim of coupling than an error-path LINK.)
  2. Same weight as an import edge, or a lower one?
  3. Does internal_dependency_links / popularity change meaning, or does a new pair of columns carry the call degrees? A new column is the non-breaking option and keeps Persist the dependency graph edge list (enables neighborhood/interaction-level risk hypotheses) #2992's reconciliation invariant intact.

What already exists to measure it with

  • edge_data already carries the rows, so the graph input can be switched without any new extraction.
  • call_site_data.verb and .form let a fix scope itself per verb.
  • tests/tools/mainframe_corpus.py score and the refraction snapshot give a before/after on three pinned corpora.

Related: #2992 (edge_data), #3200 (the extraction), gitgalaxy/core/invocation_resolver.py's header comment records the deferral.

Activity

  1. added
    enhancement
    core-engine
    legacy-modernization
    question
    on Sep 20, 2026
  2. squid-protocol commented on Sep 26, 2026

    @squid-protocol
    OwnerAuthor

    Proposal (approved by @squid-protocol, 2026-09-26): fold resolved mainframe call edges into the dependency graph

    What changed since this issue was opened

    #3333 now puts confident function-to-function calls into the file graph as fcall edges, at CALL_EDGE_WEIGHT = 1.0, in every language. So Java, Python, C and the others already count calls toward PageRank, popularity, blast radius and internal_dependency_links.

    The #3200 edge_data rows of kind call/exec are now the only call edges still kept out. invocation_resolver.py's header records that deferral.

    On engine main today, cobol/cics-banking-sample-application-cbsa/ABNDPROC.cbl, which 23 programs LINK to, still has:

    • Popularity Rank 0;
    • Direct Downstream 0;
    • Total Downstream 0.

    A Java utility called from 23 classes would already rank near the top. The conservative choice has become the one inconsistent language family.

    The three decisions

    1. Kinds: resolved static CALL, LINK, XCTL and EXEC PGM=.
      • A dynamic CALL WS-NAME whose target is unresolved stays out. That matches #3265 step 6: call-derived file edges in the dependency graph (blast radius, PageRank) #3333, which takes only confident links.
      • The error-path concern is real: ABNDPROC would become CBSA's most depended-on program. But that is what it is. If it breaks, error handling breaks in 23 programs, and other languages already count calls into their error utilities the same way.
      • Excluding error paths needs control-flow knowledge the engine has in no language. Doing it for mainframe only would be a special case. If the before/after shows it distorts real results, that can be a scoped follow-up keyed on call_site_data.verb/.form.
    2. Weight 1.0, the same as fcall. Same rule as #3265 step 6: call-derived file edges in the dependency graph (blast radius, PageRank) #3333: an edge is added only where no import edge already joins the pair, so a pair is never counted twice.
    3. The existing columns, no new ones. New call-degree columns were the non-breaking option before #3265 step 6: call-derived file edges in the dependency graph (blast radius, PageRank) #3333. Since #3265 step 6: call-derived file edges in the dependency graph (blast radius, PageRank) #3333, popularity, blast radius and internal_dependency_links already include calls for every other language. A mainframe-only column pair would now be the exception. Folding in also restores Persist the dependency graph edge list (enables neighborhood/interaction-level risk hypotheses) #2992's invariant (edge_data rows by src == internal_dependency_links) without a call/exec carve-out.

    What the implementing PR must carry

    • Before/after on the three pinned corpora (tests/tools/mainframe_corpus.py score and the refraction snapshot). ABNDPROC's numbers are the headline, together with the most-moved programs per corpus.
    • Golden-master bless, both modes, with a scoped diff. Every non-coordinate mover should be a COBOL/JCL/CICS file or an aggregate of them.
    • ground_truth_ledger.py check. Update and assign any cause that moves. Log any defect found on an estate in field_testing.json, per CLAUDE.md.
    • rosetta_audit.py. If the COBOL/JCL manifests move, add rosetta:rebless-owed and open a companion keyword-rosetta PR against engine main.
    • Update the invocation_resolver.py header comment and tests/tools_recorders/test_edge_data.py's scoping. Both currently record the deferral.

    Coordination

    Another session is working on CICS right now, so I'm not implementing this from here, to avoid colliding in invocation_resolver.py, the mainframe goldens and the ledger. Whichever session owns the CICS work can pick this up, or say here when it's clear and I'll take it.


    Generated by Claude Code

  3. squid-protocol commented on Sep 26, 2026

    @squid-protocol
    OwnerAuthor

    Taking this now: the CICS work is done (#3489/#3445 closed), and no open PR touches invocation_resolver.py, the goldens or the ledger. I'll implement the approved proposal above and bring the before/after with the PR.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    core-engineenhancementlegacy-modernizationquestion

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions