Repository navigation
Answer keys: score unit extents and intra-program PERFORM / GO TO edges (#4318) - #4335
Merged
Merged
Conversation
…4318) Key schema 2: every unit carries its inclusive `end` and its intra-program `edges` ({verb: PERFORM|PERFORM_THRU|GO_TO, target, line}); every program and sibling carries `main_line` (#4302); PL/I sources gain `pli_units` (own extent, block end, nested_in, CALL edges). `cobol_answer_key.py add-extents` drafts them with the key's own reader, and `score` adds the `unit extents` (with code lines outside any unit) and `intra-program edges` rows, read from function_data and synthetic_unit_data. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
#4318) Every engine disagreement settled against the source (four causes: non-code trailing lines #4300, main line #4302, self GO TO #3362, PERFORM TEST #4305); forge agrees on every COBOL edge; a blind seeded sample of 100 claims agreed 100/100. README documents schema 2, the scores and the before/after-#4315 proof. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
Contributor
squid-protocol
marked this pull request as ready for review
October 4, 2026 16:17
squid-protocol
added a commit
that referenced
this pull request
Oct 4, 2026
…4341) #4335 (answer-key extents, #4318) and #4334 (#4300, sequence-area blanking) merged three minutes apart. #4335's ledger recorded 200 `engine_unit_end_counts_noncode_lines` entries against the engine before #4334; with #4334 on main, 182 of them no longer reproduce (units no longer end on sequence-number-only lines), so the ledger gate on main failed with "0 new, 182 no longer reproducing". Regenerated with `ground_truth_ledger.py update`: +0 -182, 0 untriaged. 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.
Fixes #4318
What changes
The mainframe answer keys now record a unit's extent and the intra-program control edges, not only unit names and start lines.
scoreand the ground-truth ledger grade both. That makes the #4301 class of bug visible: a unit cut short, with its code and edges outside every unit.Key schema 2 (
tests/cobol_mainframe/answer_key/*.json, documented in the answer_key README):{"name": "A010", "kind": "paragraph", "line": 138, "end": 205, "edges": [ {"verb": "PERFORM", "target": "UPDATE-CUSTOMER-VSAM", "line": 200}, {"verb": "PERFORM", "target": "GET-ME-OUT-OF-HERE", "line": 205}]}end(inclusive) is the unit's last code line before the next header,END PROGRAM, or the next program. These are not code lines: blank lines, comments, col-7Dlines, and lines holding only a sequence number in cols 1-6 or 73-80. A section's own extent stops at its first paragraph.edgesarePERFORM/PERFORM_THRU(withthru) /GO_TO(withdependingfor each target of aGO TO ... DEPENDING ON), each with the line of its verb. The target must be a unit of the program, or a paragraph that a procedure copybook brings in. Inline PERFORMs,EXIT PERFORM, CALL, ALTER and SQLWHENEVER ... GO TOare not edges. A split-line operand (COBOL engine: a cols 1-6 sequence number is read as the operand when PERFORM / GO TO / CALL / COPY continues on the next line #4300) is read across the line break.main_line(per program and sibling) is the code between PROCEDURE DIVISION and the first header (COBOL engine: statements between PROCEDURE DIVISION and the first paragraph belong to no unit, so the program's main-line PERFORM/CALL edges are never recorded #4302), with its edges.pli_unitscovers PL/I procedures, read with this tool's ownDO/BEGIN/SELECT/PROC...END [name]block reader (multiple closure). It records the own extent,block_end,nested_in, andCALLedges to procedures of the same program. The sources keyed are thepli_movesset plus the eight COBOL/PL/I engine: a paragraph ends at its last line-leading GOBACK/EXIT/RETURN, even a conditional one, so the code after it loses its PERFORM/CALL edges (root cause of #4283) #4301R00104{22..25}.plicopies.extents_validated/extents_validated_tiersigns off each program or source.cobol_answer_key.py add-extentsdrafts the new fields and refuses to run if the committed unit list would move.Scoring: two new rows,
unit extentsandintra-program edges.function_datastart_line + loc. The row also reports the key's code lines that are outside every engine unit, and the ledger scoreboard pins that count.transfers_to, fromcalls_out_toless the file's call-site operands and targets, and from the COBOL: record each PROCEDURE DIVISION's entry code as a calls-only unit (#4302) #4323 synthetic main line. A phantom like COBOL engine: inline PERFORM forms produce phantom callees (TEST,FOREVER,WS-NofWS-N TIMES,3,END-IFafterEXIT PERFORM) #4305'sTESTstill scores as a false edge.Verification (the new fields are never copied from the engine)
cobol_graveyard_finder's units give an independent reading of the edges. It agrees on all 1,880 / 1,880 distinct COBOL edges.All 7 keys are signed
llm_verifiedfor these fields.Proof the gap is closed
The same keys, scored on the engine just before #4315 (
c136f46b) and on main (0d64632e+ this branch; no engine change):c136f46bc136f46bThe old engine shows the #4301 shapes as extent and edge mismatches:
UPDCUSTA010:L138-194against the key'sL138-205.UPDATE-CUSTOMER-VSAMandGET-ME-OUT-OF-HEREare lost (COBOL engine: UPDCUST records no PERFORM edges #4283).BANKDATAA010:L370-406againstL370-673, with 4 PERFORMs lost.BNK1CAC/CCA/CCS/CRA/DAC/DCS/TFN/UACandBNKMENUA010: each losesPOPULATE-TIME-DATEandABEND-THIS-TASK.RETURN-TO-*paragraphs at one line, e.g.COBIL00CRETURN-TO-PREV-SCREENL273-273againstL273-284.KONTROLL_AV_INPUTare cut atELSE RETURN;, and theirCALL SEND_MAPis lost.GOBACK/RETURN.On main, none of these remains.
CRECUSTdoes not appear: at CBSA's pinned ref, P010 has no conditional GOBACK. The #4301 evidence came from the crucible's copy.Ledger (regenerated with
updateafter merging main, including #4323)The new rows add 230 mismatches. Each cause names its owner:
engine_unit_end_counts_noncode_linesengine_main_line_in_no_unitengine_drops_self_transferengine_inline_perform_phantom_calleeengine_unit_end_counts_noncode_lines: a unit that ends at the next header runs over trailing sequence-number-only lines. That covers 91 CardDemo units (cols 1-6), 8 DSF PL/I outer procedures (cols 73-80), and one col-7Dline in CBSA BANKDATA CDW010. It has the same root as COBOL engine: a cols 1-6 sequence number is read as the operand when PERFORM / GO TO / CALL / COPY continues on the next line #4300 (the sequence area is not blanked in the stream the slicer reads). The PL/I andD-line parts may deserve their own issue; the cause can be re-pointed withassign.engine_main_line_in_no_unit: before COBOL: record each PROCEDURE DIVISION's entry code as a calls-only unit (#4302) #4323, 95 main-line edges also belonged to this cause. COBOL: record each PROCEDURE DIVISION's entry code as a calls-only unit (#4302) #4323 fixed them, and the ledger ratcheted them out. The main line still has no extent, because synthetic_unit_data has no end line.engine_drops_self_transfer: a GO TO back into its own paragraph is dropped like recursion.field_testing.jsonregisters both new fields (introduced #4318, 7 development rounds), and the report andfact_channel_confidence.jsonare regenerated.Checks
tests/cobol_mainframe/: 1401 passed. 6 new draft-rule tests and integrity checks pin the schema: the COBOL/PL/I engine: a paragraph ends at its last line-leading GOBACK/EXIT/RETURN, even a conditional one, so the code after it loses its PERFORM/CALL edges (root cause of #4283) #4301 repro, split / DEPENDING / WHENEVER / self-loop / sequence-only lines, procedure-copybook targets, PL/I multiple closure, and the engine-edge projection.ground_truth_ledger.py check: clean.field_testing.py check: valid.mypy_audit/ruff_audit(0.16.0) /dead_key_audit --ci: no new findings.🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo