Skip to content

Java conversion: a porting ticket for every program with business logic, by default (#3752) - #3762

Merged
squid-protocol merged 2 commits into
mainfrom
feat/porting-tickets-3752
Sep 26, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
feat/porting-tickets-3752

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3752 (epic #3755). This is the foundation for the bring-your-own-LLM porting loop (#3753).

Problem

Every generated program leaves business logic to write (CardDemo: 44 stubbed services, 165 business-logic worklist items). But no program got a porting ticket by default: the old ticket stage only ran in --var slicing mode, so CardDemo got 0.

Change

cobol_to_java_port_tickets.py writes one ticket per program with business logic, on every skeleton-driven run: ai_agent_jobs/<KEY>_port_ticket.json plus a Markdown twin.

part contents
target the service to fill, its public methods (which are still TODO), the overlay path the port lands on, and the chosen target stack (Java / Spring Boot / DB / integration / UI), so the port follows the customer's configuration
source numbered listings (cols 1-72) of the program and its copybooks, written once under ai_agent_jobs/sources/ and referenced; paragraphs from the engine's units
facts the verified skeleton sections, each with field-testing status
generated the classes the service imports (entities + record codecs, repositories, DTOs, batch runtime) and every artifact the traceability manifest ties to the program
worklist this program's items
rules the porting rules proven by the #3624 slice (truncation / high-order loss, keep behaviour including defects, use the generated API, abend → exception)
deliverable one complete Java file for the overlay, proven by the equivalence harness, approved by a person

Linking: the migration worklist (JSON and Markdown) links each program's items to its ticket.

Size: listings are shared, because an include member is used by hundreds of DSF programs. DSF's tickets went from 103 MB to 46 MB, of which 29 MB is the source itself. publish_examples leaves the listings out of the public examples, since they are the pinned source and are regenerated with the tickets.

Result: CardDemo 44 tickets (was 0); DSF 438.

Verification

  • Tests: test_port_tickets.py runs a real scan of a small estate. It pins the ticket contents, the absence of paths and credentials, the listings, the worklist link, and byte-identical tickets across two runs.
  • Suite and gates: mainframe suite 669 passed; the full suite passed before the listing change; preflight passes.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

…ic, by default (#3752)

Every generated program leaves business logic to write, but no program got a
porting ticket by default: the ticket stage needed `--var` slicing, so
CardDemo got 0.

New cobol_to_java_port_tickets writes one ticket per program with
business-logic worklist items, on every skeleton-driven run
(features.agent_tickets):
ai_agent_jobs/<KEY>_port_ticket.json plus a Markdown twin. A ticket holds:
- the target: the service to fill, its public methods and which are still
  TODO, the overlay path a port lands on, and the chosen target stack (Java
  / Spring Boot / database / integration / UI; no local paths or
  credentials);
- the source: numbered listings (columns 1-72) of the program and its
  copybooks, written once each under ai_agent_jobs/sources/ and referenced
  (DSF's shared includes took tickets from 103 MB to 46 MB), and its
  paragraphs;
- the facts: the verified skeleton's sections, with field-testing status;
- the generated classes it builds on: those the service imports (entities
  with codecs, repositories, DTOs, the batch runtime) and every artifact the
  traceability manifest ties to the program;
- its worklist items, the porting rules the #3624 slice proved, and the
  deliverable (one Java file, proven by the equivalence harness, approved by
  a person).

The worklist links each program's items to its ticket, JSON and Markdown.
Result: CardDemo gets 44 tickets (previously 0), DSF 438.

publish_examples leaves ai_agent_jobs/sources/ out of the published
examples: the listings are the pinned source, regenerated with the tickets.

Tests (test_port_tickets.py, a real scan) pin a ticket's contents, the
worklist link and determinism across two runs.

Part of epic #3755. Closes #3752

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
@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 9d393fc into main Sep 26, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the feat/porting-tickets-3752 branch September 26, 2026 16:42
squid-protocol added a commit that referenced this pull request Sep 26, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

# Conflicts:
#	gitgalaxy/tools/cobol_to_java/cobol_to_java_port_tickets.py
squid-protocol added a commit that referenced this pull request Sep 26, 2026
…arness proves (#3753) (#3763)

* Java conversion: a porting ticket for every program with business logic, by default (#3752)

Every generated program leaves business logic to write, but no program got a
porting ticket by default: the ticket stage needed `--var` slicing, so
CardDemo got 0.

New cobol_to_java_port_tickets writes one ticket per program with
business-logic worklist items, on every skeleton-driven run
(features.agent_tickets):
ai_agent_jobs/<KEY>_port_ticket.json plus a Markdown twin. A ticket holds:
- the target: the service to fill, its public methods and which are still
  TODO, the overlay path a port lands on, and the chosen target stack (Java
  / Spring Boot / database / integration / UI; no local paths or
  credentials);
- the source: numbered listings (columns 1-72) of the program and its
  copybooks, written once each under ai_agent_jobs/sources/ and referenced
  (DSF's shared includes took tickets from 103 MB to 46 MB), and its
  paragraphs;
- the facts: the verified skeleton's sections, with field-testing status;
- the generated classes it builds on: those the service imports (entities
  with codecs, repositories, DTOs, the batch runtime) and every artifact the
  traceability manifest ties to the program;
- its worklist items, the porting rules the #3624 slice proved, and the
  deliverable (one Java file, proven by the equivalence harness, approved by
  a person).

The worklist links each program's items to its ticket, JSON and Markdown.
Result: CardDemo gets 44 tickets (previously 0), DSF 438.

publish_examples leaves ai_agent_jobs/sources/ out of the published
examples: the listings are the pinned source, regenerated with the tickets.

Tests (test_port_tickets.py, a real scan) pin a ticket's contents, the
worklist link and determinism across two runs.

Part of epic #3755. Closes #3752

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

* Port tickets: each porting rule one parenthesised string (CodeQL implicit concatenation, #3762)

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

* WIP #3753: porting loop, harness --port / RETURN-CODE, POSTTRAN case, MainframeClock

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

* Porting loop: harness stages sequential inputs, FILLER counted apart, CobolRecords in the prompt (#3753)

- equivalence_java: a sequential input dataset (no entity) is copied into the datasets
  directory the program opens it from; CBTRN02C's DALYTRAN was never there.
- equivalence: a FILLER difference is counted apart (filler_differs) and shown in the report,
  not failed: no program can name it; after INITIALIZE it holds the runtime's leftover record area.
- port_runner: the prompt always carries the runtime helpers (DatasetResolver, MainframeClock,
  CobolRecords); a re-proof of an attempt starts from a clean report dir; lint (X | None, S310).
- port tickets: a rule to decode/encode zoned, COMP-3 and COMP fields only through CobolRecords
  or the entity codecs, never a hand-written decoder.

With these, Gemini 3.1 Pro (via agy, the command backend) ported CBACT04C and CBTRN02C and both
were proven by the harness: ACCTFILE 50/50, TRANSACT 50/50; ACCTFILE 50/50, TCATBALF 100/100,
TRANFILE 262/262, DALYREJS 38/38, RETURN-CODE 4 = 4.

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

* Docs: the COBOL-to-Java porting loop and its measured CardDemo rounds (#3753)

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

* Porting loop: backend URL must be http(s); allowlist the two keys external documents write (#3753)

- port_runner._post refuses any scheme but http/https before urlopen (Muninn
  dynamic-urllib-use-detected; nosemgrep as in templates/bitbucket, now with a real guard).
- dead_key_audit: "choices" (the chat completion response) and "equal" (the harness's
  report.json) are written outside gitgalaxy/.

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

* Porting loop: an API key goes only over https (or http to localhost) and never follows a redirect (#3753)

urllib follows a POST's 301/302/303 and forwards every non-content header -- the
Authorization / x-api-key included -- to the new location; the backends now use an opener
that refuses redirects. Plain http is accepted only to a loopback host (a local vLLM /
Ollama), so a key never crosses a network unencrypted; file: and custom schemes are refused.
Tests: a real local server answering 302 gets exactly one request and the call fails.

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]>
squid-protocol added a commit that referenced this pull request Sep 30, 2026
… implicit concatenation)

CodeQL's py/implicit-string-concatenation-in-list flagged four report paragraphs split over
several source lines inside a list (alerts 1205-1208). Each is now one parenthesised string, as
#3762 did for the porting rules. The generated text is unchanged: the crucible report regenerated
from the same results is byte-identical.

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
…CardDemo, cobol4j) (#4027)

* #4023: COBOL paragraph / branch coverage per program, for the CICS crucible, CardDemo and cobol4j

A proven port only proves the paths its scenarios run. tests/tools/cobol_coverage.py
says which ones those are. The COBOL is compiled with cobc -ftraceall and run with
COB_TRACE_FILE. Per program it reports the live paragraphs and sections entered, the
IF / EVALUATE outcomes taken, and the HANDLE labels entered. Dead code (the engine's
reachability: procedure_units / reachable_units) is listed apart from code no scenario
reaches. Branch points come from the original source, and a trace line maps back
through a difflib alignment, so the CICS translator's rewritten lines and its own IFs
are handled. An IF whose arms cannot be told apart by (line, verb) is listed as
unresolvable, not guessed.

- CICS crucible: the cobol-stub side is traced. The report has a COBOL coverage section
  with each ported program's claim ("proven on N scenarios, covering X/Y paragraphs and
  A/B branches") and the live code no scenario reaches (scenarios to propose).
  tests/cics_crucible/coverage.json holds what each passing scenario executes, and --ci
  ratchets it. A port proof (--report-dir) carries its claim.
- CardDemo (equivalence.py, batch and CICS): each run writes coverage.json, and the
  report gives the claim when proven.
- cobol4j: `cobol_coverage.py autotest` runs at_extract cases under GnuCOBOL with shims
  for ${COMPILE} / java.

The trace also shows units the engine's unit reader misses: non-ASCII names, and
paragraphs named END-... (#4026, field-testing D036). They are reported as "unread",
not counted.

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

* #4023: freeze cobol_coverage.py with the trial harness; tidy the report section

Every equivalence run now goes through tests/tools/cobol_coverage.py, so it belongs in
trial.py's HARNESS_PATHS with the rest of the frozen harness. The harness report's
coverage section no longer repeats a blank line.

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

* #4023 follow-up: prove error paths too -- file / CICS fault injection on both sides of the equivalence harness (#4029)

A proof only covered the success path. CardDemo's programs are mostly error handling (file status
checks, abends, RESP arms), and the normal run reaches about half their branches. A case's faults
now inject the same condition on both sides, at the same statement. Each fault run is proven like
the normal run.

- GnuCOBOL: tests/equivalence/faults/ggfault.c is preloaded in front of libcob's file I/O
  (OPEN / CLOSE / READ / WRITE / REWRITE / DELETE / START). A planned statement returns its FILE
  STATUS and I/O exception instead of running. ggabend.c is CEE3ABD: it records ABEND Unnnn.
- Java: the generated batch runtime gains CobolFiles (one call per I/O statement: the status the
  COBOL would see, plus the same plan and counting) and CobolAbend. CicsTask gains read(file, lookup)
  and withFaults. The CICS stub's READ reads the same plan.
- Porting rules: an abend is CobolAbend.user; every batch I/O statement goes through CobolFiles;
  a CICS file READ goes through task.read, with every RESP arm ported.
- The harness: faults in case.json (batch) or a scenario (CICS), --faults. A run is proven when
  both sides abend with the same code, or neither does and RETURN-CODE and outputs are equal, and
  the same faults fired (at least one).
- INTCALC: 19 faults, the port rewritten onto CobolFiles. All 20 runs are proven, and COBOL
  coverage goes from 46/86 to 82/86 branches and 20/22 to 22/22 paragraphs. The 4 outcomes left
  are data gaps or unreachable. ACCTVIEW: 6 fault scenarios, the port's WHEN OTHER arms ported,
  all 11 scenarios proven, and 39/71 -> 47/71 branches.


Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ

Co-authored-by: Claude Opus 5.5 <[email protected]>

* #4023: each multi-line report string one parenthesised string (CodeQL implicit concatenation)

CodeQL's py/implicit-string-concatenation-in-list flagged four report paragraphs split over
several source lines inside a list (alerts 1205-1208). Each is now one parenthesised string, as
#3762 did for the porting rules. The generated text is unchanged: the crucible report regenerated
from the same results is byte-identical.

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.

Java conversion: a porting ticket for every program with business logic, by default

2 participants