Skip to content

fix(det): refuse accepted-but-ignored CICS options and swallowed parse errors (#4411) - #4432

Merged
squid-protocol merged 4 commits into
mainfrom
fix/4411-det-refusals
Oct 5, 2026
Merged

squid-protocol merged 4 commits into
mainfrom
fix/4411-det-refusals

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4411.

The det translator no longer accepts input and then ignores it. Each such path now refuses by name: a statement hole, or a refusal of the whole program when there is no statement to hang the hole on.

Refusals added (4 kinds)

  1. CICS options (det/cics.OPTIONS, check_options). Each modelled EXEC CICS command lists the options it honours. Any other option is a hole: <verb> <opt>: option not modelled. The check runs before any operand work. The table gives the reason for every option it accepts that has no code of its own: NODUMP; MAIN/AUXILIARY/NOSUSPEND on TS; EQUAL on READ; GTEQ on STARTBR, which is its default; NOHANDLE where no condition is raised. Newly refused: RETURN IMMEDIATE; READ GTEQ/GENERIC/TOKEN; STARTBR/READNEXT/ENDBR GENERIC/REQID; LINK SYNCONRETURN/DATALENGTH/SYSID; ASSIGN beyond APPLID, SYSID, ABCODE, PROGRAM and INVOKINGPROG; FORMATTIME forms it does not write (DAYOFMONTH, YYDDD, MILLISECONDS …); RECEIVE MAP ASIS/TERMINAL; READQ TS SET; INQUIRE PROGRAM STATUS; SEND TEXT CURSOR(value)/CTLCHAR(value); a TD option after WRITEQ, which used to be read as TS; RESP on ASKTIME, FORMATTIME and HANDLE ABEND, whose area was never written.
  2. KEYLENGTH and the length on a read.
    • KEYLENGTH is accepted only when it is the file's full key: a known value (a literal, LENGTH OF x, or a VALUE never written) on a file the generated project maps. A shorter key would be generic; any other mismatch is INVREQ.
    • READ/READNEXT/READPREV LENGTH is accepted only when it equals the INTO area's own length. LENGERR and the returned length are not modelled.
  3. Parse errors in det/stmt.parse.
    • An ERROR or MISSING node outside the procedure_division node now refuses the program (the PROCEDURE DIVISION does not parse at line N). On main this dropped code silently: ENTRY 'DLITCBL' USING PAUTBPCB (DBUNLDGS, PAUDBLOD, PAUDBUNL) translated to zero statements; PERFORM P2 THRU., CALL 'X' USING BY REFERENCE. and SET A TO. each lost every statement after them.
    • An error nested inside a statement is a hole (MOVE ALL TO A. used to be a MOVE).
    • An error in an IF, EVALUATE or WHEN header becomes an unparsed condition. The frame still opens, so the END-x that follows pairs correctly.
    • An error in a paragraph or section header, a phrase or an END-x refuses the program.
  4. Parse errors in det/layout.parse. An ERROR or MISSING inside a data entry is a LayoutError; before, it was skipped because the walk stopped at data_description. An unquoted VALUE word that is not a number (VALUE NULL) is refused instead of being stored as its text.

Tests (tests/cobol_mainframe/test_det_translate.py, 68 pass):

  • one test per refused option;
  • the KEYLENGTH and LENGTH rules, plus "full key and INTO length translate exactly as before";
  • an audit test: every option of every modelled command in IBM's API reference is either in OPTIONS or refused, and every accepted option is either read by the code or stated;
  • the four parse-error programs above (each raises), and the nested-error hole.

Ported programs: 51 of 55 cases translate byte-identically

det_port.py check against origin/main (--typed) gives 51/55 ports unchanged. That covers every carddemo, cbsa and mortgage case and 7 of 11 genapp cases, so none of these needs a re-proof. That includes the committed port_invariance ports (DBCRFUN, INQACC, UPDCUST, LGAPVS01 …).

Now refusing (previously proven). These two programs show up in 4 cases:

case program reason
genapp-lgucvs01, genapp-lgucdb01 (LINKs it) LGUCVS01 READ … LENGTH(WS-Commarea-Len), set from EIBCALEN: an EIBCALEN shorter than the record is LENGERR in CICS; the port returned NORMAL
genapp-lgupvs01, genapp-lgupdb01 (LINKs it) LGUPVS01 the same READ LENGTH

I re-ran all four with det_port.py run. Each now stops at the hole as intended (Hole: line 69: EXEC CICS: READ LENGTH(WS-Commarea-Len): not INTO's length …), so their proofs no longer hold. Modelling READ LENGTH (LENGERR plus the length returned), and the oracle side to match, would get them back. That is a follow-up if wanted.

Left open, needs direction. RESP/RESP2 on SYNCPOINT ROLLBACK is still accepted and still never written. It is used by CBSA DBCRFUN, INQACC and XFRFUN, and DBCRFUN and INQACC are committed port_invariance ports. Fixing it, whether by modelling it or refusing it, changes their translation, so I did not change it. The table marks it.

Corpora beyond the ports (#4378 bake-off set, current front end):

  • 18 of the 149 unported programs now carry option refusals. The most common: RETURN IMMEDIATE 16, LINK SYNCONRETURN 14, READ GTEQ 3, TOKEN 4, RECEIVE ASIS 4.
  • 9 unported programs and 5 estate-crucible programs are now refused for parse errors outside the PROCEDURE DIVISION, including DBUNLDGS, PAUDBLOD, PAUDBUNL and CRECUST.
  • 5 NIST programs with errors inside DECLARATIVES are now refused.

Gates: pr_gates.py --fast 5/5 pass. The mainframe det, cics and port tests pass.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits October 5, 2026 07:02
…e errors (#4411)

The det translator now refuses, by name, what it used to accept and ignore:

- det/cics.OPTIONS lists the options each modelled EXEC CICS command honours;
  any other option is a hole ("<verb> <opt>: option not modelled"): RETURN
  IMMEDIATE, READ GTEQ / GENERIC, STARTBR / READNEXT / ENDBR GENERIC / REQID,
  LINK SYNCONRETURN / DATALENGTH / SYSID, ASSIGN beyond its five, FORMATTIME
  forms it does not write, RECEIVE MAP ASIS, READQ TS SET, a TD option read
  as TS, SEND TEXT CURSOR(value) ...
- KEYLENGTH only as the file's full key, a known value on a known file;
  READ / READNEXT / READPREV LENGTH only as the INTO area's own length.
- det/stmt.parse: an ERROR / MISSING node outside the PROCEDURE DIVISION node
  refuses the program (it had dropped whole paragraphs: ENTRY ... USING in
  DBUNLDGS / PAUDBLOD / PAUDBUNL); one nested in a statement is a hole, in an
  IF / EVALUATE / WHEN header an unparsed condition.
- det/layout.parse: an ERROR / MISSING inside a data entry, and an unquoted
  VALUE word that is no number, refuse instead of being read as text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

raise Untranslatable(f"{ref.name}: varies")

self.gp = GP()
def constant_int(self, text: str) -> int | None:
"""An option's value when the translator knows it: an integer literal, LENGTH OF an item, or a data item
with a numeric VALUE the program never changes; else None."""
from gitgalaxy.tools.cobol_to_java.det.gen import Untranslatable
@github-actions

github-actions Bot commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit 12c8ea3 into main Oct 5, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the fix/4411-det-refusals branch October 5, 2026 12:02
squid-protocol added a commit that referenced this pull request Oct 5, 2026
Imports: union of #4412's as_fixed_rows/unwrap and #4430's cobol_parser.
Error lines keep #4412's line_of row map. Tests: keep both blocks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VrujbRefDqQ8ptAwTBQTaz
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.

det translator: accepted-but-ignored CICS options and swallowed parse errors must REFUSE, not translate silently

2 participants