Repository navigation
cobolrt: rules as data — declarative tables, specs, docs and test vectors for MOVE, COMPARE, ARITH, STRING, and FUNC (Fixes #4712) - #6950
Merged
Conversation
… and test vectors (Part of #4712) * Declarative standards table: gitgalaxy/standards/cobol/move.py defining categories, Field.Kind mappings, IBM SC26-4940-06 9x9 permissible move matrix, and test vectors. * Generator CLI: gitgalaxy/standards/cobol/cli.py with emit, check, and regen [--check]. * Generated runtime class: MoveSpec.java in cobolrt with category, isPermissible, ruleId, action, and sameZonedShape. * Rendered documentation: docs/language_status/cobol_move_matrix.md. * Fast CI test vectors: tests/cobol_mainframe/test_cobol_move_vectors.py (20 tests passed in 0.10s without requiring Docker). * Catalogue update: docs/language_status/cobolrt_rules.json registers MoveSpec.java under CBL family; cobolrt_rules.py --check passes. Co-Authored-By: Claude Sonnet 3.8 <[email protected]>
…, docs and test vectors (Part of #4712)
…s and test vectors (Part of #4712)
…ocs and test vectors (Part of #4712)
…and test vectors (Part of #4712)
Contributor
| COMPARE_RULES, | ||
| COMPARE_VECTORS, | ||
| ) | ||
| from gitgalaxy.standards.cobol.move import KINDS |
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.
Fixes #4712. Part of epic #4710.
What changed
Expresses COBOL runtime rules as declarative, authoritative data tables under
gitgalaxy/standards/cobol/and generates Java runtime specification classes (cobolrt/), rendered Markdown documentation (docs/language_status/), and fast deterministic test vectors (tests/cobol_mainframe/).Issue #4712 asked to "start with one family" (MOVE or COMPARE). This PR delivers five complete families, covering 45 rules (100% of the FUNC family, and 33 of 46 CBL rules):
gitgalaxy/standards/cobol/move.py)CBL-MOVE-01through11), 9x9 permissible move matrix (81 cells) aligned with IBM SC26-4940-06.MoveSpec.java,docs/language_status/cobol_move_matrix.md, and test vectors.gitgalaxy/standards/cobol/compare.py)CBL-CMP-01through08), 9x9 comparison matrix (81 cells) covering numeric, alphanumeric, figurative, and class comparisons with sign/collating sequence handling.CompareSpec.java,docs/language_status/cobol_compare_matrix.md, and test vectors.gitgalaxy/standards/cobol/arith.py)CBL-ARITH-01through10), 7 rounding modes (ROUNDED [MODE IS ...]), 5 ON SIZE ERROR conditions, intermediate quotient scale formulas, and remainder semantics.ArithSpec.java,docs/language_status/cobol_arith_matrix.md, and test vectors.gitgalaxy/standards/cobol/string_ops.py)CBL-STR-01through04), 4 inspect modes (ALL,LEADING,FIRST,CHARACTERS),BEFORE/AFTERdelimiter phrases, and POINTER / ON OVERFLOW semantics for STRING and UNSTRING.StringSpec.java,docs/language_status/cobol_string_matrix.md, and test vectors.gitgalaxy/standards/cobol/func.py)FUNC-01through12) spanning string manipulation, financial/date, statistical/math, bitwise operations, and national/Unicode conversion.FuncSpec.java,docs/language_status/cobol_func_matrix.md, and test vectors.Tooling & CLI
gitgalaxy/standards/cobol/cli.py(python -m gitgalaxy.standards.cobol).emit [family]: Outputs generated Java specs or Markdown docs to stdout.check: Validates internal consistency across all matrices, rule IDs, and modes.regen [--check | --out]: Regenerates all target files and enforces zero-drift in CI.Invariance & Compatibility
MoveSpec.java,CompareSpec.java,ArithSpec.java,StringSpec.java,FuncSpec.java) are pure specification and matrix query classes incobolrt. No existing deterministic port bytecode or behaviour is altered.docs/language_status/cobolrt_rules.json;tests/tools/cobolrt_rules.py --checkpasses cleanly with zero discrepancies.tests/cobol_mainframe/test_cobol_*_vectors.pyexecute natively in 0.34s without requiring Docker or a local JVM installation.tests/ruff_audit.py --cipasses with 0 new lint findings beyond baseline. All files include PolyForm Noncommercial License 1.0.0 headers.Gates
pr_gates(lint, audits, secrets, xray, gen-docs, derived, workflows): 7/7 pass.cobolrt_rules.py --check: consistent (0 discrepancies).gitgalaxy.standards.cobol check: 45 rules, 162 matrix cells, ok.pytest tests/cobol_mainframe/test_cobol_*_vectors.py: 100 passed in 0.34s.ruff_audit.py --ci: 0 new lint findings beyond baseline.Plan for Remaining Families (Epic #4710)
With the generator infrastructure established, the remaining 141 runtime rules in
cobolrt_rules.jsoncan be delivered in discrete, high-velocity slices:NUM+EDIT, 18 rules:Codec.java,Zoned.java,Editing.java).HFP, 14 rules:Hfp.java).LE, 19 rules:le/*.java).DLI,MQ,SQL,CICS).