Skip to content

Det Db2: a SQLCA declared COMP is held big-endian, so EVALUATE SQLCODE WHEN 100 matches (Part of #8121) - #8225

Merged
squid-shepherd[bot] merged 4 commits into
mainfrom
churn/8121-20261110T1703Z
Nov 10, 2026
Merged

squid-shepherd[bot] merged 4 commits into
mainfrom
churn/8121-20261110T1703Z

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Part of #8121

What

A det port whose SQLCA is declared COMP took the Other arm of EVALUATE SQLCODE WHEN 100 after a no-row SELECT (or an injected +100). Cause: example-health-apis ships IBM's SQLCA.cpy with SQLCODE PIC S9(9) COMP, found before the COMP-5 stand-in; DetSql.putInt wrote every SQLCA field little-endian, so +100 read back big-endian as 1677721600. SQLCODE 0 is the same bytes either way, and NOT = 0, < 0 and WHENEVER passed by accident: only an exact = 100 / = -811 comparison missed.

Fix (engine, no case data): program.py emits DetSql.sqlcaBigEndian(s_SQLCA) only when the SQLCA's SQLCODE is not COMP-5; DetSql.putInt (every SQLCA writer goes through it) writes that storage big-endian; sql.py _whenever_tests reads SQLCODE big-endian for it. COMP-5 SQLCA ports emit no new text.

Evidence

  • Java run of the runtime on a no-row selectOne: unregistered SQLCA reads 1677721600 (the bug), registered reads 100.
  • tests/cobol_mainframe/test_det_sqlca_comp.py: registration emitted for SELECT / FETCH / UPDATE / DELETE over a COMP SQLCA and absent for the COMP-5 stand-in; the WHENEVER read follows the declaration; putInt source pin.
  • test_sql_whenever, test_sql_faults, test_det_zos_comp5, test_sql_unit_of_work, test_evidence_components: pass. audit_check.py: clear. ruff format --check: clean.
  • Not run: det_port.py check / golden bless (the translator output for COMP-5 SQLCAs is unchanged; every Db2 port's copied DetSql.java moves by this edit, as any runtime edit does).

Class sweep

Every SQLCA field write shares putInt: SQLCODE +100 from selectOne, injected faults, FETCH end of cursor, rowset FETCH, searched UPDATE/DELETE, INSERT...SELECT, -811, and SQLERRD / SQLERRML. Only the translation-level and WHENEVER paths are pinned by the tests; the runtime paths are covered by the shared putInt.

Sibling gaps

  • A program that MOVEs a COMP SQLCA's bytes: untested.
  • Blocker (b) of P124 (blank-padded PIC X host variable bound to SMALLINT) stays open.
  • HCP1BU01 LINKs LGUCDB01, which is not in the estate.
    File-cap exception: one fix needs the runtime, the translator emission, the WHENEVER read and a one-line gen.py attribute default together; the blocker page is generated from the ledger.

Remaining slices

HCIVDB01, HCV1BI01, HCV1PL01 and the rest of the Inquire family case data (now unblocked at (a)); P124 blocker (b).

Checklist: partial [c:54bc7fde] -- Inquire family case data still to ship
Checklist: partial [c:581bd365] -- scenarios for HCIVDB01 / HCV1BI01 not yet shipped

Lessons for agents

  • A COMP-declared SQLCA (the corpus's own copybook, found before det/copy/SQLCA.cpy) is written by DetSql in the COMP-5 order unless registered; an = 100 comparison is the only SQLCODE test that shows it.
  • Cross-repo: none.

🤖 Generated with Claude Code

squid-protocol and others added 3 commits November 10, 2026 12:15
…E WHEN 100 matches (Part of #8121)

example-health-apis ships IBM's SQLCA.cpy (SQLCODE PIC S9(9) COMP), found before the COMP-5 stand-in.
DetSql wrote every SQLCA field little-endian, so +100 read back as 1677721600 and took the OTHER arm.
The translator now registers a COMP SQLCA (DetSql.sqlcaBigEndian), putInt writes it big-endian and the
WHENEVER read follows the declaration. COMP-5 SQLCA ports emit nothing new.

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 Nov 10, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 10, 2026 17:20
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 10, 2026 17:26
@squid-shepherd
squid-shepherd Bot disabled auto-merge November 10, 2026 17:27
@squid-shepherd

Copy link
Copy Markdown
Contributor

This PR conflicts with main, so no checks ran. Merge origin/main into it and regenerate generated files with their tools (never hand-merge them), then push.

@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 10, 2026
@squid-shepherd squid-shepherd Bot removed the shepherd:merge Maintainer: merge when green (auto-merge, squash). Guide: docs/ci.md label Nov 10, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

CI shepherd: the head of this PR (707de61) 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 10, 2026 17:43
@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 10, 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 10, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot marked this pull request as ready for review November 10, 2026 17:46
@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 10, 2026
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

1 similar comment
@squid-shepherd

Copy link
Copy Markdown
Contributor

No description provided.

@squid-shepherd
squid-shepherd Bot enabled auto-merge (squash) November 10, 2026 17:48
@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 10, 2026
@squid-shepherd
squid-shepherd Bot merged commit c81d133 into main Nov 10, 2026
119 of 155 checks passed
@squid-shepherd
squid-shepherd Bot deleted the churn/8121-20261110T1703Z branch November 10, 2026 18:41
squid-shepherd Bot pushed a commit that referenced this pull request Nov 10, 2026
…rt of #8121) (#8229)

Case data only: health-hcmapl01 (11 scenarios, Db2 faults), its sweep coverage
ledger, a duration entry and a dated estate-journey note. The patient-lookup arm
proves only with the Java SQLCODE +100 fix (#8225).

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.

1 participant