Repository navigation
COBOL engine: COPY ... REPLACING in record_layout (record_data.copy_replacing) -- fixes #4265, stacked on #4405 - #4407
Merged
Merged
Conversation
…collisions) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
…acing, template copybooks) 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
…-replacing Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo # Conflicts: # gitgalaxy/tools/cobol_to_cobol/galaxy_ir.py
…Ys; 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
…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
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]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
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]>
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.
Stacked on #4405 (
feat/4265-copy-libraries). Both PRs addrecord_datacolumns side by side, and this branch readscopy_librariesalongside the new column. Merge #4405 first, and this diff then reduces to the REPLACING change. Until then, the estate numbers below include H-0034 from #4405. Owner-approved design 2 of 2 for #4265 (estate-crucible horror H-0016).What was broken
Take
01 WS-EMP. COPY PAYTPL REPLACING ==:TAG:== BY ==EMP==.over a template copybook (05 :TAG:-ID PIC X(6)....). The engine'srecord_layoutgavebytes: None, with the first fieldWS-EMPat 0 bytes. The key expects EMP-ID / EMP-NAME / EMP-RATE, 40 bytes. There were two causes:05 :TAG:-IDas an entry at all (the level regex needs a plain data-name), so the template had no records;Fix (design: a new
record_datacolumn, notattributes)mainframe_boundary.py)::TAG:-ID), kept as written.REPLACINGphrase is parsed into operand pairs:==pseudo-text==(stored without its==), a word or a literal, and LEADING / TRAILING.record_data.copy_replacing(TEXT, JSON): a list parallel tocopy_members, one element per COPY, eithernullor[[from, to(, LEADING|TRAILING)], ...]. The column is NULL when no COPY on the entry replaces anything, so existing rows keep their shape. It is documented inrecorders/README.mdandcore/README.md. It is written byrecord_keeper, restored bystate_rehydrator, and read bygalaxy_ir.load_galaxy_ir, all guarded with_has_columnfor older DBs.record_datareader was checked. The others either select named columns (test_record_data,estate_crucible,engine_sourcingvia GalaxyIR) or render items (audit_recorder), and none needs the column. No schema-contract test enumerates therecord_datacolumns.galaxy_ir):EngineFile.template_records, and itsdata_items/recordsstay empty, because the tagged entries are not data-names until replaced.record_layoutexpandsCOPY X REPLACING ...from the replaced copy, in one left-to-right pass as the compiler does (the first matching pair wins, and replaced text is not matched again). A:tag:/(tag)operand replaces partial words, LEADING / TRAILING replace word starts or ends, and any other operand replaces whole words only. The replacement covers the name, REDEFINES, OCCURS DEPENDING ON, PIC and VALUE.copy_replacingparallel to the members it keeps.MOVE ... TO EMP-ID) to its copied entry. That operand stays an unresolved operand gap, and the comment incore/data_moves.pysays so.Before -> after
tests/cobol_mainframe/test_copy_replacing_4265.py(7 tests) covers:Every golden change, explained. Only the tagged-entry recognition moves anything, in both legs identically:
record_layout: 32 new rows across three corpus files whose entries carry pseudo-text tags, which were previously not recognised as entries:zopeneditor-sample/CUSTCOPY.cpy(IBM's:TAG:template; it now carries facts for the first time);cobol-check/REPLAC.CBL(301 :PROGRAM:-PARAM-style entries awaiting its REPLACE statement);che4z lsp testing_DIAGNOS.CPY(2 entries). Its01 Aalso no longer takes its child'sPIC x: the05 :baaaaa: pic xline was invisible before, so its PIC was attributed toA.llm_brief: coverage counts follow, 755 -> 756 files and 33039 -> 33071 record items (+32).data flows(+5 unresolved operands): the template rule cleared REPLAC.CBL's data_items. That bless is not committed. A program is now never a template, so data flows are unchanged.scope_check --expect cobolreports 3 cobol differences, plus 1 unattributed: the LLM brief's repo-wide coverage line above.Golden masters (vs
575bba16a63e)full-precision (
tests/golden_master_audit): 2 fixture file(s), 2 channel(s), 3 scanned file(s) moved (cobol 3).cobol/che-che4z_lsp_project_fixtures/testing_DIAGNOS.CPY,cobol/cobol-check/src_main_cobol_REPLAC.CBL,cobol/zopeneditor-sample/CUSTCOPY.cpyMost-moved scanned files (channels):
cobol/cobol-check/src_main_cobol_REPLAC.CBL(1),cobol/che-che4z_lsp_project_fixtures/testing_DIAGNOS.CPY(1),cobol/zopeneditor-sample/CUSTCOPY.cpy(1)zero-dependency (
tests/golden_master_zero_dep_audit): 2 fixture file(s), 2 channel(s), 3 scanned file(s) moved (cobol 3).cobol/che-che4z_lsp_project_fixtures/testing_DIAGNOS.CPY,cobol/cobol-check/src_main_cobol_REPLAC.CBL,cobol/zopeneditor-sample/CUSTCOPY.cpyMost-moved scanned files (channels):
cobol/cobol-check/src_main_cobol_REPLAC.CBL(1),cobol/che-che4z_lsp_project_fixtures/testing_DIAGNOS.CPY(1),cobol/zopeneditor-sample/CUSTCOPY.cpy(1)Ground-truth ledger
Ground-truth ledger: no change.
Estate-crucible horrors
Estate-crucible (
575bba16a63e->0b0f5f77e84c+dirty): horrors passing 45/49 -> 47/49; checks pass 916->923, fail 10->3, phantom 5->3.Fixes #4265
🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo