Skip to content

det: EXEC SQL WHENEVER SQLERROR / NOT FOUND / SQLWARNING (Part of #4269) - #5338

Merged
squid-protocol merged 3 commits into
mainfrom
churn/4269-20261017T1234Z
Oct 17, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
churn/4269-20261017T1234Z

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #4269 (next unchecked item: WHENEVER).

What changed

  • det/sql.py: EXEC SQL WHENEVER {SQLERROR|NOT FOUND|SQLWARNING} {CONTINUE|GO TO label}. Scoped in source order; after each executable EXEC SQL statement the SQLCA is tested in IBM's order (SQLERROR <0, NOT FOUND +100, SQLWARNING SQLWARN0=W or another positive SQLCODE). Unknown label, a shared source line under another WHENEVER, and any other action (PERFORM, STOP, ...) are refused by name.
  • det/program.py: a WHENEVER ... GO TO forces dispatch style (like HANDLE).
  • SQLCA reads are inline in the generated code: DetSql.java is untouched, det_port.py check reports 120/120 ports unchanged.
  • tests/tools/equivalence_sql.py: the oracle precompiler mirrors the semantics (fixed-format, one clause per line).
  • Q4.md and det_port_design.md updated.

Proof (evidence level)

Translated whole, no holes. No burned estate uses WHENEVER (grep of the burned corpora), so the proof is a synthetic Db2 estate tests/equivalence/db2/whenever (WHENDEMO): NOT FOUND and SQLERROR branches taken, CONTINUE cancelling them, SQLWARNING on a truncated CHAR. Executed-equivalent on Db2 with EQUIVALENCE_E2E=1, trace pinned (IBM SQLCODEs 100, -803, SQLWARN0). Oracle is GnuCOBOL plus our stub, not z/OS.

Gates

pr_gates --fast 6/6, --ratchets 8/8, test_sql_whenever.py 12 + e2e passed. Golden not run: no scanned-engine parsing change.

Sibling gaps (still refused; no burned estate needs them)

PREPARE / EXECUTE / EXECUTE IMMEDIATE / DESCRIBE; EXEC SQL CALL; CONNECT; scroll FETCH PRIOR/ABSOLUTE/RELATIVE; multi-row FETCH/INSERT arrays; DSNTIAR/DSNTIAC (Q5). ROLLBACK already landed (#4729).

Lessons for agents

  • COBOL source is fixed-format: a line past column 72 silently loses its tail (:WS-ID became :WS-I, a "no parameter" hole). Wrap generated or hand-written COBOL.
  • A DetSql.java edit moves every Db2 port in det_port check; emit small SQLCA reads inline in generated code instead.

🤖 Generated with Claude Code

…d GO TO (Part of #4269)

WHENEVER is lexically scoped in source order; after each executable EXEC SQL statement
the SQLCA is tested in IBM's order (SQLERROR, NOT FOUND, SQLWARNING) and the GO TO taken.
A program with WHENEVER ... GO TO is dispatch-style. The SQLCA reads are inline in the
generated code, so DetSql.java and all 120 ports are unchanged. The oracle precompiler
mirrors the semantics. Proved on Db2 by a synthetic estate (WHENDEMO): no burned estate
uses WHENEVER.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@squid-protocol squid-protocol added the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 17, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

1 similar comment
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol marked this pull request as ready for review October 17, 2026 12:58
@squid-protocol
squid-protocol enabled auto-merge (squash) October 17, 2026 13:00
@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 #5338 @ b81bb63: 2 failed check(s)

== ground-truth (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39034676960/job/117403869916
repro: python tests/tools/pr_gates.py --ratchets --only-ratchets ground-truth
errors:
##[error]Process completed with exit code 1.
log tail:
Commit: f3dc54e1fb89da6852db922499a0233137369e1d
Build Date: 2026-10-12T17:48:21Z
Worker ID: {b6d1e3d2-9bab-4c12-a1fc-a32070f06506}
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: ground-truth
##[group]Run echo "ground-truth parts: $PARTS (tested-tree skip: $SKIP, plan mode: $MODE)"
echo "ground-truth parts: $PARTS (tested-tree skip: $SKIP, plan mode: $MODE)"
# #4935: "skipped" is a pass only when the gate proved this tree green on the PR; otherwise it is a failure
# #5164: ... or when the plan found no ground-truth input in the PR (mode none). An empty mode is not none.
test "$PARTS" = "success" || { test "$PARTS" = "skipped" && { test "$SKIP" = "true" || test "$MODE" = "none"; }; }
shell: /usr/bin/bash -e {0}
env:
PARTS: failure
SKIP:
MODE: full
##[endgroup]
ground-truth parts: failure (tested-tree skip: , plan mode: full)
##[error]Process completed with exit code 1.
Cleaning up orphan processes

== ground-truth part 1/2 (failure) -- real
https://github.com/squid-protocol/gitgalaxy/actions/runs/39034676960/job/117402199273
repro: python tests/tools/pr_gates.py --fast
failing tests: tests/cobol_mainframe/test_equivalence_sql.py::test_a_form_not_modelled_is_refused_by_name[proc0-WHENEVER]
errors:
fail-on-cache-miss: false
FAILED tests/cobol_mainframe/test_equivalence_sql.py::test_a_form_not_modelled_is_refused_by_name[proc0-WHENEVER] - Failed: DID NOT RAISE Unsupported
##[error]Process completed with exit code 1.
log tail:
archive: true
env:
GITGALAXY_LICENSE_KEY: COMMUNITY_FREE_TIER
GITGALAXY_MAINFRAME_CORPORA: /home/runner/work/gitgalaxy/gitgalaxy/.mainframe_corpora
PYTHONUTF8: 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
##[endgroup]
With the provided path, there will be 1 file uploaded
Artifact name is valid!
Root directory input is valid!
Uploading artifact: test-times-ground-truth-part-1.zip
Beginning upload of artifact content to blob storage
Uploaded bytes 137901
Finished uploading artifact content to blob storage!
SHA256 digest of uploaded artifact is 7ceec412862722c93ff0ec63d01277c8f378f84f1e3cc9c540a4a548ad8fffae
Finalizing artifact upload
Artifact test-times-ground-truth-part-1 successfully finalized. Artifact ID 12102200970
Artifact test-times-ground-truth-part-1 has been successfully uploaded! Final size is 137901 bytes. Artifact ID is 12102200970
Artifact download URL: https://github.com/squid-protocol/gitgalaxy/actions/runs/39034676960/artifacts/12102200970
Post job cleanup.
[command]/usr/bin/git version
git version 2.55.0
Temporarily overriding HOME='/home/runner/work/_temp/86948cbd-9abf-447a-862a-20d8d8cd9d91' 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/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 17, 2026
squid-protocol and others added 2 commits October 17, 2026 09:37
…HENEVER SQLERROR STOP (Part of #4269)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@squid-protocol squid-protocol removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Oct 17, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

CI shepherd: the head of this PR (3c851d8) 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 17, 2026
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol enabled auto-merge (squash) October 17, 2026 13:38
@squid-protocol

Copy link
Copy Markdown
Owner Author

No description provided.

@squid-protocol
squid-protocol merged commit e91f5e4 into main Oct 17, 2026
61 checks passed
@squid-protocol
squid-protocol deleted the churn/4269-20261017T1234Z branch October 17, 2026 14:05
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