Skip to content

Equivalence harness: Db2 rows generated from DDL, SQL outcomes and tables compared field by field (#4507) - #4577

Merged
squid-protocol merged 5 commits into
mainfrom
feat/4507-db2-generated-rows
Oct 6, 2026
Merged

squid-protocol merged 5 commits into
mainfrom
feat/4507-db2-generated-rows

Conversation

@squid-protocol

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

Copy link
Copy Markdown
Owner

Part of #4507 (child of #4515). What remains is at the end.

Design. A Db2 case's "seed": "@generate" builds its rows from the tables' declarations, following the #3804 pattern. Its "compare_sql": true compares what Db2 answered each side, statement by statement.

(a) Rows generated from DDL / DCLGEN (equivalence_db2.generate_rows)

  • parse_tables reads CREATE TABLE, a DCLGEN's DECLARE TABLE, PRIMARY KEY / UNIQUE / FOREIGN KEY (inline, table-level, ALTER), CREATE UNIQUE INDEX and identity columns. It is checked on CBSA, GenApp and CardDemo DDL.
  • Each column gets its type's boundary values first: CHAR at full length and blank; VARCHAR empty, at max length (up to 4000) and with trailing blanks; DECIMAL(p,s) at ±max, ±smallest fraction, 0 and halves; SMALLINT/INTEGER/BIGINT min and max; DATE/TIME/TIMESTAMP at the first and last value plus a leap day. Then NULL, each nullable column on its own row. Then values in between.
  • Keys are unique together. Foreign keys take a parent row, and a parent the case doesn't name is generated first. Identities are left to Db2; the pools know the START WITH / INCREMENT values.
  • Missing and duplicate keys come from the scenarios. A COMMAREA rule {"from": "SCHEMA.TABLE.COLUMN", "miss": 0.2, "turn": true} picks a key the table holds (an INSERT of it gives -803) or one it doesn't (+100, or -530 for a child INSERT).

(b) Comparison, field by field

  • SQL outcomes: ggsql.c logs each statement to $GGSQL_OUTCOMES. The Java side's EquivalenceDb2Config wraps its JDBC connections in proxies and logs the same. Both fold to (verb, SQLCODE, SQLSTATE, rows), with cursors folded into their query. -304, -305 and -811 come from the COBOL host variables, not from Db2, so they count as the row Db2 returned; the program's reaction to them is compared through its outputs. Wired for CICS and batch, opt-in, so no existing verdict moves.
  • Table state after each run: dump diffs now name the column, not the whole row.
  • Reported in the current report.json / report.md (new SQL column, generated-row counts, feedback lines). Equivalence harness: self-report coverage, run status and actionable blockers as a generated .md page #4493 is not on main yet, so nothing reports through it.

Proof: cbsa-updacc-generated (CBSA UPDACC, CICS + Db2, the hand-written cbsa-updacc port)

Ratchets and checks

  • Evidence re-proven via evidence.py prove after merging main: cbsa-updacc, cbsa-inqacc, genapp-lgicdb01, genapp-lgupdb01. All proven.
  • det_port.py run genapp-lgipdb01 (cursors, through the new JDBC proxy): PROVED.
  • carddemo-cobtupdt (batch) gives the same result on origin/main and on this branch. It is not proven on either.
  • pr_gates.py: 7/7 pass. --ratchets: 5 pass; ports was skipped because there is no cics-crucible checkout here.
  • New unit tests in tests/cobol_mainframe/test_equivalence_db2_rows.py. The E2E test runs only with EQUIVALENCE_E2E=1 and docker, and passed locally.

Remaining for #4507

  1. Report through Equivalence harness: self-report coverage, run status and actionable blockers as a generated .md page #4493 once it lands.
  2. Batch compare_sql is wired but not proven end to end: the only batch Db2 case, cobtupdt, does not prove on main.
  3. Triage the mutation survivors into mutation_scores.json.

🤖 Generated with Claude Code

https://claude.ai/code/session_017BVJCCUMdjLJq1TAM3V34V

@squid-protocol squid-protocol added enhancement New feature, sensor, or structural signature testing Unit, integration, and E2E pipeline verification legacy-modernization COBOL refractor, dead-code extraction, and JCL forging labels Oct 6, 2026
@github-actions

github-actions Bot commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review October 6, 2026 17:40
@squid-protocol
squid-protocol merged commit ad3ffb2 into main Oct 6, 2026
29 checks passed
@squid-protocol
squid-protocol deleted the feat/4507-db2-generated-rows branch October 6, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature, sensor, or structural signature legacy-modernization COBOL refractor, dead-code extraction, and JCL forging testing Unit, integration, and E2E pipeline verification

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant