Skip to content

COBOL engine: a group's USAGE applies to its elementary items (#4525) - #4531

Merged
squid-protocol merged 3 commits into
mainfrom
fix/4525-group-usage
Oct 6, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
fix/4525-group-usage

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #4525

Problem

A USAGE on a group (01 COMP-VARIABLES COMP.) was not applied to the elementary items under it. The engine sized them as DISPLAY, so their sizes and every offset after them were wrong. CardDemo CBSTM03A: COMP-VARIABLES came out at 16 bytes (should be 8) and WS-TOTAL-AMT at 11 bytes (should be 6).

Fix (IBM Enterprise COBOL rule: an item with no USAGE takes the USAGE of the nearest enclosing group)

Ratchets

  • Fact cross-check ledger (fact_crosscheck.py update, unscoped): all 14 engine-group-usage-not-inherited disagreements are gone, the cause is dropped, and 0 are untriaged. The translator adapter's usage channel now reads the translator's effective usage, which is what the engine now records. The old as-written snapshot wrapper is removed.
  • Golden masters: blessed with crucible_check.py --update --yes on both legs. The drift is 2 NIST CCVS85 record layouts (NC1354.2, NC2454.2, COMPUTATIONAL groups). scope_check.py --expect cobol passes on both modes. No timeouts.
  • Ground truth, completeness, estate baseline and ports: PASS, unchanged.
  • Committed ports/evidence: a sweep of all mainframe corpora, estate-crucible and cics-crucible finds group-level non-DISPLAY usages only in CBSTM03A, which has no port or evidence record. Nothing needs re-proving.

Tests

tests/cobol_mainframe/test_group_usage_4525.py covers:

  • the CBSTM03A lines verbatim, plus the real corpus file
  • COMP, COMP-3 and POINTER groups
  • a nested COMP-3 group and a DISPLAY override
  • an item's own USAGE
  • OCCURS and REDEFINES
  • 88 and 77 entries
  • a COPY member under a COMP-3 group
  • agreement with the storage spans

test_dbcs_items had pinned the old "not inherited" behaviour and now asserts the inheritance.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR

squid-protocol and others added 3 commits October 5, 2026 23:33
IBM Enterprise COBOL / COBOL 2002: a USAGE on a group applies to every item
under it with none of its own. The extractor now records the nearest enclosing
group's usage on such items (widening #3816's NATIONAL / DISPLAY-1 rule; an
inherited DISPLAY is not recorded but still stops an outer usage; 66/88 keep
their old shape). GalaxyIR.record_layout and the storage spans thread the
enclosing usage down, so COPY-expanded members learn it too, and a picless
usage (POINTER) on a group no longer makes the group elementary. The schema
forge's own reader inherits likewise.

CardDemo CBSTM03A: COMP-VARIABLES 16 -> 8 bytes, WS-TOTAL-AMT 11 -> 6. The 14
engine-group-usage-not-inherited fact cross-check disagreements are gone
(fact_crosscheck.py update); the translator adapter's usage channel now reads
the effective usage, as the engine records it. Golden masters: 2 NIST CCVS85
record layouts (COMPUTATIONAL groups), attributed via scope_check --expect cobol.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W3KVtYHQp8KsfKcHsdiPbR
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine data-integrity Issues relating to RAM state or SQLite database fidelity core-engine Modifications to the central physics and parsing engine 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

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.

COBOL engine: a group's USAGE (01 X COMP.) is not inherited by its elementary items, so sizes and offsets are wrong

1 participant