Repository navigation
test(cobol): referee panel -- independent COBOL/CICS parsers scored per fact channel (#4377) - #4384
Merged
Merged
Conversation
…ct channel (#4377) tests/tools/referees/: a common referee-facts/1 format, one adapter per referee (Cobrix, Spantree tree-sitter-cobol-enterprise, Eclipse Che4z's analysis CLI, mapa's CallTree), the engine and estate-crucible keys as fact sources, and score.py, which scores every source against the answer keys and against the engine and groups the disagreements for adjudication. Test tooling only: no referee is vendored, and nothing under gitgalaxy/ changes. Part of #4377. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
…extents (#4377) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo
| COPY_EXTS = {".cpy", ".copy", ".dcl", ".cbl", ".cob", ".inc", ""} | ||
| _CICS_FILE = {"CICSREAD": "READ", "CICSWRITE": "WRITE", "CICSREWRITE": "REWRITE", "CICSDELETE": "DELETE", | ||
| "CICSSTARTBR": "STARTBR", "CICSREADNEXT": "READNEXT", "CICSREADPREV": "READPREV"} # fmt: skip | ||
| _CALL_TYPES = {"CALLBY": "CALL", "CICSLINKBY": "LINK", "CICSXCTLBY": "XCTL", "SQLCALLBY": "SQLCALL"} |
Contributor
squid-protocol
marked this pull request as ready for review
October 5, 2026 01:21
This was referenced Oct 5, 2026
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 #4377: a first, measured pass of the COBOL / CICS referee panel.
What this adds (test tooling only)
tests/tools/referees/:referee-facts/1JSON: Cobrix, Spantree tree-sitter-cobol-enterprise, Eclipse Che4z (its headlessanalysisCLI) and mapa (CallTree).score.py: the scorecard below, plus adisagreements.jsongrouped by pattern for adjudication.Unit tests cover the scoring logic only (
tests/cobol_mainframe/test_referee_score.py). There is no CI workflow yet.Nothing under
gitgalaxy/changes. No referee code is vendored: Che4z (EPL-2.0) runs as an unmodified external jar, and the only Java here is our own 90-line Cobrix driver.Engine:
ca152eb92b9b(origin/main at run time), zero-dependency install, fresh scans. Referees:339ddba(2.11.2-SNAPSHOT, Maven build)86a2c47(generated with tree-sitter-cli 0.25.10, py-tree-sitter 0.26)6ebe2d4(committed CallTree.jar)Corpus:
estate_key.py.Referee panel scorecard (#4377)
Corpora:
aws-mainframe-modernization-carddemo@59cc6c2fd7eb,cics-banking-sample-application-cbsa@417334533178,cics-genapp@f6f3f4b2580d,estate-crucible@0.3.0,zecs@6d6bcbbc89c9.Parse success and speed (the key-covered members each source reads: programs and / or keyed copybooks)
Per corpus, clean / partial / failed:
Each source vs the answer keys (ground truth), all corpora pooled
P = correct / reported, R = correct / true over (file, value) pairs;
R parsedcounts only the files the source parsed. n/a = the source does not produce that channel.Agreement with the engine (|A ∩ B| / |A ∪ B| on files both parsed)
How to read it
__global_context__row's design (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).GO TO 8500-READTRNX-READin CardDemo CBSTM03A. This is deliberate (#3327 follow-up: COBOL GO TO is not a call (contract C4) -- needs a decision #3362,engine_drops_self_transferin Answer keys: score unit extents and intra-program PERFORM / GO TO edges, not just unit names and start lines #4318), but tree-sitter and the key both have the edge.TEST,3,WS-N) in estate ACCTRPT and CBSA BANKDATA (open: COBOL engine: inline PERFORM forms produce phantom callees (TEST,FOREVER,WS-NofWS-N TIMES,3,END-IFafterEXIT PERFORM) #4305).IDMS-CONTROL/PROTOCOL/SCHEMAsections as units (open: COBOL engine: IDMSIDMS-CONTROL SECTION/PROTOCOL.(ENVIRONMENT DIVISION) recorded as procedure units #4306).D-line extent.PROGRAM-ID. CBLDB22+ trailing blanks;PROGRAM-ID TEST16.) #4307 / COBOL: a full-width space (U+3000) separator hides data entries and pictures (opensourcecobol4j dialect) #3956 / COBOL engine: the last DATA DIVISION entry takes its USAGE from the PROCEDURE DIVISION (DISPLAY verb, 'BINARY' literal) -- wrong byte length #4329.CBL CICS(SP)compiler-option cards make the whole program unparseable (3 of 5 zECS programs).ENTRY 'DLITCBL' USING ...is misread, so its last operand becomes a phantom paragraph (3 CardDemo IMS programs).EXIT.instead of covering a procedure-divisionEXEC SQL INCLUDE. That one is definitional.POINTER, level-77 copybooks,EXEC SQL DECLARE(.dcl), lowercasepic x(40)("field size 0"), and some multi-value 88 lists.pic xXXXXX, read as 5 bytes instead of 6 (CBSA GETSCODE). Cobrix is wrong; the engine and the key are right.analysisCLI exits 1 with no output on any program containing aCALLstatement. A 5-line program reproduces it. This is why 22 of 44 CardDemo programs fail.--astwriter overflows the stack or runs out of memory on 2 large CICS programs.CBL CICS(SP), but recovers.EXEC CICS LINK PROGRAM(WS-ABEND-PGM)(an identifier with a VALUE) and misses most DB2 statements and some literalDELETE FILE('CUSTOMER'), so its call-target recall is 72%.ZF-FCT) as if it were a file (zECS).Adjudicated disagreements (at least 3 sampled per pattern, against the source)
CBL CICS(SP)programs (zECS ZECS000/001/003)PADFLPCB/PAUTBPCBfromENTRY ... USING(DBUNLDGS, PAUDBLOD, PAUDBUNL)EXEC SQL INCLUDE/COPYin PROCEDURE (COTRTLIC 9550, COTRTUPC 9800, COCRDSLC)賞与額→Z)PERFORM TEST/3/WS-N(ACCTRPT, BANKDATA A010)GO TO 8500-READTRNX-READ(CBSTM03A)VALUE +18/+0/-1; the key has null (lgacdb01 L83, ABNDPROC L40, CBPAUP0C L82)10 PIC X(20) VALUE ...asPIC(COPAUS1C L58-67); engine FILLERVALUE X'0D25'→X(ZECS001 L45, ZECS003 L49)COMM-OVERDR value 'TO'(last DATA DIVISION item, BNK1CAC L157 and 9 more)' LGACDB01')pic xXXXXX= 5 bytes (GETSCODE)LINK PROGRAM(WS-ABEND-PGM)(BNK1CCA, BNK1DAC, BNK1CRA)SELECT ... FROM ACCOUNT, DELACC, BANKDATA)ZF-FCTas a file name (ZECS000/001)Draft issues (not filed)
Draft A (engine)
COBOL engine: a continued nonnumeric literal in a VALUE clause is stored with the raw continuation line instead of the joined literal
Found by the referee panel (#4377). In CardDemo
app/cbl/CBSTM03A.CBL, eleven 88-level items carry an HTML literal continued onto a second line (fixed format: the literal runs to column 72, the next line has-in column 7 and resumes after a quote):record_data.value_literalfor HTML-L08 (engineca152eb92b9b) isthat is, the first line's fragment plus the raw continuation line up to its opening quote. The value should be the joined literal,
<table align="center" frame="box" style="width:70%; font:12px Segoe UI,sans-serif;">. tree-sitter-cobol-enterprise also keeps the raw text, so it cannot referee this. The answer key is wrong too, in a different way: it storesSTYL\n(see draft B).Scope: 11 items, all in CBSTM03A. The other three keyed CICS estates have no continued VALUE literal, and estate-crucible has none either.
Acceptance: the value of a continued alphanumeric / national literal is the concatenation per the Enterprise COBOL continuation rules: the first line's characters through column 72, then the continuation line's characters after its opening quote. Pin HTML-L08 / HTML-L10 in a unit test, and add a horror to estate-crucible.
Draft B (engine, minor)
COBOL engine: a unit's extent runs over trailing column-7
D(debugging) lines when WITH DEBUGGING MODE is offCBSA
BANKDATA.cblCDW010: the engine's extent is L1407-1436. The answer key, tree-sitter-cobol-enterprise and Che4z all give L1407-1433. Lines 1435-1436 areDlines (D DISPLAY 'WS-DT-REM' ...), and the program'sSOURCE-COMPUTER ... WITH DEBUGGING MODE(line 39) is commented out, so those lines are comments. The engine does not otherwise readDlines as code: CREACC'sDMOVEs (lines 522 and 688) have no data_move rows. Only the unit end counts them. #4318's cause list mentions this as part ofengine_unit_end_counts_noncode_lines("the PL/I andD-line parts may deserve their own issue"), but no issue tracks it.Acceptance: without WITH DEBUGGING MODE, a
Dline neither starts nor extends a unit. With the mode on, it is code.The key-quality findings (signed numeric VALUEs,
PICas a name, truncated hex, a VALUE taken from the PROCEDURE DIVISION, continued literals) are in the table above. They are test-tooling fixes for the answer-key owners, not engine bugs.Recommendation for the next phase
CBL/PROCESScards,ENTRY, DBCS names. It is also the strongest Translator front-end bake-off: which COBOL parser should the det translator use? #4378 front-end candidate seen here.documentSymbol+ diagnostics) instead of the 2.5.1analysisCLI. The CLI's CALL crash and AST-serialisation failures cost it about a quarter of the members. Where it works, it is the most independent industrial referee (preprocessor + copybook resolution).The local audits pass: ruff, mypy and dead_key (
--ci), the #3813 source-reads gate, and 16 new unit tests.🤖 Generated with Claude Code
https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo