Skip to content

#3989 phase 2: CICS crucible runner, baseline ratchet and CI - #4000

Merged
squid-protocol merged 3 commits into
mainfrom
feat/3989-cics-crucible-runner
Sep 29, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
feat/3989-cics-crucible-runner

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3989 (phase 2: the measuring instrument, not the fixes).

What this adds

  • tests/tools/cics_crucible.py (CLI + importable) runs every case of cics-crucible and produces one verdict per cell = (case, scenario, side):
    • engine-facts (per case): the scan recorded the case's programs, CSD transactions, BMS maps, and every CICS command its expected logs show (SEND/RECEIVE MAP, LINK, XCTL, RETURN TRANSID, START, RETRIEVE, CANCEL, READQ/WRITEQ TS, ABEND ABCODE, HANDLE ABEND exits taken).
    • forge-compile (per case): refactor, then cobol-to-java (config h2, the equivalence harness's), then mvn compile.
    • cobol-stub (per scenario): the translator (equivalence_cics.py) plus the stub runtime (ggcics.c) in GnuCOBOL. It is driven task by task: RETURN TRANSID + COMMAREA chain the terminal steps, and an XCTL runs its target in the same task. It uses one long-lived container per case, run as the caller's uid.
    • java (per scenario): the generated services' runTask(CicsTask), driven the same way by a generated EquivalenceRunTest (reflection only, so it compiles for cases with no BMS map).
  • tests/tools/cics_crucible_compare.py is the exact comparison of SPEC §6. Text is EBCDIC and padded to its known length (trailing blanks are optional, embedded ones are not). Hex is compared as exact bytes and numeric fields as numbers. Areas are compared by layout, with DISPLAY bytes transcoded and COMP/COMP-3 bytes kept. Each side declares its Capabilities. The walk stops at the first decisive point: a modelled divergence is a fail, and an expected event or key the side cannot record is unsupported: . A stub that records nothing therefore fails at its first missing event, unless that event is one the side cannot record at all.
  • Pin: tests/_cics_crucible_pin.py has PINNED_REF = "v0.1.0" on one line, and the workflow reads it with sed. CICS_CRUCIBLE_PATH points at a local checkout, and CICS_CRUCIBLE_ALLOW_UNPINNED=1 allows a deliberate off-pin run. This deviates from the plan comment on purpose: there is no CICS_CRUCIBLE_REF repository variable. The file is the single source, which is fork-safe with no fallback logic.
  • Ratchet: tests/cics_crucible/baseline.json holds every cell that does not pass, with its status and reason, one line per cell. --ci fails on a cell that isn't ledgered, and on a ledgered cell that now passes (lower it with --update-baseline). On a complete run it also fails on a ledgered cell that was never measured.
  • Report: docs/language_status/cics_crucible.md is written with the baseline. It gives counts per side and per trap/case, failure reasons grouped, and the harness work ordered greedily by the cells it unlocks, plus the per-feature counts.
  • CI: .github/workflows/cics-crucible.yml clones the crucible at the pin, builds the GnuCOBOL image, and sets up JDK 17 + Maven (cached). It runs the runner's own tests with EQUIVALENCE_E2E=1, then --ci, and publishes the report to the step summary and as an artifact.
  • Runner tests (tests/cics_crucible/test_cics_crucible_runner.py, 28 without Docker/Maven): case.json/CSD parsing and the format guard, COPY-expanded layouts, every comparison rule, the stub-log and Java-output adapters, translator features, the ratchet, the report, and the pin's one-line form. There is also one gated E2E test on a fixture case in crucible format (tests/cics_crucible/fixture/, which the crucible's validate.py accepts). Its COBOL passes end to end on the stub: 3 tasks, a COMMAREA chain and an XCTL hop. Its Java fails at event 1 on the runTask stub. This proves the drivers work, since no crucible cell can pass yet.
  • Harness: equivalence_cics.Unsupported now carries features (LINK, READQ TS, HANDLE CONDITION, RECEIVE, ...). An undocumented DFHRESP(x) is now refused by name instead of raising KeyError. Implementing the missing CICS runtime is phase 3.
  • docs/ecosystem.md adds cics-crucible to the constellation map, plus the release -> pin bump workflow. docs/language_status/README.md links the report.

Baseline at v0.1.0 (94 cells)

side pass fail unsupported total
engine-facts 10 0 0 10
forge-compile 10 0 0 10
cobol-stub 0 0 37 37
java 0 12 25 37
all 20 12 62 94
  • The 12 java fails are all the same reason: runTask records no events, because it is the generated stub and the PROCEDURE DIVISION is not ported. They are the map-driven cases (hx-, pc-), whose first event CicsTask can record.
  • 6 cobol-stub cells (hx-attr-bytes, hx-extended-cursor) actually run in GnuCOBOL. Their task keys and SEND-MAP map/mapset/options match, and they stop at stub: SEND-MAP cursor (BMS output resolution isn't modelled). The other 31 cannot be translated (translator: ...).

Harness work, ordered by the unsupported cells it unlocks (cumulative):

# cobol-stub (37 unsupported) cum. java (25 unsupported) cum.
1 BMS output fidelity 6 SEND TEXT length/options (CicsTask) 0
2 TS queues (READQ/WRITEQ TS, seeding, final) 9 TS queues 5
3 condition machinery (HANDLE/IGNORE CONDITION, PUSH/POP, abend exits, ASSIGN ABCODE) 13 LINK 6
4 LINK (levels, by-reference COMMAREA, PGMIDERR) 18 terminal RECEIVE 10
5 terminal RECEIVE (unformatted input) 24 interval control 18
6 interval control (START/RETRIEVE/CANCEL, started tasks) 33 condition machinery 22
7 HANDLE AID 36 XCTL LENGTH/RESP 25
8 XCTL RESP2 37

Found on the way (for phase 3, not fixed here)

  • equivalence_common.layout_fields lays out a record as written. A nested COPY is dropped silently, and every later field shifts: CALINK's WS-AFTER-FLAG lands at offset 0 instead of 100. The runner inlines COPY members first (expand_copies).
  • equivalence_cics.dto_shape finds a class by simple name, and the contract DTO dto/contract/PcwizWsState shares its name with entity/PcwizWsState, so the mapping came back empty. The runner resolves the DTO by its fully qualified path.
  • The forge gives a program reached only by LINK/XCTL (CASUB, HCSUB) a handleLink but no runTask, so the Java side cannot run it as part of a task.
  • A scan in place of a directory inside a git checkout sees only git-tracked files, so the runner scans a copy of the case.

Cross-repo

  1. Companion: Phase 1: case format, validator, CI and ten CICS trap cases cics-crucible#1 (phase 1: SPEC, validator, 10 cases / 37 scenarios) is already merged and released as v0.1.0 (0c942cb8). This PR pins that tag.
  2. Merge order: crucible PR ci: implement cross-platform matrix testing #1 then its tag (done), then this PR. Nothing in the crucible waits on this.
  3. After merge: nothing to re-run. Later crucible releases take one gitgalaxy PR: check out the new tag, run --update-baseline, and commit the pin, baseline and report together (docs/ecosystem.md, "CICS crucible release -> pin bump"). Phase-3 PRs lower the ledger the same way, and CI fails until they do.

Verification

  • pytest tests/cics_crucible passes 29 with EQUIVALENCE_E2E=1 (Docker GnuCOBOL + JDK 17). tests/cobol_mainframe passes (1077 passed, 33 skipped), and the CardDemo CICS E2E still passes with the translator change.
  • cics_crucible.py --ci is green against the committed baseline (about 1 min locally, offline Maven).
  • The ruff / mypy / dead-key audits and tool_regex_redos --ci are clean. ruff format --check passes on the touched files with CI's ruff 0.16.0.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup

squid-protocol and others added 2 commits September 29, 2026 13:06
tests/tools/cics_crucible.py measures the CICS pipeline against
squid-protocol/cics-crucible (pinned to v0.1.0 in tests/_cics_crucible_pin.py;
CICS_CRUCIBLE_PATH for local checkouts). Per case: engine-facts (the scan
recorded the programs, CSD transactions, BMS maps and every CICS command the
expected logs show) and forge-compile (refactor, cobol-to-java h2, mvn
compile). Per scenario: cobol-stub (the translated COBOL run task by task on
the stub runtime in GnuCOBOL, RETURN TRANSID COMMAREA chained, XCTL run in the
same task) and java (the generated services through CicsTask, driven by a
generated EquivalenceRunTest). Each is compared with the hand-written expected
log exactly, per SPEC section 6 (tests/tools/cics_crucible_compare.py): pass,
fail at the first divergence, or unsupported naming the missing feature.

The harness's translator now names each command it refuses
(Unsupported.features) and refuses an undocumented DFHRESP(x) by name instead
of raising KeyError.

tests/cics_crucible/baseline.json ledgers the 74 cells that do not pass today
(20 pass: every engine-facts and forge-compile cell; cobol-stub 37
unsupported; java 12 fail at the generated runTask stub, 25 unsupported).
cics-crucible.yml clones the crucible at the pin (read from the pin file, so
fork PRs work), runs the runner's tests with the fixture case end to end, and
fails on a cell not ledgered or a ledgered cell that now passes.
docs/language_status/cics_crucible.md is the generated report: counts per trap
and side, failure reasons, and the harness work ordered by the cells it
unlocks. docs/ecosystem.md gains cics-crucible and its release -> pin bump
workflow.

Part of #3989

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
The repo-wide *.json ignore rule dropped tests/cics_crucible/baseline.json and
the fixture case's case.json and expected log from the first commit; un-ignore
them beside the other committed ledgers.

Part of #3989

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
Comment on lines +1120 to +1121
"Every cell that does not pass is ledgered in `tests/cics_crucible/baseline.json`, and CI "
"(`cics-crucible.yml`) holds the ledger as a ratchet.", "",
Comment on lines +1147 to +1151
"Each missing feature belongs to a piece of harness work (below: the features themselves). A cell is "
"*unlocked* when every piece its features need is done: it then gets a pass or fail verdict rather "
"than `unsupported`. **needs** counts the cells that do not pass and need the piece, **alone** the "
"unsupported cells it unlocks by itself, and **cumulative** the unsupported cells unlocked by it and "
"every row above it (rows are chosen greedily).", ""] # fmt: skip
Comment on lines +1163 to +1165
"Each feature a cell needs that its side does not model (`translator:` the COBOL translator refuses "
"the command; `stub:` the stub runtime does not record it; `CicsTask:` the generated Java runtime "
"does not; `scheduler:` the task driver).", ""] # fmt: skip
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

tests/test_source_reads.py forbids lossy errors= handlers. Neither was needed:
the stub runtime's latin-1 decodes every byte and cp037 encodes every latin-1
character, so the transcoding is strict and would raise rather than hide a
byte it cannot map.

Part of #3989

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
@squid-protocol
squid-protocol merged commit d650001 into main Sep 29, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the feat/3989-cics-crucible-runner branch September 29, 2026 17:25
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.

2 participants