Skip to content

#3989: port the CICS crucible through the porting loop (17/17 proven, java-ported 37/37) - #4025

Merged
squid-protocol merged 1 commit into
mainfrom
feat/3989-crucible-ports
Sep 29, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feat/3989-crucible-ports

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #3989 (the porting step): the crucible's 17 CICS programs are ported by a model through the porting loop, and the crucible harness proves each port.

Result

All 17 programs are proven; the new java-ported side passes 37 / 37 cells.

  • Model: Claude Opus 5.5, through port_runner's command backend: Claude Code in print mode, with no tools, no MCP and no project context.
  • Proof: port_runner prove, which runs tests/tools/cics_crucible.py against the crucible's hand-written expected logs.
  • Attempts to proof:
    • 9 at attempt 1. For three of these, the unchanged port was proven only after a harness fix.
    • 7 at attempt 2.
    • 1 at attempt 3.
  • Nothing is approved. port_runner review is Joe's.

The per-program table and the failure causes are in docs/cobol_to_java_porting_loop.md ("Measured: CICS crucible, Claude via the command backend").

Failures and the fixes (all in gitgalaxy; no port was hand-edited)

cause programs fix
CicsTask had no EIBTRMID GTSHOW, GTTERM task.termid(); the driver passes the task's terminal
CicsTask did not model HANDLE ABEND's upward exit search across LINK levels. The ports invented incompatible exception protocols, and an exception through a @Transactional service rolled the task back HCMAIN, HCSUB handleAbend / handleAbendCancel / handleAbendReset, pushHandle / popHandle. abend / abendOnCondition now search the exits and return the label to continue at (or null: stop). abendExit() after a LINK. New porting rule; never throw to model a CICS transfer
CobolEdit / CobolRecords were generated only with VSAM entities, but the rules require them for screen fields. A port imported CobolEdit from a package it invented CAXB (and CAXA through it) emitted for every estate with CICS programs (generated-output change, intended)
Harness: a DTO COMMAREA could not be compared with a log's text / hex area, and a callee's DTO names a caller's bytes differently HXATTR, CALINK, CASUB a DTO is encoded to its record's EBCDIC bytes by its field comments and compared through the log's layout, by offset. Null fields bound the known prefix
Harness: a level-2 RETURN did not carry the LINK LENGTH (the caller sees LENGTH bytes) CALINK, CASUB CicsTask records it; the runner uses it
Harness: a PIC X(32767) COMMAREA has no DTO CAXA a String / byte[] COMMAREA is compared as its bytes; the porting rule says so
The model's own error: an ambiguous sendMap(..., null) PCDETL the model fixed it from the proof feedback

What changed

  • tests/tools/cics_crucible.py:
    • A java-ported side: the generated project with each case's committed ports laid over it (tests/cics_crucible/ports/<case>/<PROGRAM>/overlay), re-proven on every run.
    • Proof mode for port_runner prove --command: --ports, --overlay {port_dir}, --program, --report-dir {report_dir}. It writes report.json with per-scenario results and a feedback text (first divergence, operator steps, the expected event there, what the port recorded, compile errors).
    • The existing java side still measures the unported generator output.
  • port_runner run --feedback: the next attempt gets the last failed proof's feedback and that port. Each proposal logs ticket_sha256, prompt_tokens and feedback_from.
  • Porting rules:
    • EIBTRMID and EIBTIME / ASKTIME;
    • the condition / abend rule;
    • COMMAREAs with no DTO;
    • the clock rule for CICS.
  • Committed ports: 17 overlays with provenance.json (model, backend command, attempt, ticket hash, notes, full attempt history, proof) and a NOTICE. The crucible is Apache-2.0.
  • A fixture scaffolding port, hand-written test code for the runner's own fixture, so the E2E test covers java-ported.
  • Baseline and report regenerated: java-ported 37 / 37 pass.

Checks

  • ruff_audit / mypy_audit / dead_key_audit --ci: no new findings (feedback allowlisted as a proof-report key).
  • ruff format on touched files.
  • tests/cics_crucible, tests/cobol_mainframe, tests/cultural_gauntlet.
  • Full crucible run with --update-baseline.

Generated output changes: CicsTask (termid, abend exits, LINK length at RETURN), CobolEdit / CobolRecords now present in CICS estates without VSAM, and ticket rule text. java-compile's --same-as will see the change and build.

🤖 Generated with Claude Code

… java-ported side

Claude Opus 5.5 (port_runner's command backend, Claude Code print mode with no tools)
ported every crucible program's runTask. tests/tools/cics_crucible.py proves each
port as port_runner prove's command. All 17 are proven: 9 at attempt 1, 7 at
attempt 2 and 1 at attempt 3. The new java-ported side passes 37 of 37 cells.

Every failure was fixed in gitgalaxy, never in a port:
- CicsTask: EIBTRMID (termid); HANDLE ABEND's upward exit search across LINK levels
  (handleAbend / abend / abendOnCondition / abendExit, PUSH / POP); the LINK LENGTH
  on a level-2 RETURN.
- The generator emits CobolEdit / CobolRecords for CICS estates. The rules require
  them even when the estate has no VSAM entities.
- Porting rules: EIBTRMID and ASKTIME, condition / abend handling, and COMMAREAs
  with no DTO.
- Harness: a DTO is compared as its record's bytes; String / byte[] COMMAREAs.
- port_runner run --feedback: the next attempt gets the failed proof's first
  divergences and the failed port. Each proposal logs its ticket hash.

The proven ports are committed with their provenance under tests/cics_crucible/ports.
None is approved.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
Comment on lines +132 to +133
"The equivalence harness ran it against the expected behaviour. What it found, per scenario that did not"
" pass (the first divergence only: later ones may hide behind it):",
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 43b3045 into main Sep 29, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the feat/3989-crucible-ports branch September 29, 2026 22:31
squid-protocol added a commit that referenced this pull request Sep 30, 2026
…on ignore rule

PR #4025 described committing provenance.json with each crucible port (model, backend, attempt,
ticket hash, attempt history), but .gitignore's blanket *.json dropped every one; they survived only
in that PR's worktree. Copied back unchanged, and the ignore rule now admits them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
squid-protocol added a commit that referenced this pull request Sep 30, 2026
…and the tooling it needed (#4040)

* The porting loop on CardDemo: an unattended model proves 5 programs, and the tooling it needed

tests/tools/porting_loop.py drives port_runner end to end on one equivalence case. A model
(Claude Code headless: no tools, no MCP, run in the attempt's own directory, so it sees only
the ticket's prompt) ports the program. The harness proves it: every output / event / CALL and
every fault run. A failed proof's findings are the next attempt's feedback.

Results (Claude Sonnet 5.5):
- INTCALC (CBACT04C): attempt 1, 19 fault runs.
- POSTTRAN (CBTRN02C): attempt 1, 28 fault runs.
- TRANREPT (CBTRN03C), new case: attempt 1, 447 report lines, 24 fault runs.
- COMEN01C, new CICS case: attempt 1, 11 scenarios.
- CSUTLDTC, new CALL case: attempt 2, 11 CALLs through CEEDAYS.
Details, and what each failure taught: docs/language_status/porting_loop.md.

The failures were in what we gave the model; each is fixed here:
- the prompt lists CobolFiles / CobolAbend, and the file-status rule states return types;
- CobolFiles.writeKeyed / rewriteKeyed: a KSDS WRITE of an existing key is 22, not save();
  rule on record copies and silent READ errors;
- the CICS equivalence test sets the task's clock (task.now() was null);
- a CALLed program's BY REFERENCE elementary item is a CobolRef<T>, and handleCall /
  call<Target> return the RETURN-CODE (the void/String signature could not be correct);
- new case kind "call" (equivalence_call.py) and a documented CEEDAYS model
  (tests/equivalence/le/ceedays.c) that refuses what IBM's docs don't settle;
- EXEC CICS INQUIRE PROGRAM in the translator, stub and CicsTask, injectable like READ;
- proof feedback in report.json: first differing records / events, failing fault runs,
  compiler / test errors once each with the port's own frames.

New cases: carddemo-trnrpt (its last transaction out of range, so the program's NEXT SENTENCE
defect is proven), carddemo-menu, carddemo-dateutil. Each has the loop's port, unedited, with
port/provenance.json. .gitignore now admits equivalence case.json and provenance.json.
Filed along the way: #4037 (reserved-word column), #4031 (engine END- paragraphs).

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

* porting-loop skill + CLAUDE.md pointer: how to run the loop, read a failure, build a case

The `porting-loop` skill records the loop's workflow and what this round taught:
- how to run it (JDK 17, the corpora cache, the no-tools headless model, parallelism);
- a table for deciding who owns a failure (ticket, harness, runtime, generator, model, case), with the fix each
  round made;
- how to build a case worth measuring (faults, coverage gaps, IBM services modelled only where documented);
- how to commit a proven port with provenance;
- the environment traps.

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

* Restore the 17 CICS crucible ports' provenance.json, lost to the *.json ignore rule

PR #4025 described committing provenance.json with each crucible port (model, backend, attempt,
ticket hash, attempt history), but .gitignore's blanket *.json dropped every one; they survived only
in that PR's worktree. Copied back unchanged, and the ignore rule now admits them.

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

* Guard: fail when a committed port's provenance.json or a case's case.json is missing (the *.json ignore trap)

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

* Break the equivalence <-> equivalence_call import cycle (CodeQL): shared pieces live in equivalence_common

CodeQL flagged equivalence.py importing equivalence_call, which imported equivalence back for
diff_records and java_failure_report. equivalence_cics had the same back-import for the failure
report. The harness already keeps what every module shares in the leaf module equivalence_common
("no cycle; re-exported here"), so the record diff (diff_records with its two helpers) and
java_failure_report move there verbatim, and equivalence.py re-exports them. The submodules now
import only equivalence_common. No behaviour change: the harness tests pass, and the CALL case
and a batch case with fault runs still prove end to end.

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

* #4040: decode logs through source_text.decode_bytes (the #3813 guard), not errors=replace

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

---------

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.

2 participants