Skip to content

#3819: culture options in the conversion config -- faithful by default, deviations declared - #3849

Merged
squid-protocol merged 1 commit into
mainfrom
feat/3819-culture-config
Sep 27, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
feat/3819-culture-config

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of epic #3819. This is the configuration layer that the cultural fixes plug into.

What

The COBOL → Java target config (--config modernize.yaml, template from --init-config) gains a culture: section:

culture:
  rounding: cobol          # cobol (ROUNDED = half away from zero, ROUNDED MODE honoured) | half_even
  overflow: cobol          # cobol (high-order digits lost unless ON SIZE ERROR) | error
  zone: UTC                # the mainframe's IANA time zone, e.g. Asia/Kolkata
  format_locale: ROOT      # generated formatting / case mapping (ROOT = locale-proof)
  display_locale: ROOT     # screens only, e.g. hi-IN -- never stored data
  decimal_point: auto      # auto (the program's DECIMAL-POINT IS COMMA) | period | comma
  currency: auto           # auto (CURRENCY SIGN) | the symbol, e.g. "₹"
  key_collation: ebcdic    # ebcdic (mainframe key order) | binary | database
  db2_date_format: iso     # iso | eur | usa | jis | local

Principle: every default reproduces the COBOL program's own behaviour. Anything else is a business choice and gets recorded.

  • Deviations are the choices that change results: banker's rounding, throwing on overflow, a formatting locale, and non-EBCDIC key order. JavaTarget.deviations() lists them, and they appear in java_migration_audit.txt under "Declared cultural deviations".
  • Environment settings describe the site, not a departure from COBOL, so they aren't flagged: time zone, display locale, decimal comma, currency, DB2 date format.
  • application.yml gets gitgalaxy.culture.*, only when a choice is non-default. The default run's output is unchanged, and generated code will read ${gitgalaxy.culture.zone:UTC} and so on.
  • Porting tickets show the culture section in their target config.
  • Validation: an unknown key or bad value is an error naming it. Zones go through zoneinfo, checked by shape only where Python has no tz database (zero-dep). IST is refused as ambiguous (India, Ireland or Israel).

This PR declares the options. Their behaviour lands in the issues each one's TODO names: #3825 (rounding, overflow), #3824 (zone), #3822 (collation), #3827 (decimal point), #3820 (currency), #3828 (DB2 dates).

Verified

  • The new tests/cobol_mainframe/test_culture_config.py covers:
    • the defaults are faithful and change nothing;
    • each bad value names its key;
    • environment settings aren't deviations, and business choices are;
    • --init-config documents every option;
    • a YAML reaches application.yml and the audit.
  • The port-ticket test checks the ticket's culture section.
  • The whole mainframe suite passes (725), and the mypy and ruff audits are clean.

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

…ult, deviations declared

The COBOL -> Java target config gains `culture:` -- rounding, overflow, zone, format_locale,
display_locale, decimal_point, currency, key_collation, db2_date_format. Every default is what
the COBOL program does on its mainframe; a non-default is a business choice.

- java_target: Culture dataclass, validation naming each key (IANA zones through zoneinfo, by
  shape where Python has no tz database; BCP-47 locale tags; an abbreviation like IST is
  refused as ambiguous), the annotated --init-config text, JavaTarget.deviations()
- deviations are business choices that change results (half_even rounding, overflow: error, a
  format locale, non-EBCDIC key order); settings describing the site (zone, display locale,
  decimal comma, currency, DB2 date format) are not
- application.yml: gitgalaxy.culture.* when any choice is non-default (the default run's file is
  unchanged; readers carry the defaults)
- java_migration_audit.txt: "[0] DECLARED CULTURAL DEVIATIONS" when there are any
- porting tickets: the target config shows the culture section
- each option carries a TODO naming the issue that implements its behaviour (#3822, #3824,
  #3825, #3827, #3820, #3828)

Tests: tests/cobol_mainframe/test_culture_config.py; the port-ticket test checks the culture
section. Mainframe suite 725 passed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
@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 19f8e19 into main Sep 27, 2026
37 checks passed
@squid-protocol
squid-protocol deleted the feat/3819-culture-config branch September 27, 2026 00:18
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.

1 participant