Repository navigation
fix(refraction): graveyard reachability with a SECTION model (#3203) + per-path clean-room keys (#3218) - #3219
Merged
Conversation
…+ per-path clean-room keys (#3218) #3203 defect 5: x_ray_dead_code replaces "named in any PERFORM/GO TO" with a reachability pass over paragraphs AND sections: fall-through until a terminal statement, PERFORM of a paragraph / a section (to its last paragraph) / THRU ranges, GO TO, a trailing PERFORM of a never-returning range as terminal, and CICS HANDLE labels as entry points. Comment lines and literals are ignored; the *-EXIT exemption is gone. The forge's own implementation of the answer-key drafter's model -- the drafter stays unimported by any parser. CBSA against the key: units 680/680, dead 62/62, non-trivial dead 10/10. The DAG architect's and slicer's dead-unit masking use the graveyard's unit_header instead of their own `^[ \t]{0,7}NAME\.`, which missed sections and sequence-numbered source. #3218: clean-room outputs and the IR dead-code state are keyed by stem when unique in the run, else by the path flattened with `__`. Anomaly tags carry the path under the target; forge_agent_jobs resolves it directly (and no longer drops `[FILE : Line N]` system-limit flags) and takes ir_keys. In SQLite mode, stem keying merged two same-named programs' dead code and masked the second one's live OPEN. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Contributor
…e literal read as a Shannon-entropy > 4.8 payload) Same compiled pattern; each literal is now under X-Ray's 64-char extraction floor, so the file needs no XRAY_BYPASS_PATHS entry. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This was referenced Sep 19, 2026
squid-protocol
added a commit
that referenced
this pull request
Sep 20, 2026
… unexplained count (#3211) (#3243) * feat(refraction): classify every differential delta by cause, gate on unexplained count (#3211) `tests/tools/refraction_differential.py` reported raw forge<->engine-DB deltas and always exited 0; attributing each delta was done by hand (the D1-D4 prose in docs/refraction_engine_differential.md). This moves the classifiers into the harness: - classify() attaches a `cause` to every delta by mechanism (scope_terminator, area_b_header, section_header, entry_point, program_inlined_as_copybook, ambiguous_copy_target, exec_sql_include, sequence_number_field, system_copybook, bms_symbolic_map) or as stated_absence by construction, reusing the graveyard finder and answer-key readers rather than new parsers. - where a corpus has a validated answer key (#3210), an INDEPENDENT-field delta (program_id, copybook) is adjudicated to a verdict from the key directly; units/dead share the forge's control-flow model (#3219) so their key agreement never clears `unexplained`. - a committed per-corpus baseline (refraction_differential_baseline.json, split into excerpts/full scopes) + `--ci` / `--update-baseline` / `--corpus` gate: a run that ADDS unexplained deltas exits non-zero. zopeneditor reaches 0 unexplained; CBSA's 33 (dead-code, gated on #3198) and carddemo's 167 (no key) are baselined with a note. The raw #3120 report is unchanged (repo is now optional; --json gains per-delta cause/verdict). New tests/cobol_mainframe/test_refraction_differential.py gates the excerpts in CI and the full corpora when fetched, plus synthetic per-cause unit tests including the #3219 shared-model guard. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * fix(refraction): stop leaking scan env into the pytest session; break the answer-key import cycle (#3211) Two follow-ups from CI on #3243: - `run_target` set GITGALAXY_DISABLE_GIT_HISTORY / GITGALAXY_LICENSE_KEY on the process env with os.environ.setdefault, which persisted for the rest of a pytest session and disabled git for a later test (test_chronometer read the same var). Scope them to the in-process excerpt scan with a save/restore context manager instead; the full corpora already scan in mainframe_corpus's own subprocess env. - CodeQL flagged the cyclic import my classify() introduced. Move the shared forge readers old_paragraphs / old_copybooks into cobol_answer_key (beside the other COBOL readers) and drop score()'s back-import of refraction_differential, so the dependency is one-directional (harness -> reader). Behaviour is unchanged, so the committed baseline still holds. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Finishes the refraction dead-code finder and stops same-named programs from overwriting each other. Tool-side only: no engine files, no golden-master bless.
Closes #3203 (defect 5; defects 1–4 landed in #3217)
Closes #3218
#3203 defect 5: reachability with sections
x_ray_dead_codeused to call a unit live if its name appeared after anyPERFORM/GO TO. It now runs a reachability pass over paragraphs and sections, following ranges from the entry:EXEC CICS RETURN/XCTL/ABEND);PERFORM GET-ME-OUT-OF-HERE);EXEC CICS HANDLE ABEND/CONDITION/AIDlabels are entry points.Other behaviour changes:
PROCEDURE DIVISION USING …header is skipped.*-EXITexemption is gone. An EXIT paragraph that nothing reaches is dead; the answer key counts it as trivial dead code.The DAG architect's and slicer's dead-unit masking now find headers with the graveyard's
unit_header. Before, each had its own^[ \t]{0,7}NAME\., which missed sections and sequence-numbered source, so a dead section's OPENs were never masked.Answer key (#3210), forge before → after on CBSA: units R 452/680 → 680/680, dead P 57/380 → 62/62, non-trivial dead P 5/328 → 10/10. zopeneditor stays exact (0 dead, 0 claimed).
cobol_answer_key.pysays the drafter is "deliberately NOT shared with, or imported by, either parser it grades". So this is the forge's own implementation, written against its input: upper-cased text with copybooks already inlined. It still follows the same control-flow model as the drafter. The key is hand-verified, but agreement is expected wherever the hand pass left the draft unchanged, and a defect in the shared model would not show up in this score. The unit tests cover each construct separately.#3218: output keys
__(multiroot__sam__SAM2). Repos without collisions, like CBSA, keep today's file names.forge_agent_jobsresolves that path directly instead of taking the firstrglob(name)hit, and getsir_keysso it joins the right IR dump.[FILE : Line N]system-limit flag, because itrglob-ed the wholeFILE : Line Nstring.test_same_named_programs_do_not_share_outputs_or_dead_code[SQLITE]fails with stem-keyed state. Program B inherits A's dead paragraph, masks its own liveOPEN OUTPUT, and loses its only output.Verification
tests/cobol_mainframe: 94 passed (withtest_batch_test_harness). The 12 new tests fail against origin/main.MAINparagraph with no terminal statement "not reaching" the next one). They now carry aGOBACK.audit_check.py: all clear.cobol-refractoron both clones left them clean. zopeneditor now writesCOBOL__SAM1/2andmultiroot__sam__SAM1/2separately. CBSA's file names are unchanged, and it reports 62 unreachable units.docs/refraction_engine_differential.mdhas a new update section.🤖 Generated with Claude Code