Repository navigation
Import resolver: a unique COPY / %INCLUDE candidate must be in the importer's language (part of #4265) - #4366
Merged
Merged
Conversation
…porter's language (part of #4265) The #3199 language rule for source-member imports (COBOL COPY, PL/I %INCLUDE, HLASM COPY) ran only when several files matched. A single match in another language was taken. Examples: COBOL `COPY A` -> A.hlasm (che4z lsp fixtures), DSF PL/I `%INCLUDE DFHBMSCA` -> carddemo's COBOL copybook, and zopeneditor PSAM1LIB.pli -> COBOL DATETIME.cpy / REPTTOTL.cpy. This is the same class as #3001's Python `import base64` -> base64.c. A BMS mapset stays a valid COBOL member source (new language key `source_members_generated_from`). Its symbolic map is a COBOL copybook generated from it, so `COPY CUSTMS` may name CUSTMS.bms when the mapset is the only CUSTMS. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
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 (the cross-language resolver shape reported in the 2026-10-04 19:01 comment). Library resolution (H-0034) and REPLACING (H-0016) follow as their own PRs.
What was broken
The #3199 language rule for source-member imports (COBOL
COPY, PL/I%INCLUDE, HLASMCOPY) is that a member is source in the importer's language._narrow_ambiguousenforced it only when several files matched. When exactly one file matched, the resolver took it whatever its language. In the crucible this drew 11 wrong edges:TEST.CBLCOPY A/COPY B→hlasm/che4z_hlasm/A.hlasm,B.hlasm;testing_A.cpyCOPY B→B.hlasm%INCLUDE DFHBMSCA→ carddemo's COBOLDFHBMSCA.cpyPSAM1LIB.pli→ COBOLDATETIME.cpyandREPTTOTL.cpyThis is the same class as #3001 (Python
import base64→base64.c).The fix
_resolve_by_nameapplies the language rule to the unique-candidate path too. There is one exception, declared in the language definition (cobol.py, new keysource_members_generated_from: ("bms",)): a COBOL program may resolve to a BMS mapset, because the mapset's symbolic map is a COBOL copybook generated from it.Why the exception is needed. Without it, estate-crucible regressed: copies went from 32 pass / 3 fail to 30 / 5, because CUSTINQ
COPY CUSTMSand GULFINQCOPY GULFMSlost their edges.CUSTMS.cpy,GULFMS.cpy) are excluded by the aperture as machine-generated. They are inexcluded_artifactsand not infile_data. That leaves the mapset as the onlyCUSTMS.alternative.The layouts change I saw during development (80 pass / 7 fail to 81 / 6): CUSTINQ
WS-COMMAREA @11lost itsbytes: Nonefailure. That was a side effect of dropping the BMS edge. With the edge, the copy files include a.bmsthat has no records. Without it, GalaxyIR's synthetic symbolic map (#3490) took over. With the exception in place, both the edge and the layout fail are back exactly as on main.Evidence
test_copy_of_a_unique_member_in_another_language_draws_no_edge_4265(fails on main):COPY A/COPY B→ HLASM gives no edge;COPY A→A.hlasmstill resolves;A.cpyresolvesCOPY Ato it.Golden masters (both legs regenerated; same diff)
import_edges: exactly the 11 edges above are removed and none are added. Everything else is downstream graph math over those edges:CRELIBS.jcl12.847 → 12.823)pytest -m golden_cruciblepasses in both venvs.Ground-truth ledger
update: no change.check: clean.Estate-crucible v0.3.0
Identical to main: every channel count, horror and check line matches. H-0034 still FAILs; it is the library-resolution part, which comes next.
Local checks
tests/security_auditing,tests/cobol_mainframe,tests/extractionandtests/core_engine: 13,599 passed.mypy_audit/ruff_audit(0.16.0) /dead_key_audit --cireport nothing new.🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo