Skip to content

det translator: a COPY that finds only a program source splices that whole program into the includer (silent wrong records) #4460

Closed

Description

@squid-protocol

Problem

When no copybook answers a COPY, det.source.expand falls back to a program source of that name (PROGRAM_EXTS) and splices the whole program, IDENTIFICATION and DATA DIVISIONs included, into the including program. The including program then gets another program's records (and loses its own, after the spliced divisions), silently for the DATA DIVISION; the PROCEDURE DIVISION is refused later only by luck of the parse.

Evidence (origin/main e3ace8a, #4273 cross-check on estate-crucible v0.4.0)

  • apps/SHIP/cobol/SHPINQ.cbl:14 COPY SHPRATE. → apps/SHIP/cobol/SHPRATE.cbl (a program). The translator's records: WS-RATE-PARM 0 bytes, then a DFHCOMMAREA taken from SHPRATE.cbl (60 bytes of CA-* fields), while SHPINQ's own 01 WS-RESP and 01 DFHCOMMAREA PIC X(60) (lines 16, 18) are gone. Same in SHPINQO.cbl.
  • apps/ORDR/cobol/ORDMAIN.cbl:29 COPY ORDPRICE. → apps/ORDR/cobol/ORDPRICE.cbl: a LK-ORDER record that ORDMAIN does not declare.
  • The estate's key: WS-PRICE-PARM / WS-RATE-PARM have no layout (the member is not a copybook); the engine says so (bytes unknown).

Impact on a real estate

Wrong storage in a translation, with no refusal. The fallback exists for estates that keep copy members as .cbl (the comment in expand), so the fix is to refuse a member that is a program (it has an IDENTIFICATION / PROGRAM-ID), not to drop the fallback.

Acceptance criteria

  • A COPY that resolves only to a program source (a member with IDENTIFICATION DIVISION / PROGRAM-ID) raises CopyNotFound (or a named refusal).
  • A test, and the cross-check ledger cause translator-copy-program-member loses its entries.

Found during: #4273 engine-vs-translator fact cross-check (PR #4456)

🤖 Generated with Claude Code

Activity

  1. added
    bug
    data-integrity
    legacy-modernization
    priority: high
    on Oct 5, 2026
  2. added
    scope:sweep
    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

    bugdata-integritylegacy-modernizationpriority: highscope:sweep

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions