Skip to content

Engine record layouts: POINTER width as a parameter, shared stand-in copybooks (Part of #5649) - #5656

Merged
squid-protocol merged 5 commits into
mainfrom
churn/5649-20261019T1513Z
Oct 19, 2026
Merged

squid-protocol merged 5 commits into
mainfrom
churn/5649-20261019T1513Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5649. Slice 1 = the issue's Work steps 1-2.

Owner decisions

Issue #5649 (owner OK 2026-10-19): translator consumes engine record layouts.

What changes

  1. POINTER width is a parameter of the engine's layout. GalaxyIR.record_layout(..., pointer_bytes=None) threads the width through _elementary_bytes, _sync_boundary and _slack. The default is ZOS_POINTER_BYTES = 4 (IBM Enterprise COBOL under LP(32): 4 bytes, fullword-aligned under SYNC). Every caller that doesn't pass the parameter (COMMAREA contracts, the layouts channel, referees) keeps z/OS 4, so no engine output moves. Under SYNC a POINTER aligns on its own width.
  2. Shared stand-in copybooks, flagged. core/copy_libraries.py gains STAND_IN_DIR (the det translator's det/copy, the same files det/source._SHIPPED_COPY falls back on), stand_in_registers() (CMQ* -> register W1 via mq.STAND_INS, CEEIGZCT -> L4) and stand_in_text(), which blanks comments and the sequence area.
    • load_galaxy_ir attaches a parsed stand-in (stand-in#MEMBER) to each COBOL file that COPYs a registered member the repository does not hold. It sits on a new EngineFile.stand_in_copies, which only _copybook_file reads, after real copybooks and BMS symbolic maps. A repository copybook always wins.
    • record_layout adds stand_ins: [...] only when the layout read one, so other layouts keep their shape.
  3. Fact cross-check compares like with like. engine_extras lays the engine side of offsets out at the translator's storage width (det.cics.POINTER_BYTES, 8: GnuCOBOL x86-64, register C9).

Class sweep

Class: the engine and the translator lay out the same record from different inputs: a platform setting (POINTER width) and system copybooks only one side could read.

member where it bit (burned estates) this PR
POINTER width 4 vs 8 CBSA DELCUS, CREACC, INQACCCU, BNK1CCA …; CardDemo CBSTM03A; GenApp lg*; zECS ZECS001 (204 offsets) fixed: parameter
CMQ* stand-ins only the translator read CardDemo COPAUA0C, COACCT01, CODATE01 (380 offsets) fixed: shared stand-ins
CEEIGZCT stand-in only the translator read CBSA CRECUST FC (2 offsets) fixed: shared stand-ins

Sibling gaps

  • PROCEDURE-POINTER / FUNCTION-POINTER widths. The engine reports them as unknown width (_elementary_bytes returns None). IBM: PROCEDURE-POINTER is 8 bytes, FUNCTION-POINTER is a pointer. Needed by DBB MortgageApplication epscsmrd.cbl (1 ROUTINE PROCEDURE-POINTER, 3 records). Not in the ledger today: the cross-check only lays out records the translator lays out.
  • The translator does not model SYNC; the engine does. With POINTER at 8 under SYNC the two would place slack differently. No burned program declares POINTER SYNC (grep of the burned corpora), so there is nothing to prove there yet.
  • DFHAID / DFHBMSCA / DFHEIBLK / SQLCA / SQLDA are shipped in the same det/copy directory, but they are not register stand-ins. The engine treats them as system members (unexpanded). Programs that would need them: CardDemo COCRDUPC, COUSR01C, COTRN02C (DFHAID); CBSA UPDACC. No offsets entry today: those are separate 01s the cross-check records do not reach.
  • A data_flows span resolved through a stand-in carries no stand-in flag. The 8 newly resolved CardDemo COPAUA0C MOVEs (into MQOD-OBJECTNAME OF MQM-OD-REQUEST, MQMD-CORRELID OF MQM-MD-REQUEST …) point at stand-in storage without saying so. Only record_layout flags it.
  • layouts channel, CBSA PROCISRT.cpy (6 pointer-width entries) stays. That channel scores against the keys and referees, which are z/OS (4), so it is definitional and correct to keep.

Remaining slices

Gates and evidence

  • Fact cross-check ledger 724 -> 138 (fact_crosscheck.py update, unscoped). By cause: translator-uses-mq-stand-ins 380 -> 0, pointer-width 210 -> 6 (the layouts entries above), translator-uses-stand-in-copybook 2 -> 0. No new entry. Both causes that no longer have entries leave causes.
  • This makes the check stricter, not looser: the 586 entries were definitional (the two sides read different inputs). Now both sides read the same inputs, so any remaining difference is a real defect and fails the gate.
  • Completeness pin, CardDemo data flows 4945 -> 4953 (of 5054). These are the 8 COPAUA0C MOVEs into MQ fields that now resolve. I diffed the flows one by one with and without stand-ins: 8 unresolved -> resolved, nothing else moved.
  • pr_gates.py --fast: 6/6 pass. pr_gates.py --ratchets: 8/8 pass (after the ledger update and pin). audit_check.py: all clear. Tree-wide guard tests: pass. time_ratchet.py check: 0 over the limit.
  • Tests: tests/cobol_mainframe/test_fact_crosscheck.py adds a toy-repo scan covering:
    • POINTER 4 by default, 8 when passed
    • SYNC boundary follows the width
    • MQOD 168 / MQMD 324 from the stand-ins, flagged
    • a repository CMQGMOV wins
    • the stand-in registry

Lessons for agents

  • tests/test_source_reads.py (rule 2) flags a text-mode read_text() in any gitgalaxy/core/ module, even when it reads GitGalaxy's own shipped file (here, a stand-in copybook). Read through gitgalaxy.core.source_text.read_source.
  • Giving the engine a copybook it lacked does more than move record_layout: _copybook_file also feeds _find_item, so data_flows and the completeness pins in test_completeness.py move too. Run pr_gates --ratchets after the change and diff the moved flows one by one.

🤖 Generated with Claude Code

squid-protocol and others added 3 commits October 19, 2026 11:21
…flows 4945 -> 4953

The engine side of `offsets` now lays out at the translator's POINTER width and reads the
same stand-in copybooks: 380 translator-uses-mq-stand-ins, 204 offsets pointer-width and 2
translator-uses-stand-in-copybook entries no longer reproduce. Eight COPAUA0C MOVEs into MQ
fields now resolve. The #5649 record_layout tests move into test_fact_crosscheck.py.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 19, 2026 16:00
@squid-protocol
squid-protocol enabled auto-merge (squash) October 19, 2026 16:05
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5656 @ fdf2f4c: 1 failed check(s)

== full-suite part 2/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39282088206/job/118160612591
repro: python -m pytest -q tests
errors:
fail-on-cache-miss: false
FAIL tests/cics_crucible/test_bll_tokens_5119.py::test_cics_task_numbers_them_as_the_stub_does: 15.9s is over 15s and has no @pytest.mark.slow(reason=...) and no entry in tests/test_time_baseline.json
##[error]Process completed with exit code 1.
log tail:
env:
PYTHONUTF8: 1
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
OMP_NUM_THREADS: 1
pythonLocation: /opt/hostedtoolcache/Python/3.12.15/x64
PKG_CONFIG_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib/pkgconfig
Python_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python2_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
Python3_ROOT_DIR: /opt/hostedtoolcache/Python/3.12.15/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.12.15/x64/lib
PYTEST_ADDOPTS: --ignore=tests/cobol_mainframe
##[endgroup]
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: test-times-part-2.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 182620
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 638b504187ad7658d9822ee5a59163d13c2cf681b2b79d26c7bae86b2c3f8325
Finalizing artifact upload
Artifact test-times-part-2 successfully finalized. Artifact ID 12203235719
Artifact test-times-part-2 has been successfully uploaded! Final size is 182620 bytes. Artifact ID is 12203235719
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/39282088206/artifacts/12203235719
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/414bfa34-e549-4656-8f31-35d48293d219' before making global git config changes
Adding repository directory to the temporary git global config as a safe directory
[command]/usr/bin/git config --global --add safe.directory /home/runner/work/gitgalaxy/gitgalaxy
Removing SSH command configuration
[command]/usr/bin/git config --local --name-only --get-regexp core.sshCommand
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
Removing HTTP extra header
[command]/usr/bin/git config --local --name-only --get-regexp http.https://github.com/.extraheader
[command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'http.https://github.com/.extraheader' && git config --local --unset-all 'http.https://github.com/.extraheader' || :"
Removing includeIf entries pointing to credentials config files
[command]/usr/bin/git config --local --name-only --get-regexp ^includeIf.gitdir:
[command]/usr/bin/git submodule foreach --recursive git config --local --show-origin --name-only --get-regexp remote.origin.url
Cleaning up orphan processes

@squid-protocol squid-protocol added shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md labels Oct 19, 2026
@squid-protocol squid-protocol added shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md and removed shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md labels Oct 19, 2026
@squid-protocol squid-protocol removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

CI shepherd: the head of this PR (41e7e4f) is not the one a maintainer labelled shepherd:merge on (new commits, or never approved), so the label was removed and nothing merges unreviewed code. Re-add the label when the new head is ready (shepherd:reapprove marks this PR until then).

@squid-protocol squid-protocol added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol enabled auto-merge (squash) October 19, 2026 19:00
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit ab39812 into main Oct 19, 2026
61 checks passed
@squid-protocol
squid-protocol deleted the churn/5649-20261019T1513Z branch October 19, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant