Skip to content

feat(#3210): hand-verified COBOL answer key for the #3120 corpora, scored against forge and engine - #3216

Merged
squid-protocol merged 2 commits into
mainfrom
feat/3210-cobol-answer-key
Sep 19, 2026
Merged

squid-protocol merged 2 commits into
mainfrom
feat/3210-cobol-answer-key

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Closes #3210. Part of #3122. First of the tooling issues from the #3120 retrospective (#3210–#3215).

What this adds

  • tests/cobol_mainframe/answer_key/: a hand-verified key for each Refraction pipeline: consume the engine's master DB instead of re-parsing COBOL #3120 corpus, pinned by commit:

    • zopeneditor-sample: 5 programs
    • CBSA: 31 programs, 680 units

    Each program records:

    • PROGRAM-ID and the real paragraph/section headers
    • dead units, each with a reason, and trivial set for EXIT.-only ones
    • COPY / EXEC SQL INCLUDE resolution, through zapp.yaml libraries where the corpus declares them; unresolved entries say why (CICS/LE/DB2-supplied, or a BMS-generated map)
    • SELECT/OPEN modes, CALL/LINK targets, and CICS/SQL presence

    Every program is validated, and the key's method block says how each field was checked. The README has the details and the scores.

  • tests/tools/cobol_answer_key.py:

    • draft computes candidate values with an independent fixed-format reading. It is a verification helper, not a third product parser, and nothing imports it.
    • score measures the forge tools and an engine DB against a key.
  • tests/cobol_mainframe/test_cobol_answer_key.py (13 tests): key integrity (no corpus needed), the draft rules on small fixtures, and a scorer smoke test.

First scores (CBSA)

field forge engine DB
dead (non-trivial: 10 true units) P 5/571 · R 5/10 P 2/221 · R 2/10
copybook paths P 0/29 · R 0/114 P 78/78 · R 78/114
units P 452/729 · R 452/680 P 680/706 · R 680/680
outputs P 0/0 · R 0/1 not carried
cics/sql 42/42 not carried

Neither side can say what's dead yet (#3198, #3203). The engine's copybook edges are always correct but cover 68% of references (#3199). New detail for #3203/#3204: on BANKDATA the forge marks the entry paragraph A010 dead, which is why even its single-mode OPEN OUTPUT disappears.

How it was verified

  • Dead verdicts (all 62):
    • No other reference to the name anywhere in the program's code.
    • The unit before each one ends in an unconditional RETURN/ABEND/GOBACK, or a PERFORM of a section that never returns.
    • Robust to the one modelling choice (main-flow fall-through across sections): 0 units depend on it.
  • Units: every draft unit is an engine unit, and each of the 26 engine-only units was checked to be an Area-B phantom (cobol func_start: Area-B continuation lines ending in a period become paragraphs (follow-up to #2538's deferred fixed/free-format anchor) #3197).
  • Live units: a random sample of 12 CBSA reach paths checked, 12/12 correct.
  • Four draft errors caught during verification are now tests. Each test fails when its fix is reverted:
    • CICS HANDLE ABEND LABEL(...) handlers read as dead (8 sections);
    • fall-through past PERFORM GET-ME-OUT-OF-HERE;
    • AUTHOR. James O'Grady. opened a literal that hid the rest of the file;
    • a shared PROGRAM-ID resolved across workspace roots.
  • Reproducible: draft reproduces both committed keys exactly, verification blocks aside.
  • Checks: pytest tests/cobol_mainframe: 68 passed, run CI-style from an unrelated directory. audit_check.py is all clear.

Tests only; no product code changes.

🤖 Generated with Claude Code

…ored against forge and engine

tests/cobol_mainframe/answer_key/ records per-program truth for
IBM/zopeneditor-sample (5 programs) and CBSA (31 programs, 680 units),
pinned by commit: PROGRAM-ID, real paragraph/section headers, dead units
with reasons (trivial EXIT-only flagged), COPY/SQL INCLUDE resolution
(zapp.yaml libraries; system and BMS-generated copybooks explained),
SELECT/OPEN modes, CALL/LINK targets, CICS/SQL presence. Every program
is validated, with notes on what was checked.

tests/tools/cobol_answer_key.py draft computes candidates (an
independent fixed-format reading used only as a verification helper).
tests/tools/cobol_answer_key.py score measures the forge tools and the
engine DB against a key.

First scores on CBSA: real dead logic is 10 units. The forge finds 5
among 571 claims; engine usage_status finds 2 among 221. Engine COPY
edges are 78/78 correct but cover 68% of references. The forge reports
no outputs anywhere; on BANKDATA it marks the entry paragraph dead.

Four draft errors found during verification are pinned by tests, each
shown to fail with its fix reverted.

Part of #3122. Closes #3210.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

…dropped them)

CI failed 2 tests: tests/cobol_mainframe/answer_key/*.json were never in
the commit. The .gitignore *.json rule silently excluded them from
`git add` of the directory, and the local run passed on the on-disk
copies. Add a documented exception beside the ledger's.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
@squid-protocol squid-protocol added enhancement New feature, sensor, or structural signature and removed enhancement New feature, sensor, or structural signature labels Sep 19, 2026
@squid-protocol
squid-protocol merged commit 1ff32ef into main Sep 19, 2026
37 checks passed
@squid-protocol
squid-protocol deleted the feat/3210-cobol-answer-key branch September 19, 2026 15:56
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

COBOL modernization answer key: hand-verified per-program truth for the #3120 corpora, scored against forge and engine

1 participant