Repository navigation
Fix #4010: layout_fields expands a nested COPY instead of shifting later fields - #4013
Merged
Merged
Conversation
Contributor
squid-protocol
force-pushed
the
fix/4010-layout-nested-copy
branch
from
September 29, 2026 18:01
0b6b7ee to
2897ddb
Compare
…ter fields equivalence_common.layout_fields now expands every COPY in the file before laying a record out, with members looked up in copy_dirs (default: the file's own directory, then the corpus). A COPY that resolves nowhere inside the chosen record, or any COPY ... REPLACING, raises LayoutError instead of returning a shifted layout. The CICS crucible runner drops its expand_copies workaround and passes its copy directories (the case's, then the DFH stand-ins). Part of #3989. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
squid-protocol
force-pushed
the
fix/4010-layout-nested-copy
branch
from
September 29, 2026 18:15
2897ddb to
df1c8e0
Compare
This was referenced Sep 29, 2026
Merged
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.
Fixes #4010
Part of #3989 (phase 3, lane A)
What changed
equivalence_common.layout_fieldsexpands eachCOPY member.in the file before it lays out a record. It looks each member up in the newcopy_dirsargument; by default that is the file's own directory, then the corpus. Nesting goes up to 8 levels. With the COPY expanded, the fields after it keep their offsets: CALINK'sWS-AFTER-FLAGlands at offset 100, not 0.Failing loudly. A new
LayoutError(ValueError)is raised when:REPLACING, which is not modelled.IndexError.An unresolved COPY outside the record, such as
COPY DFHAID.before it or in LINKAGE, is still harmless.tests/tools/cics_crucible.pydrops itsexpand_copiesworkaround and the temporary copy of each layout source.case_contextnow callslayout_fields(..., copy_dirs=<case copy dirs> + <DFH stand-ins>)and turns aLayoutErrorinto aCaseError. It no longer takes aworkargument.Tests
test_layout_fields_expands_a_nested_copy_so_later_fields_keep_their_offsetscovers a CALINK-shaped record with a two-level nested COPY, the explicitcopy_dirsand the default search.test_layout_fields_fails_loudly_on_a_copy_it_cannot_expandcovers an unresolved COPY inside the record (raises), unresolved COPYs outside it (fine), a missing record, and REPLACING.test_layouts_inline_copy_members_so_later_fields_keep_their_offsets) now runs throughlayout_fieldsitself.Crucible cells
Before and after are identical. The runner already worked around this bug, so this PR moves the fix into the harness and adds no cells. The baseline and report are unchanged.
On the first base (d650001),
results.jsonwas byte-for-byte the same before and after, with 20 pass, 12 fail and 62 unsupported. The branch is now rebased on #4002 (e804642). There--cimeasures 22 pass, 38 fail and 34 unsupported, and the non-passing cells match the committed baseline cell for cell.Verification
cics_crucible.py --ciis green.tests/cobol_mainframe/test_equivalence*.pysuites withEQUIVALENCE_E2E=1pass 58 of 58, including the CardDemo intcalc, acctview, generated-inputs and environments end to end.tests/cics_cruciblewith E2E also passes.ruff formatis clean on the touched files. The two new regexes are anchoredmatches and time linearly on adversarial inputs. The engine and forge are untouched, so no golden masters change.🤖 Generated with Claude Code