Repository navigation
COBOL engine: COPY library resolution (--copy-libraries: SYSLIB order, IN/OF library, collisions) -- part of #4265 - #4405
Merged
Conversation
…collisions) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
…ource-read gate The declaration is the scan's own configuration (like --config), not a file of the estate. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
squid-protocol
marked this pull request as ready for review
October 5, 2026 04:04
squid-protocol
added a commit
that referenced
this pull request
Oct 5, 2026
Conflicts in 5 files resolved to this branch's side: after #4405 was squash-merged, main's copies of those files are byte-identical to the libraries commit this branch is built on, so every hunk is only this branch's REPLACING additions. #4406 (data_moves.py) merged cleanly. Co-Authored-By: Claude Opus 5.5 <[email protected]>
squid-protocol
added a commit
that referenced
this pull request
Oct 5, 2026
…eplacing) -- fixes #4265, stacked on #4405 (#4407) * WIP #4265: COPY library resolution (--copy-libraries, IN/OF library, collisions) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo * WIP #4265: COPY ... REPLACING in record_layout (record_data.copy_replacing, template copybooks) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo * #4265: REPLACING single-pass, kept parallel through section-level COPYs; docs + negative tests record_layout applies a COPY's REPLACING operands in one left-to-right pass (first matching pair wins, replaced text is not re-matched); the section-level pass keeps copy_replacing parallel to the copy_members it keeps and reads a template copybook's own levels. record_data.copy_libraries / copy_replacing documented in recorders/README.md; data_moves notes what is still unresolved. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo * #4265: allowlist the --copy-libraries declaration read in the #3813 source-read gate The declaration is the scan's own configuration (like --config), not a file of the estate. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo * #4265: a program is never a REPLACING template; bless goldens A COBOL program whose entries carry a pseudo-text tag (cobol-check REPLAC.CBL, awaiting its own REPLACE statement) keeps its data_items; only a copybook is a template. Goldens: record_layout gains the tagged entries of CUSTCOPY.cpy, REPLAC.CBL and DIAGNOS.CPY (32 rows) and DIAGNOS's 01 A no longer takes its child's PIC; the LLM brief's coverage counts follow (+1 file, +32 record items). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
This was referenced Oct 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #4265 (estate-crucible horror H-0034). Owner-approved design 1 of 2; the REPLACING half stacks on this branch in its own PR.
What was broken
Member lookup for
COPY xwas by bare name / file stem, with no notion of copy libraries. On estate-crucible,COPY DATEWSin the ACCT and CUST programs resolved to PAYR'sDATEWS.cpy, which belongs to another application's library, and not to the shared copylib in their SYSLIB.COPY DATEWS IN SHRCPYin PAYMAIN resolved to PAYR's copy too, because the library-name was ignored. That made the layout 18 bytes instead of 16, and 6 further layout checks that useWS-SHARED-DATEfailed with it. Same-named members in different libraries were never reported. The first match won silently.Fix
A new scan option,
galaxyscope --copy-libraries FILE(JSON, or YAML with PyYAML;gitgalaxy/core/copy_libraries.py), declares the library concatenation:{"libraries": {"PAYRCPY": ["apps/PAYR/copybook"], "SHRCPY": ["shared/copylib"]}, "syslib": [{"programs": "apps/PAYR/*", "order": ["PAYRCPY", "PAYRDCL", "SHRCPY"]}, {"programs": "*", "order": ["SHRCPY"]}]}librariesmaps a library-name to the scan-relative directories that hold its members.syslibgives the search order per program glob, and the first matching entry wins.COPY Xresolves to the first library in the program's order that holds X (SYSLIB semantics).COPY X IN|OF LIBsearches LIB only. A named library that lacks the member gets no edge, as the compiler would fail too.copy_member_collisionsin the scan summary (importer, member, chosen library and path, shadowed libraries and paths). The first library still wins, as on z/OS.scope_check --expect cobolreports 0 differences against origin/main.file_data.import_libraries: member -> the library-names its COPY statements name.edge_data.copy_libraries: the COPY forms an import edge carries.record_data.copy_libraries: per entry, parallel tocopy_members._copybook_file/_copy_roots) expandsCOPY XandCOPY X IN LIBfrom the member each one actually resolved to.tests/tools/estate_crucible.pywrites the estate's declaration from its manifest (<APP>CPYcopybook/,<APP>DCLdclgen/,SHRCPYshared/copylib; a program's SYSLIB is its app's libraries, then SHRCPY) and passes--copy-libraries, the same way it passes--source-encoding.Before -> after
tests/cobol_mainframe/test_copy_libraries_4265.py(7 tests) covers:IN libraryeach picking their own member;Golden masters (vs
575bba16a63e)full-precision (
tests/golden_master_audit): unchanged.zero-dependency (
tests/golden_master_zero_dep_audit): unchanged.Ground-truth ledger
Ground-truth ledger: no change.
Estate-crucible horrors
Estate-crucible (
575bba16a63e->ea8512c9df3a): horrors passing 45/49 -> 46/49; checks pass 916->922, fail 10->4, phantom 5->3.Part of #4265
🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo