Skip to content

Split the det CICS translator's command dispatch into a family registry (Part of #5274) - #7439

Merged
squid-shepherd[bot] merged 3 commits into
mainfrom
refactor/5274-det-command-families
Nov 1, 2026
Merged

squid-shepherd[bot] merged 3 commits into
mainfrom
refactor/5274-det-command-families

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #5274. This is step 2 of the plan in the issue comment. It is independent of #7436, which splits the harness side.

Why

Cics._command was the most-edited method in det/cics.py: 10 of the file's 25 commits since 10-24. It was a 570-line chain, so any new command edited this file, and plan holds work per file.

What changes

  • _command is now a loop over COMMAND_FAMILIES. A new command goes in its family's dispatch and leaves det/cics.py alone.
  • Seven new mixins, moved by script from the AST in their original order: counters, terminal, program, queues, storage, web, system.
  • The existing containers, taskcontrol, filecontrol and conditions mixins each gain a dispatch.
  • ENQ / DEQ move into task control, so they stay ahead of the counter family's catch-all refusal.
  • det/cics.py drops from 2,341 to about 950 lines.
  • _literal moves to the leaf cics_common.py, so the mixins do not import back from cics.py.

Behaviour is unchanged

  • Every corpus program: det_survey.py --no-compile on old and new code gave 513 generated Java ports, all byte-identical.
  • Direct comparison: command() on 240,470 real and generated bodies, against a template program with real data items, gave 0 differences in the Java lines or the refusal's type and message.
  • Control: moving counters to the end of the registry gave 6,266 differences, so the check can fail. The order rules are pinned in test_cics_det_families.py. This check also caught a real mistake during the work, a dropped import that crashed FORMATTIME, before anything was pushed.
  • Real run: the cics-crucible hc-abend-link case on the cobol-stub side under GnuCOBOL in Docker: 5 of 5 pass.

Tests

  • 253 test files touching the translator: 7,555 passed and 2 failed in the first run. Both failures were fixed, and those files then passed. After the final small edits I reran only the targeted files, 135 passed; the 240,470-body comparison was also repeated, with 0 differences.
  • Ruff, mypy and dead-key audits: nothing new. The ruff baseline loses one entry, because the moved SEND TEXT line is now parenthesized.

🤖 Generated with Claude Code

…ry (Part of #5274)

Cics._command was a 570-line chain, so a new command edited det/cics.py and
plan-held any other CICS slice. It is now a loop over COMMAND_FAMILIES, and
each family answers through its own `dispatch`.

New mixins, moved verbatim: counters, terminal, program, queues, storage, web,
system. ENQ / DEQ join task control so they stay ahead of the counter family's
catch-all refusal. det/cics.py drops from 2,341 to about 950 lines.

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 Nov 1, 2026
def receive_map(self, opts: dict, ind: str) -> list[str]:
# #4737 (X28): ASIS -- IBM: "lowercase characters in the 3270 input data stream are not translated to uppercase".
# The operator's input reaches the program as typed (CicsTask.receive), which is what ASIS asks for
as_is = "ASIS" in opts # noqa: F841 (the option is honoured by doing nothing: no translation exists to switch off)
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

PR #7439 @ 3383671: 3 failed check(s)

== Analyze (python) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/41320230326/job/124888652410
repro: no local equivalent; read the check page
errors:
expect-error: false
##[error]Process completed with exit code 1.
log tail:
| note | py/repeated-import | gitgalaxy/tools/cobol_to_java/det/cics_taskcontrol.py:40 |
| note | py/repeated-import | gitgalaxy/tools/cobol_to_java/det/cics_taskcontrol.py:97 |
| note | py/repeated-import | gitgalaxy/tools/cobol_to_java/det/cics_taskcontrol.py:303 |
| warning | py/conflicting-attributes | gitgalaxy/tools/cobol_to_java/det/cics.py:486 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_containers.py:23 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_conditions.py:24 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_counters.py:28 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_filecontrol.py:79 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_program.py:27 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_queues.py:28 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_storage.py:30 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_system.py:30 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_taskcontrol.py:22 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_terminal.py:32 |
| note | py/ineffectual-statement | gitgalaxy/tools/cobol_to_java/det/cics_web.py:27 |
| error | py/uninitialized-local-variable | gitgalaxy/tools/cobol_to_java/det/cics_program.py:66 |
| error | py/uninitialized-local-variable | gitgalaxy/tools/cobol_to_java/det/cics_program.py:66 |
##[error]Process completed with exit code 1.
Post job cleanup.
Post job cleanup.
Existing job run UUID is 2fe9545e-0c33-4136-b4cd-f4b0af9076c7.
CodeQL job status was success.
Sending status report for init-post step.
Status report sent for init-post step.
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/ab4ffacc-8e57-4c6e-a162-645e0edf7022' 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

== CodeQL (failure) -- real
https://github.com/squid-protocol/gitgalaxy/runs/124890063601
repro: no local equivalent; read the check page
log tail:

== Pre-gate (Vault Sentinel, X-Ray, Supply Chain) (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/41320230344/job/124888652178
repro: python tests/tools/pr_gates.py --only secrets xray
errors:
##[error]Process completed with exit code 1.
log tail:
🧱 SUPPLY CHAIN FIREWALL: SCAN SUMMARY
===========================================================================
Mode : Audit (Allow Whitelist + Unknown)
Files Evaluated : 2,134
---------------------------------------------------------------------------
Approved Packages : 0
Banned Packages : 0
Unknown Packages : 0
---------------------------------------------------------------------------
Active Threats : 0
Allowlist Bypasses : 0
---------------------------------------------------------------------------
[SUCCESS] Dependency supply chain is clean.
===========================================================================
##[end-action id=__self_3.__run_2;outcome=success;conclusion=success;duration_ms=97006]
Post job cleanup.
##[start-action display=Set up Python;id=__5f065a57-61c9-42fc-96d4-830a59ed6988.__actions_setup-python]
##[end-action id=__5f065a57-61c9-42fc-96d4-830a59ed6988.__actions_setup-python;outcome=skipped;conclusion=skipped;duration_ms=0]
Post job cleanup.
##[start-action display=Set up Python;id=__e165cfcb-0025-4d5c-b623-51d33b50f880.__actions_setup-python]
##[end-action id=__e165cfcb-0025-4d5c-b623-51d33b50f880.__actions_setup-python;outcome=skipped;conclusion=skipped;duration_ms=0]
Post job cleanup.
##[start-action display=Set up Python;id=__1d42b609-d911-48ee-9a03-988a08db4962.__actions_setup-python]
##[end-action id=__1d42b609-d911-48ee-9a03-988a08db4962.__actions_setup-python;outcome=skipped;conclusion=skipped;duration_ms=0]
Post job cleanup.
[command]/usr/bin/git version
git version 2.56.0
Temporarily overriding HOME='/home/runner/work/_temp/ab11e439-d20e-4a75-a706-be2d0755978f' 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-shepherd squid-shepherd Bot added the shepherd:needs-fix Bot: a real failure on this head; see the digest comment. Guide: docs/ci.md label Nov 1, 2026
squid-protocol and others added 2 commits November 1, 2026 10:26
…gs (Part of #5274)

Every mixin defined `dispatch`, so Cics inherited conflicting attributes and
relied on class-qualified calls. Each family now has its own method and the
registry holds those. Also initialises the LINK locals CodeQL flagged, drops
stale test imports and repeated inner imports, and gives the type-checking
stub a docstring body.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The inline format string scored 4.84 on the pre-gate's entropy check, over its
4.8 limit, now that the small module brings it inside the scanned first 8 KB.
Nothing about the generated Java changes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (c26f971) 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). Until then it is a draft and runs the cheap audits only; re-adding the label marks it ready, which starts the full set on that head.

@squid-shepherd
squid-shepherd Bot marked this pull request as draft November 1, 2026 15:31
@squid-shepherd squid-shepherd Bot added shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. 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 Nov 1, 2026
@squid-protocol squid-protocol added shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md and removed shepherd:reapprove Bot: new commits dropped shepherd:merge; re-add it to merge this head. Guide: docs/ci.md labels Nov 1, 2026
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 1, 2026 15:35
@squid-shepherd squid-shepherd Bot added the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 1, 2026 15:35
@squid-shepherd

squid-shepherd Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd squid-shepherd Bot removed the shepherd:retrying Bot: an infra/flake rerun is pending on this head. Guide: docs/ci.md label Nov 1, 2026
@squid-shepherd
squid-shepherd Bot merged commit ad76a96 into main Nov 1, 2026
89 of 116 checks passed
@squid-shepherd
squid-shepherd Bot deleted the refactor/5274-det-command-families branch November 1, 2026 16:52
squid-shepherd Bot pushed a commit that referenced this pull request Nov 1, 2026
…ixes #7456) (#7458)

The pin looked for addressCwa/Twa/Tctua in det/cics.py; #7439 moved ADDRESS to det/cics_storage.py.

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
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.

2 participants