Skip to content

CICS online programs in the equivalence harness; CardDemo account view proven 9/9 (#3754) - #3801

Merged
squid-protocol merged 6 commits into
mainfrom
feat/cics-harness-3754
Sep 26, 2026
Merged

squid-protocol merged 6 commits into
mainfrom
feat/cics-harness-3754

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3754. Part of epic #3755.

What it does

The equivalence harness now proves CICS online programs, not only batch. A scenario is:

  • the COMMAREA the task starts with;
  • the key pressed (EIBAID);
  • the screen input.

Each scenario runs as one task on both sides, and the tasks' outputs are compared field by field.

COBOL side: a per-command translator plus a stub CICS runtime

  • Translator (tests/tools/equivalence_cics.py). Each EXEC CICS block becomes a CALL into tests/equivalence/cics/ggcics.c: READ, RECEIVE MAP, SEND MAP/SEND TEXT, RETURN, XCTL, ABEND and HANDLE ABEND so far.
    • It knows commands, never programs, as IBM's translator does.
    • DFHRESP(x) becomes its number, and RESP/RESP2/NOHANDLE are honoured. A condition the program neither tests nor ignores abends the task, as CICS does.
    • RETURN, XCTL and ABEND end the task.
    • A command it doesn't model is refused by name, never skipped.
  • Stand-in copybooks for the EIB (EXTERNAL, shared with the driver), DFHAID and DFHBMSCA. They follow the documented layouts and values; no IBM text is copied.
  • The stub's file table comes from the engine's facts, not a hand-written list. Each CICS file the program uses is traced from the CSD DEFINE FILE to its DSNAME, then to the IDCAMS DEFINE that keys it, following a PATH through its AIX. CardDemo's CXACAIX resolves to KEYS(11 25) over the card-xref cluster.
  • Outputs. The stub serves the corpus's own data and records every event with its bytes. Screens and COMMAREAs are decoded through their copybook layouts, including the symbolic map's output record (layout_fields now accepts a named root that REDEFINES).

Java side

  • Generator.
    • A CicsTask class (package cics) holds a task's inputs and records, in order, sendMap, sendText, returnTransid, xctl and abend.
    • Every CICS program with a transaction gets runTask(CicsTask), the port's target, like runBatch.
    • Two new porting rules: one maps EXEC CICS onto the task; the other says a partial port is not proven.
  • Harness. A generated JUnit loads the files through the entities' codecs, then runs each scenario as a CicsTask through runTask.
    • COMMAREAs are mapped to COBOL field names through the generated DTOs' own field comments, whole or by part (an XCTL passes only CARDDEMO-COMMAREA).
    • Screens are compared through screenValues(), keyed by BMS field.
    • run_java is split into prepare_project and run_maven, shared by both paths.

Measured: CardDemo account view (COACTVWC, transaction CAVW)

scenario what the COBOL does generated Java with the case's port
entry from the menu sends the empty screen, RETURN CAVW 0/2 2/2
view account 00000000001 reads the xref (via the AIX), account and customer; sends them 0/2 2/2
account not on file xref NOTFND (13), error message 0/2 2/2
account not numeric validation message 0/2 2/2
PF3 XCTL COMEN01C with the COMMAREA 0/1 1/1
  • 236 fields compared, 92 of them non-blank: balances in their edited PICTUREs (+ 2,020.00), the SSN, names, dates and messages, and the COMMAREA's ids and card number.
  • The port (tests/equivalence/carddemo-acctview/port/) is a hand translation. It keeps two of CardDemo's own defects, each commented with its one-line fix:
    • the "entered from the menu" test reads the COMMAREA before it is moved in, so it never fires;
    • a missing account does not stop the customer read.
  • Gemini 3.1 Pro (via the porting loop) did not produce a port for this ticket. Two attempts returned nothing, and one returned a sketch the harness proved 1/10. The ticket's prompt is 268 KB (the program, 15 copybooks, every generated class it touches), several times the batch tickets Gemini ported. That's a real limit to address as follow-up; the harness reports it either way.

Not modelled yet (refused by name when met)

  • Browse commands (STARTBR/READNEXT), WRITE/REWRITE/DELETE, TS/TD queues, LINK, channels and SYNCPOINT.
  • Attribute bytes (colour, highlight) are not compared.
  • RESP2 values are the stub's (0), not CICS's.

Tests

  • test_equivalence_cics.py: the translator per command; a whole program translated; an unknown command refused with its line; the stub's file table from a real scan (CSD + IDCAMS, a PATH through its AIX); field round trips; map input; DTO shape; the event diff. Plus a gated end-to-end run (EQUIVALENCE_E2E=1), which passes locally.
  • test_cics_endpoints.py: runTask/CicsTask generation.
  • The mainframe suite passes locally: 721 passed.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

squid-protocol and others added 3 commits September 26, 2026 15:30
…events (#3754)

COBOL side (tests/tools/equivalence_cics.py, tests/equivalence/cics/):
- a per-command EXEC CICS translator: READ, RECEIVE MAP, SEND MAP / TEXT, RETURN,
  XCTL, ABEND, HANDLE ABEND become CALLs into a C stub runtime (ggcics.c);
  DFHRESP(x) becomes its number; RESP / RESP2 / NOHANDLE honoured, an untested
  condition abends as CICS does; an unmodelled command is refused by name;
- EIB / AID / BMS-constant stand-in copybooks (documented layouts and values);
- the stub's file table from the engine's facts: CSD FILE -> DSNAME -> IDCAMS KEYS,
  a PATH through its AIX (CardDemo's CXACAIX: KEYS(11 25) over the xref cluster);
- each scenario (COMMAREA, key pressed, screen input) runs as one task; its events
  (SEND MAP, SEND TEXT, RETURN, XCTL, ABEND) are recorded with their bytes.

Java side:
- generator: CicsTask (package cics) and runTask(CicsTask) on each CICS program's
  service with a transaction -- the port's target, like runBatch; a porting rule
  mapping EXEC CICS onto the task, and one that a partial port is not proven;
- harness: a generated JUnit runs every scenario as a CicsTask; COMMAREAs map to
  COBOL names through the generated DTOs' own comments, screens by BMS field.

Case tests/equivalence/carddemo-acctview (CardDemo COACTVWC, CAVW), 5 scenarios:
the generated Java 0/9 events; the case's hand port 9/9 -- 236 fields compared,
92 non-blank. Gemini 3.1 Pro did not produce a port on this 268 KB ticket (two
empty answers, one sketch the harness proved 1/10). run_java split into
prepare_project / run_maven; layout_fields takes a named REDEFINES root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
Comment thread tests/tools/equivalence.py Fixed
Comment thread tests/tools/equivalence_cics.py Fixed
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Comment thread tests/tools/equivalence_cics.py Fixed
…CodeQL cyclic import, #3801)

equivalence_cics imported the batch harness, which dispatches CICS cases to it -- a
cycle whether the import was module-level or lazy. The paths, the GnuCOBOL image, the
corpus-input helpers, decode_field and layout_fields move to equivalence_common, which
imports no harness module; equivalence.py re-exports them unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
squid-protocol added a commit that referenced this pull request Sep 26, 2026
…CodeQL cyclic import, #3808)

equivalence_inputs builds on equivalence_common instead of importing the batch harness
that calls it. The module is byte-identical to #3801's, so the two merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
Comment thread tests/tools/equivalence.py Fixed
@squid-protocol
squid-protocol merged commit d40084d into main Sep 26, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the feat/cics-harness-3754 branch September 26, 2026 20:50
squid-protocol added a commit that referenced this pull request Sep 26, 2026
)

* Equivalence harness: inputs generated from record layouts (#3804)

A dataset's input may be "@generate": records built from its copybook layout
(tests/tools/equivalence_inputs.py) -- per PICTURE, edge values first (zero, one,
the maximum and its negative, the smallest fraction), then spread; text at full
width, short and blank; YYYY-MM-DD for date-shaped fields; FILLER blank. Primary
keys are unique and never blank, an indexed dataset is in key order; "from" draws
a field from another generated file (with "miss" for the not-found path), "values"
with "every" fills a cartesian product; seeded, byte-identical per seed. A case
may prove another case's port ("port_from").

carddemo-intcalc-generated: the CBACT04C port -- written against CardDemo's data --
on generated accounts, cross-references, category balances and disclosure groups
(one group without rates: the DEFAULT fallback ran 11 times): ACCTFILE 30/30,
TRANSACT 37/37, RETURN-CODE 0 = 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

* Equivalence: shared primitives in a leaf module, equivalence_common (CodeQL cyclic import, #3808)

equivalence_inputs builds on equivalence_common instead of importing the batch harness
that calls it. The module is byte-identical to #3801's, so the two merge cleanly.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

* Equivalence: re-export only the primitives equivalence.py uses (CodeQL unused import)

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Equivalence harness: CICS online programs (EXEC CICS stub runtime on the COBOL side)

2 participants