Skip to content

feat(cobol-to-java): traceability.json — every generated artifact traced to its COBOL (#3650) - #3682

Merged
squid-protocol merged 3 commits into
mainfrom
feat/traceability-3650
Sep 25, 2026
Merged

squid-protocol merged 3 commits into
mainfrom
feat/traceability-3650

Conversation

@squid-protocol

@squid-protocol squid-protocol commented Sep 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #3650.

What

Every cobol-to-java run now writes a traceability.json next to the generated project. This is the paper trail behind each generated artifact.

{"file": "src/main/java/.../service/MenuService.java", "symbol": "MenuService#linkAcctinq", "kind": "service-call",
 "facts": [{"source": "cbl/MENU.cbl:8", "ledger_field": "call targets",
            "field_testing": "open (6 public / 0 private estates)", ...}],
 "todos": [...]}
  • Artifacts covered:
    • controller endpoints and dispatch;
    • service LINK/XCTL/CALL sites and file ops;
    • UoW commits, rollbacks, transactional methods, abend and condition handlers, unchecked RESP;
    • COMMAREA DTOs and each field (item: "CA-ACCT-ID @0+11");
    • VSAM entities, keys, repositories and finders;
    • DB2 repository methods (one per embedded statement, with a TODO when the target database isn't DB2) and DECLAREd row classes.
  • Each fact names its ledger field and that field's live field-testing status, read from fact_channel_confidence.json.
  • summary counts artifacts, facts, TODOs and a per-kind breakdown. java_migration_audit.txt gets a line: Traceability (#3650) : N artifacts, M facts, K TODOs.

The ledger mapping comes from skeleton_export's own channel maps, never a per-forge hardcode. TraceLog normalizes centrally: it dedupes entries and names class-level entries after their class.

CardDemo (default config)

425 artifacts, 632 facts, 67 TODOs. 0 cited files missing. Every fact resolves to a ledger field:

ledger field facts status
record fields 171 field-tested (6 public)
VSAM defines 158 open (3 public)
CICS resources 135 open (5 public)
entry transactions 62 open (4 public)
units of work and handlers 55 field-tested (6 public)
dynamic call targets 32 open (5 public)
call targets 19 open (6 public)

Safety

  • Generated Java is byte-identical to main. I rescanned all 6 corpora with the current engine, so the Java conversion: embedded DB2 (table access + DCLGEN) -> repositories, dialect per config #3618 DB2 output is included (1,627 Java files), ran 3 configs each, and diffed everything except traceability.json and the audit txt: no differences.
  • Every manifest in all 18 runs cites only files that exist, and every fact has a ledger field. DB2 is traced across CardDemo, CBSA and GENAPP: 78 statement methods and 5 row classes.
  • tests/cobol_mainframe + tests/tools_recorders: 873 passed.
  • Preflight --java is all PASS: ruff, mypy, dead-key, xray, field-testing, refraction-snapshot, and the CardDemo and GENAPP compiles.

Tests

tests/cobol_mainframe/test_traceability.py:

  • TraceLog unit test: normalization, dedupe and class naming.
  • Real-scan end-to-end test: a CSD, two programs and a copybook are scanned, refracted and converted to Java. It asserts:
    • every cited file exists;
    • the endpoint cites the CSD line, entry transactions and a status;
    • the LINK cites MENU.cbl:8 and call targets;
    • a DTO field carries its @offset+bytes;
    • the audit line matches the summary.

Provenance

An agy (Gemini 3.1 Pro) agent drafted this from a brief. I reviewed it and reworked:

  • the manifest was written before the services and controllers existed; it is now written last;
  • ledger and status were hardcoded per forge; they now come from the channel maps and the confidence file;
  • class-level entries were named "Class";
  • field positions were missing;
  • entries were duplicated;
  • the wrong key was used for skeleton_version;
  • a synthetic-only e2e test was replaced with a real scan.

Also

Follow-ups

🤖 Generated with Claude Code

https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g

squid-protocol and others added 2 commits September 25, 2026 16:28
…ced to its COBOL (#3650)

Every run now writes traceability.json next to the generated Java. It holds one
entry per generated artifact: controller endpoints, service calls, file ops, UoW
commits/rollbacks, abend handlers, COMMAREA DTOs and each field, and VSAM
entities, keys and repositories. Each entry lists the verified-skeleton facts
behind it (COBOL source:line, plus item @offset+bytes for fields), the ledger
field that fact belongs to, and that field's live field-testing status from
fact_channel_confidence.json. The entry's TODOs are carried too.
java_migration_audit.txt gets a summary line.

TraceLog normalizes centrally: the ledger comes from skeleton_export's channel
maps, never from a per-forge hardcode; entries are deduplicated; class-level
entries are named after their class. The generated Java is byte-identical to
main (6 corpora x 3 configs).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

Conflict in skeleton_forges: kept both TraceLog wiring and Db2Forge. Db2Forge now
records each statement method (source file:line, "DB2 table access", a TODO when the
engine isn't db2) and each DECLAREd row class. Also untangles the #3617/#3618
comments glued onto one ESTATE_JOINS line by the #3680 conflict resolution.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ZsVaAkb86P5r5JXDC2Y9g
@squid-protocol
squid-protocol merged commit c0ad4b3 into main Sep 25, 2026
36 checks passed
@squid-protocol
squid-protocol deleted the feat/traceability-3650 branch September 25, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Java conversion: machine-readable traceability manifest (every generated artifact -> its source facts)

1 participant