You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cobol-refractor keys every output and its dead-code state by file stem, so same-named programs overwrite each other (and merge dead code in SQLite mode) #3218
Found while verifying #3217 end to end on IBM/zopeneditor-sample 8f98353. That repo has two copies of each of its programs, COBOL/SAM1.cbl / COBOL/SAM2.cbl and multiroot/sam/SAM1.cbl / multiroot/sam/SAM2.cbl. This is a common layout: variants, versions or per-environment copies of one program.
What happens
cobol_refractor_controller.py names everything after file_path.stem:
[file.name] → source_dir.rglob(file_name) first hit, <stem>_ir.json
ticket built from whichever same-named file rglob yields first, joined to the IR dump of whichever was written last
Observed: after a run on zopeneditor, 04_ir_state_dumps/SAM2_ir.json has "path": ".../multiroot/sam/SAM2.cbl". The IR for COBOL/SAM2.cbl is gone.
The worse case is SQLite mode.calibrate_ir_medium switches to it on large repos, which are exactly the ones likely to have same-named programs. record_dead_code does INSERT OR IGNORE keyed by (program_id, entity_type, entity_name). So the second SAM2 reads back the union of both programs' dead paragraphs and orphaned variables. It then masks paragraphs that are live in its own source when running extract_lineage (lost OPENs → lost inputs/outputs → wrong JCL DISP) and the slicer, and drops variables from the schema forge's output. RAM mode overwrites the entry before reading it, so it is only affected through the files above.
On the two answer-key corpora: zopeneditor has 2 colliding stems (SAM1, SAM2); CBSA has none.
Suggested fix
Key by the path relative to the target, not the stem. For example:
or use a collision-free flattened name such as multiroot__sam__SAM2.
Use the same key in IRStateManager (program_id → relpath) and in forge_agent_jobs: carry the relpath in the anomaly string and in the IR, and never re-find the file with rglob(name). Add a test with two same-named programs in different directories, in both RAM and SQLite modes. #3212's snapshot test should include zopeneditor's multiroot layout.
Activity
fix(refraction): graveyard reachability with a SECTION model (#3203) …
fix(refraction): name every generated Java class from the clean-room …