Skip to content

#3821: an equivalence claim names the JVM environments it holds in - #3893

Merged
squid-protocol merged 2 commits into
mainfrom
fleet/3821-harness-environment
Sep 27, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
fleet/3821-harness-environment

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3821 (epic #3819). This is the harness half of the region-level Cultural Gauntlet (#3834).

Problem: the equivalence harness's Java side inherited the host's locale and time zone. So a port that uses the default locale (for example String.format("%06d", n) without Locale.ROOT) passed on an en-US machine and printed Thai or Arabic-Indic digits in production. The claim "COBOL equals Java" never said which environment it held in.

What changes (tests/tools/equivalence*.py)

  • The environment is set before Spring starts. The generated EquivalenceRunTest sets Locale.setDefault(Locale.forLanguageTag(...)) and TimeZone.setDefault(...) from -Dequivalence.locale / -Dequivalence.tz in a static block.

  • Named environments. equivalence_java.ENVIRONMENTS defines:

    name locale time zone
    default en-US UTC
    turkish tr-TR Europe/Istanbul
    arabic ar-EG Africa/Cairo
    thai th-TH-u-nu-thai Asia/Bangkok
    german de-DE Europe/Berlin
    hindi hi-IN Asia/Kolkata

    Any LOCALE/TZ can also be written directly. default pins what used to be inherited from the host. The mainframe's own zone is still the case's zone (gitgalaxy.zone, Time zones: the pinned clock has no zone; CURRENT-DATE's UTC offset follows the process TZ; harness sides can run in different zones #3824), which these settings don't touch.

  • One build, many runs. equivalence.py run <case> --environments all|NAME,NAME|LOCALE/TZ, or a case's "environments", builds the project once and runs the Java side in each environment from a fresh work area. Every run is diffed against the single COBOL run. The report lists each environment and whether it is equal. The first environment's outputs remain the report's outputs, as before.

  • The report states the key order it covers: "ASCII / ISO-8859-1 byte order on both sides (GnuCOBOL BDB, H2), not the mainframe's EBCDIC order". Adding EBCDIC order as a dimension is Cultural Gauntlet: the test matrix -- source dialect x data code page x runtime locale/TZ x DB collation x input data #3834's job.

  • Opt-in mixed inputs. Generated inputs accept "generate": {"alphabet": "mixed"}: lower case, national letters (ÆØÅ ÄÖÜß É Ñ Ç) and punctuation, reaching keys too. The default draw is byte-identical to before, and a test pins that.

Proof

  • carddemo-intcalc --environments all: equal to COBOL in all six environments (ACCTFILE 50/50, TRANSACT 50/50, RETURN-CODE 0).
  • Negative control: the same port with Locale.ROOT removed is equal under default and differs under thai and arabic. That is exactly the false pass this issue describes, and it is now caught. Both runs are E2E tests in the new tests/cobol_mainframe/test_equivalence_environments.py, alongside 5 unit tests.
  • The existing equivalence, CICS, inputs, dates, regional-options and time-zone tests pass with EQUIVALENCE_E2E=1: 92 passed.
  • pr_gates.py --fast: 5/5 pass.

Not in this PR

🤖 Generated with Claude Code

squid-protocol and others added 2 commits September 27, 2026 11:28
The Java side inherited the host's locale and time zone, so a port that
formats with the default locale passed on an en-US machine and was wrong
under Thai or Arabic digits. The generated EquivalenceRunTest now sets the
default locale (BCP-47) and time zone from system properties in a static
block, before Spring starts; the harness pins `default` (en-US, UTC) and can
run one build under many environments -- `--environments all|NAME,..|
LOCALE/TZ` or a case's "environments" -- each diffed against the one COBOL
run. The report states the environments and the key order the claim
covers (ASCII / ISO-8859-1 on both sides). Generated inputs gain an opt-in
`"alphabet": "mixed"` (lower case, national letters, punctuation); the
default draw is unchanged.

carddemo-intcalc holds under default, turkish, arabic, thai, german and
hindi; the same port without Locale.ROOT passes under en-US and fails
under thai -- the false pass this issue is about, now caught.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@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 28729bf into main Sep 27, 2026
29 checks passed
@squid-protocol
squid-protocol deleted the fleet/3821-harness-environment branch September 27, 2026 15:40
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.

Equivalence harness is a single-culture oracle: add an environment dimension (JVM locale, TZ, collation) and culture-aware inputs

1 participant