Repository navigation
#3821: an equivalence claim names the JVM environments it holds in - #3893
Merged
Merged
Conversation
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]>
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)withoutLocale.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
EquivalenceRunTestsetsLocale.setDefault(Locale.forLanguageTag(...))andTimeZone.setDefault(...)from-Dequivalence.locale/-Dequivalence.tzin a static block.Named environments.
equivalence_java.ENVIRONMENTSdefines:defaultturkisharabicthaigermanhindiAny
LOCALE/TZcan also be written directly.defaultpins what used to be inherited from the host. The mainframe's own zone is still the case'szone(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'soutputs, 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).Locale.ROOTremoved is equal underdefaultand differs underthaiandarabic. That is exactly the false pass this issue describes, and it is now caught. Both runs are E2E tests in the newtests/cobol_mainframe/test_equivalence_environments.py, alongside 5 unit tests.EQUIVALENCE_E2E=1: 92 passed.pr_gates.py --fast: 5/5 pass.Not in this PR
equivalence_cics.py) doesn't take--environmentsyet.🤖 Generated with Claude Code