Skip to content

core.cobol_preprocessor: one COPY / REPLACING rule for the scanner and the translator (Part of #5648, Fixes #5645) - #5654

Merged
squid-protocol merged 6 commits into
mainfrom
churn/5648-20261019T1449Z
Oct 19, 2026
Merged

squid-protocol merged 6 commits into
mainfrom
churn/5648-20261019T1449Z

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Part of #5648, Fixes #5645

What

First slice of the shared COBOL preprocessor: gitgalaxy/core/cobol_preprocessor.py holds the COPY statement rule, its statement end, the REPLACING parse and the one-pass REPLACING apply once. The translator (det/source.py) and the scanner (mainframe_boundary, galaxy_ir) import them; their duplicates are deleted.

Rule Was Now
COPY text-name (unquoted, quoted, quoted file literal "ws-state.cpy") + OF/IN library det/source.py _COPY (no extension form, #5645) cobol_preprocessor.COPY_STATEMENT / copy_statements()
COPY statement end det/source.py _statement_end statement_end
REPLACING parse mainframe_boundary._copy_replacing + det/source.py _replacing copy_replacing
REPLACING apply (one pass) galaxy_ir._replace_text + det/source.py _replace (sequential substring) replace_text

The translator now resolves COPY "ws-state.cpy" / 'state.inc' by the literal file name first, then the member stem (#5645), and applies REPLACING the way the scanner does (whole words unless :tag: / (tag) pseudo-text or LEADING/TRAILING). Every REPLACING shape in the burned corpora (==:TAG:==, ==(TESTVAR1)==, word-by-word, literal-by-literal, ==SORTCODE==, ==NUMBER-OF-ACCOUNTS.==) gives the same text both ways.

Class: COPY/REPLACING text rules kept twice (scanner vs translator) — one fixed, the other kept the blind spot.

Owner decisions

Owner OK (2026-10-19)

Proof

  • tests/cobol_mainframe/test_cobol_preprocessor_5648.py (24 tests, own fixtures): every spelling, library forms, extension needs its closing quote, statement end, one-pass REPLACING, scanner/translator share the same objects, fixed + free format expansion, missing literal refused by name, full translate.
  • Related suites (copy_replacing_4265, copy_ambiguous_4461, det_source_4462, det_source_defects_4735, det_translate): 622 passed, 1 skipped.
  • pr_gates.py --fast: 6/6 pass.
  • det_port.py check: 135/135 ports unchanged (byte-identical translations vs origin/main; the EPSCSMRT parity warnings are pre-existing).
  • crucible_check.py (golden-lock): full_precision PASS, zero_dependency PASS, no re-bless.
  • pr_gates.py --ratchets: all pass. fact-crosscheck did not grow; estate, ground-truth, ports, cics-spec and time all pass.
  • Guard suites (source_reads, cics_spec, generated_branch, sweep_plan, ci_critical_path_split, proof_reach): 184 passed. audit_check.py: all clear.
  • Docker is not installed on this box, so no GnuCOBOL execution proofs; translator proof is det_port.py check (byte comparison of translations against origin/main).

Remaining slices

  1. After COBOL: quoted copybook literals with an extension keep IN/REPLACING; plain section COPYs get a row (Fixes #5618) #5626 lands: rebuild the scanner's _COPY_IN_ENTRY / _COPY_LIBRARY from the core rule (left alone here to avoid conflicting with COBOL: quoted copybook literals with an extension keep IN/REPLACING; plain section COPYs get a row (Fixes #5618) #5626).
  2. Layout and continuations into core (reuse cobol_source_format): det logical_lines, _free_code, _comment_at, _open_literal; mainframe_boundary _continued_literal.
  3. The REPLACE statement and >>IF/>>ELSE/>>END-IF/>>DEFINE per core.compiler_options.
  4. The line map, and as_fixed / as_fixed_rows.
  5. docs/language_status/fact_ownership.md note.

Sibling gaps

  • gitgalaxy/tools/cobol_to_cobol/cobol_graveyard_finder.py: its own _REPLACING_PAIR and _COPYBOOK_EXTS.
  • Translator EXEC SQL INCLUDE handling, separate from the scanner's combined regex.
  • COPY ... SUPPRESS phrase: not checked on either side.

🤖 Generated with Claude Code

…scanner and the translator (Part of #5648, Fixes #5645)

The translator's own COPY regex missed a quoted file literal with an extension
(`COPY "ws-state.cpy".`). The COPY statement rule, its statement end and the
REPLACING parse/apply now live once in gitgalaxy/core/cobol_preprocessor.py;
det/source.py, mainframe_boundary and galaxy_ir import them and their copies
are deleted.

Co-Authored-By: Claude Sonnet 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 15:13
@squid-protocol
squid-protocol enabled auto-merge (squash) October 19, 2026 15:15
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol squid-protocol added the shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md label Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@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 (c2768d7) 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:waiting-on-main Bot: the failing check fails on main too (main's to fix). 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 15:43
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5654 @ c2768d7: 2 failed check(s)

== full-suite (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39279063232/job/118154542783
repro: python -m pytest -q tests
errors:
##[error]Process completed with exit code 1.
log tail:
Hosted Compute Agent
Version: 20261012.601
Commit: f3dc54e1fb89da6852db922499a0233137369e1d
Build Date: 2026-10-12T17:48:21Z
Worker ID: {0cda5ef1-7de2-4867-9654-0bc29a4b9189}
Region: centralus
Cloud: Azure
##[endgroup]
##[group]Operating System
Ubuntu
24.04.5
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20261012.334.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20261012.334/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20261012.334
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: full-suite
##[group]Run echo "full-suite parts: $PARTS (tested-tree skip: $SKIP)"
echo "full-suite parts: $PARTS (tested-tree skip: $SKIP)"
# #4935: "skipped" is a pass only when the gate proved this tree green on the PR; otherwise it is a failure
test "$PARTS" = "success" || { test "$PARTS" = "skipped" && test "$SKIP" = "true"; }
shell: /usr/bin/bash -e {0}
env:
PARTS: failure
SKIP:
##[endgroup]
full-suite parts: failure (tested-tree skip: )
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== full-suite part 3/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39279063232/job/118150751116
repro: python -m pytest -q tests/tools/test_evidence_report.py::test_the_inputs_cover_what_the_translator_imports
failing tests: tests/tools/test_evidence_report.py::test_the_inputs_cover_what_the_translator_imports
errors:
fail-on-cache-miss: false
E AssertionError: gitgalaxy.core.cobol_preprocessor is read by the translator but not fingerprinted
tests/tools/test_evidence_report.py:682: AssertionError
FAILED tests/tools/test_evidence_report.py::test_the_inputs_cover_what_the_translator_imports - AssertionError: gitgalaxy.core.cobol_preprocessor is read by the translator but not fingerprinted
##[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-3.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 181902
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 1d5038eff4717be5dbb07eab16ba55c42881325de01252cb89131593ff9bd52c
Finalizing artifact upload
Artifact test-times-part-3 successfully finalized. Artifact ID 12200187754
Artifact test-times-part-3 has been successfully uploaded! Final size is 181902 bytes. Artifact ID is 12200187754
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/39279063232/artifacts/12200187754
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/704c21ad-a1e4-490b-ba2d-1d145006ad51' 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 the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 19, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol removed the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol added the shepherd:waiting-on-main Bot: the failing check fails on main too (main's to fix). Guide: docs/ci.md label Oct 19, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

PR #5654 @ 0220846: 2 failed check(s)

== full-suite (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39285411173/job/118178295638
repro: python -m pytest -q tests
errors:
##[error]Process completed with exit code 1.
log tail:
Hosted Compute Agent
Version: 20261012.601
Commit: f3dc54e1fb89da6852db922499a0233137369e1d
Build Date: 2026-10-12T17:48:21Z
Worker ID: {97a6a104-6901-4598-8f6d-b43d9f13c76b}
Region: westus3
Cloud: Azure
##[endgroup]
##[group]Operating System
Ubuntu
24.04.5
LTS
##[endgroup]
##[group]Runner Image
Image: ubuntu-24.04
Version: 20261012.334.1
Included Software: https://github.com/actions/runner-images/blob/ubuntu24/20261012.334/images/ubuntu/Ubuntu2404-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/ubuntu24%2F20261012.334
##[endgroup]
##[group]GITHUB_TOKEN Permissions
Contents: read
Metadata: read
##[endgroup]
Secret source: Actions
Cache mode: write
Prepare workflow directory
Prepare all required actions
Complete job name: full-suite
##[group]Run echo "full-suite parts: $PARTS (tested-tree skip: $SKIP)"
echo "full-suite parts: $PARTS (tested-tree skip: $SKIP)"
# #4935: "skipped" is a pass only when the gate proved this tree green on the PR; otherwise it is a failure
test "$PARTS" = "success" || { test "$PARTS" = "skipped" && test "$SKIP" = "true"; }
shell: /usr/bin/bash -e {0}
env:
PARTS: failure
SKIP:
##[endgroup]
full-suite parts: failure (tested-tree skip: )
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== full-suite part 3/3 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39285411173/job/118171937082
repro: python -m pytest -q tests
errors:
fail-on-cache-miss: false
FAIL tests/cics_crucible/test_cics_runtimes.py::test_cics_task_searches_the_abend_exits_upward_and_unwinds_the_levels_below: 19.0s 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-3.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 181984
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 61768ce435016d0ba9b306bd732bf0ad51ede4129aaadcebe5349e075f3f67b2
Finalizing artifact upload
Artifact test-times-part-3 successfully finalized. Artifact ID 12202879284
Artifact test-times-part-3 has been successfully uploaded! Final size is 181984 bytes. Artifact ID is 12202879284
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/39285411173/artifacts/12202879284
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/d3b65383-fdc4-4f08-95a9-b61d37a7f8c8' 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: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

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol squid-protocol added 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:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md labels Oct 19, 2026
@squid-protocol
squid-protocol merged commit 0ceb755 into main Oct 19, 2026
59 checks passed
@squid-protocol
squid-protocol deleted the churn/5648-20261019T1449Z branch October 19, 2026 19:22
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

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

1 participant