Skip to content

Fix #4001: BMS output fidelity in the stub and CicsTask (9 cobol-stub cells) - #4021

Merged
squid-protocol merged 1 commit into
mainfrom
fix/4001-bms-output-fidelity
Sep 29, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/4001-bms-output-fidelity

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 29, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4001
Part of #3989 (phase 3, lane A)

What changed

The harness's BMS model is a new file, tests/tools/cics_bms.py. It is the harness's own reading of BMS, independent of the engine's parser. It reads the BMS source (DFHMSD / DFHMDI / DFHMDF, including column-72 continuations, quoted INITIALs with '' and commas, and DSATTS) and resolves a SEND MAP the way BMS builds the output screen (crucible SPEC 6.3, IBM "Building the output screen" and "SEND MAP"):

  • Attribute: the program's byte, unless MAPONLY is given or the byte is one of the four no-attribute values X'00', X'80', X'02' and X'82'. Otherwise, without DATAONLY, the DFHMDF ATTRB goes through the 3270 graphic table (GA23-0059). An omitted ATTRB means (ASKIP,NORM); an ATTRB with no protection means unprotected. Otherwise nothing is sent.
  • Data: the program's data when its first byte is not null. Otherwise, without DATAONLY, the map's INITIAL. Otherwise none.
  • Extended attributes: colour and highlight come from the program's byte (not X'00'). Otherwise, without DATAONLY, they come from the field's COLOR / HILIGHT, then the map's, then the mapset's. They apply only under DSATTS.
  • DATAONLY omission: a field BMS sends nothing for is left out.
  • Cursor: CURSOR(n) gives {"offset": n}. CURSOR alone gives the first field whose length is -1 (symbolic cursor positioning). Otherwise, without DATAONLY, it is the IC field.
  • RECEIVE MAP input: transmitted data is justified per JUSTIFY (NUM means right-justified and zero-filled). A field sent empty (ERASE EOF) comes back with length 0 and DFHBMEOF (X'80').

Stub side (cobol-stub)

  • EBCDIC comparison: tests/equivalence/cics/DFHBMSCA.cpy now holds each constant as its EBCDIC byte: DFHBMPRO is X'60', not the ASCII -, and DFHRED is X'F2', not 2. A DFHBMSCA name, a hex literal (MOVE X'3C' TO RAWA) and bit arithmetic (DFHBMUNP + 1 = X'41') therefore all give the byte a mainframe holds. Attribute, colour and highlight bytes are compared as those EBCDIC bytes; data is transcoded from the runtime's page as before.
  • Cursor value: the translator passes CURSOR(n) in GG-LEN (-1 when no value is given), and GGCSMAP logs cursor=.
  • Runner:
    • cics_crucible.Screen decodes the symbolic map (<f>L, <f>F/A, <f>C, <f>H, <f>O) and resolves it through the model.
    • RECEIVE MAP input is built from the BMS field definitions (Screen.receive_input) instead of equivalence_cics.map_input. CardDemo keeps map_input unchanged.
    • COBOL_CAPS models every SEND-MAP key, field key and DATAONLY omission.

Java side (CicsTask)

  • The new API is sendMap(map, mapset, screen, MapSubfields, String... options). CicsTask.MapSubfields holds attr / color / hilight as EBCDIC byte values, length (cursor(field) sets it to -1) and cursorAt(offset). sendMap(map, screen) still works.
  • The runner resolves the recorded event through the same model (java_send_map), and JAVA_CAPS models every SEND-MAP key.
  • The port tickets describe the API.

Crucible cells

Before is main at 99450e5 (after #4006); after is this branch, rebased there.

side pass fail unsupported
engine-facts 10 → 10 0 0
forge-compile 10 → 10 0 0
cobol-stub 24 → 33 1 → 1 12 → 3
java 0 37 → 37 0
all 44 → 53 38 → 38 12 → 3

Generated output

java_target_matrix.py --same-as origin/main on CardDemo (default) reports exactly one changed build input, cics/CicsTask.java. The change is intended: it adds sendMap(map, mapset, screen, MapSubfields, options...) and MapSubfields. Forge-compile passes in all 10 crucible cases. No golden-master fixtures change.

Tests

  • tests/cics_crucible/test_cics_bms.py (new, no Docker or JDK) covers:
    • BMS parsing: continuations, quotes, defaults and DSATTS;
    • the ATTRB → byte table, checked against SPEC 6.3's encodings;
    • program vs map values: no-attribute bytes, the null first byte, colour fallback field → map → mapset;
    • MAPONLY, DATAONLY omission, and symbolic / offset / IC cursor;
    • input justification.
  • test_cics_crucible_runner.py covers the stub's symbolic-map bytes resolved into fields and cursor, justified and erased RECEIVE MAP input, and a CicsTask SEND-MAP event resolved like the stub's.
  • test_cics_endpoints.py checks that the generated CicsTask has the new API.

Verification

  • cics_crucible.py --ci is green against the lowered baseline: 53 pass, 38 fail, 3 unsupported.
  • With EQUIVALENCE_E2E=1, tests/cics_crucible, test_equivalence_cics.py and test_cics_endpoints.py pass 85 of 85. The CardDemo account view is still equal on every event with the EBCDIC DFHBMSCA stand-in.
  • The BMS source is read through gitgalaxy.core.source_text.read_source, and CicsTask text becomes EBCDIC with X'3F' (SUB) for a character CCSID 037 lacks, never a lossy errors= (Decoding foundation: read_source (BOM / strict UTF-8 / UTF-16 / declared / cp1252-Latin-1 fallback), per-file source_encoding, no errors=ignore anywhere (lint gate) #3813's guard, tests/test_source_reads.py).
  • The ruff, mypy and dead-key audits show no new findings. ruff format is clean on the touched files, and tool_regex_redos --ci reports 0 offenders. The BMS reader uses no regexes; it scans characters.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol force-pushed the fix/4001-bms-output-fidelity branch 4 times, most recently from 4e3fbb9 to 9f544f9 Compare September 29, 2026 19:48
… cells)

A new harness BMS model (tests/tools/cics_bms.py) reads the BMS source
(DFHMSD / DFHMDI / DFHMDF with continuations) and resolves a SEND MAP the way
BMS builds the output screen (crucible SPEC 6.3): each field's attribute from
the program's byte unless MAPONLY or the byte is X'00'/X'80'/X'02'/X'82', else
the DFHMDF ATTRB (3270 graphic encoding); data from the program unless its
first byte is null, else the map INITIAL; colour / highlight from the field,
then the map, then the mapset; DATAONLY omits fields BMS sends nothing for;
the cursor from CURSOR(n), symbolic positioning (length -1 + CURSOR) or IC.
RECEIVE MAP input is justified per JUSTIFY / NUM, and an erased field comes
back with length 0 and DFHBMEOF.

Stub side: the DFHBMSCA stand-in holds each constant as its EBCDIC byte, so
names, hex literals and bit arithmetic give mainframe bytes, compared as
EBCDIC; the translator passes CURSOR's value and the stub logs it; the runner
decodes the symbolic map (L, F/A, C, H, O) and resolves it through the model.

Java side: CicsTask.sendMap(map, mapset, screen, MapSubfields, options...)
records the mapset, sorted options, per-field attribute / colour / highlight
bytes and lengths, and CURSOR(n); the runner resolves it through the same
model. The port tickets describe the API.

Unlocks hx-attr-bytes (3), hx-extended-cursor (3) and pc-wizard (3)
cobol-stub cells: 53 pass, 38 fail, 3 unsupported on main after #4006.

Part of #3989.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01EC8FWfn3aPmsUPnRgKNVup
@squid-protocol
squid-protocol force-pushed the fix/4001-bms-output-fidelity branch from 9f544f9 to 1d73d61 Compare September 29, 2026 20:10
@squid-protocol
squid-protocol merged commit 4bae5b9 into main Sep 29, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the fix/4001-bms-output-fidelity branch September 29, 2026 20:22
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.

CICS harness: BMS output fidelity in the stub and CicsTask (unlocks 6 cobol-stub cells, all hx-*)

1 participant