Skip to content

COBOL engine: a COPY that does not start its line (01 WS-REC. COPY CUSTREC.) draws no import edge #4303

Closed

Description

@squid-protocol

Problem

The COBOL import and _dependency_capture rules (cobol.py:639-652) anchor COPY at line start (^ + sequence area + whitespace). A COPY after another clause on the same line is not seen:

  • 01 WS-REC. COPY CUSTREC.
  • 05 X. COPY Y.
  • several COPYs on one line

file_data.raw_imports stays empty and no edge_data import edge is drawn. The record reader does see the member (record_data.copy_members = CPYB), so the two channels disagree about the same file.

Evidence

  • Crucible: che-che4z_lsp_project_fixtures/TEST.CBL:18 01 PARENT. COPY A. COPY B. COPY C. gives raw_imports []. outline.cbl:18 01 PARENT. COPY AST. gives [].
  • Minimal repro REPRO6.cbl (below), main 737cab8 and Fix #4264: fixed / free COBOL reference format, per file and per directive #4290 head: 01 WS-REC. COPY CPYB. and 01 WS-OTHER. COPY CPYC. COPY CPYD. give raw_imports [] and 0 import edges, while record_data has copy_members CPYB and CPYC,CPYD.

Impact

The copybook dependency graph misses members, and so does popularity. An unreferenced data-only copybook (popularity 0, zero signals, >50 LOC) is then relegated by the Zero-Density threshold (statistical_auditor.py:477-484), and its layout leaves the DB.

Acceptance criteria

  • COPY / EXEC SQL INCLUDE are recognized at any statement position outside literals and comments, each occurrence counted
  • raw_imports / import edges agree with record_data.copy_members on the repro
  • Valid fixtures: same-line COPY after a level entry, and two COPYs on one line

Found during: crucible mainframe count audit (2026-10-04)

Reproducer

REPRO6.cbl

       IDENTIFICATION DIVISION.
       PROGRAM-ID. REPRO6.
       DATA DIVISION.
       WORKING-STORAGE SECTION.
       01  WS-REC.  COPY CPYB.
       01  WS-OTHER. COPY CPYC. COPY CPYD.
       PROCEDURE DIVISION.
       MAIN-PARA.
           MOVE B-FIELD TO C-FIELD
           STOP RUN.

Found by a grep-vs-engine count audit of every mainframe file in language-crucible v1.7.0 (802 of 815 files compared), on main 737cab8 and the #4290 head (now merged as c136f46).

Activity

  1. added
    bug
    core-engine
    legacy-modernization
    on Oct 4, 2026
  2. added
    scope:sweep
    era:2
    on Oct 16, 2026
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

    bugcore-engineera:2legacy-modernizationpriority: mediumscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions