Skip to content

det: PROGRAM COLLATING SEQUENCE in alphanumeric relation conditions (#4539) - #4556

Merged
squid-protocol merged 3 commits into
mainfrom
fix/4539-det-collate
Oct 6, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/4539-det-collate

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

What

The det translator compared alphanumeric operands in byte order whatever the program's PROGRAM COLLATING SEQUENCE, with no warning. Under an EBCDIC or a literal alphabet, nonnumeric relation conditions now go through #4540's Sort.Collating. This covers IF, EVALUATE (conditions and THRU ranges), PERFORM UNTIL and 88 THRU ranges, over items, literals, figurative constants, typed (lifted) items and function results:

  • New Sort.Collating.relation: pads the shorter operand with spaces and takes IBM's order. If IBM and GnuCOBOL order a pair differently, the run stops by name (register D1).
  • New overloads of Cobol.compare* / compareText take the collating; the service gets a COLLATING constant.
  • Numeric comparisons stay by value. National data is already refused by the translator. NATIVE / STANDARD-1 / STANDARD-2 stay byte order.
  • An equality uses the alphabet only when the alphabet has ALSO. Without ALSO every character has its own position, so equal positions mean equal bytes.
  • Refused by name:
    • HIGH-VALUE / LOW-VALUE under a literal alphabet, wherever they appear (MOVE, VALUE, comparison, DISPLAY, STRING, INSPECT). GnuCOBOL's LOW-VALUE is the alphabet's first character. A VALUE clause refuses the whole program through LayoutError.
    • An ordering of an item that holds packed, binary or signed items.
    • A comparison with an ALL literal.
    • An ordinal alphabet.

Proof

  • New PCSEB (EBCDIC), PCSLT (a literal alphabet with ALSO, SPACE, a multi-character literal and descending THRU), PCSS2 (STANDARD-2) and PCSRV (the issue's repro). Each one's output equals GnuCOBOL's in bytes, typed and groups modes.
  • On origin/main, PCSEB, PCSLT and PCSRV differ from GnuCOBOL; PCSS2 matches, as the control.
  • det SORT / MERGE: EBCDIC and literal COLLATING SEQUENCE alphabets (#4268) #4540's SORTCS / SORTPC still pass.
  • Refusal tests: at translation time, and at run time for 'A' vs 'n' under LT, which IBM and GnuCOBOL order differently.
  • Full det and cobolrt tests: 376 pass, none skipped.
  • pr_gates: lint, audits (mypy 2.4.0), secrets, xray, gauntlet and golden pass. In the suite, only test_the_loops_committed_ports_are_proven fails (16 cases), and it fails the same way on a clean origin/main (fac38f6): the provenance text from the 'resurfaced' event.
  • --ratchets: 6/6 pass after merging main (cics-crucible v0.3.0).
  • Det sweep: not run locally. No equivalence case declares a PROGRAM COLLATING SEQUENCE, and without one the change does nothing. CI's det-sweep runs in full.

Notes

  • Engine side: GalaxyIR does not extract ALPHABET or PROGRAM COLLATING SEQUENCE (core/special_names.py leaves them out of scope), and the fact cross-check reads no relation semantics.
  • SEARCH is not translated by det, so there is nothing to change there.
  • DSF PLUKKFR/PLUKKFRN use an alphabet without the ALPHABET keyword. They are already refused at layout.
  • Cobol.compareAll is emitted by gen.py (IF X = ALL 'ab') but does not exist in cobolrt, so that comparison would not compile. This is a separate bug; it is not fixed here.
  • Docs: oracle_assumptions.md, D1 section.

Closes #4539

🤖 Generated with Claude Code

https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR

squid-protocol and others added 3 commits October 6, 2026 03:07
…4539)

The det translator compared alphanumeric operands in byte order whatever the
program's PROGRAM COLLATING SEQUENCE, silently. Now, under an EBCDIC or a
literal alphabet (#4540's Sort.Collating):

- The nonnumeric comparisons of IF, EVALUATE (conditions and THRU ranges),
  PERFORM UNTIL and condition-names (88 THRU ranges) go through
  Sort.Collating.relation: the shorter operand padded with spaces, IBM's
  order taken, operands IBM and GnuCOBOL order differently stopped by name
  (register D1). Items, literals, figurative constants, typed (lifted) items
  and function results alike.
- Numeric comparisons stay by value; national data is refused by the
  translator already. NATIVE / STANDARD-1 / STANDARD-2 stay byte order.
- An equality consults the alphabet only when it has ALSO (otherwise each
  character has its own position).
- Refused by name: HIGH-VALUE / LOW-VALUE under a literal alphabet (MOVE,
  VALUE -- the program --, comparisons, DISPLAY, STRING, INSPECT), an
  ordering of an item holding packed / binary / signed items, a comparison
  with an ALL literal, an ordinal alphabet.

Proof: PCSEB (EBCDIC), PCSLT (a literal alphabet with ALSO and descending
THRU), PCSS2 (STANDARD-2) and PCSRV (the issue's repro) equal GnuCOBOL's
output in bytes, typed and groups modes; on origin/main PCSEB, PCSLT and
PCSRV differ. Refusal tests at translation and run time.

Closes #4539

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine data-integrity Issues relating to RAM state or SQLite database fidelity legacy-modernization COBOL refractor, dead-code extraction, and JCL forging priority: high Core feature broken, but workarounds exist labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review October 6, 2026 09:23
@squid-protocol
squid-protocol merged commit 1b44938 into main Oct 6, 2026
37 of 39 checks passed
@squid-protocol
squid-protocol deleted the fix/4539-det-collate branch October 6, 2026 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine data-integrity Issues relating to RAM state or SQLite database fidelity legacy-modernization COBOL refractor, dead-code extraction, and JCL forging priority: high Core feature broken, but workarounds exist

Projects

None yet

Development

Successfully merging this pull request may close these issues.

det translator: PROGRAM COLLATING SEQUENCE ignored in alphanumeric relation conditions (silent)

1 participant