Repository navigation
Closed
Labels
legacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingpriority: highCore feature broken, but workarounds exist
Description
Follow-up from roadmap #3249. Part of epic #3122.
Problem
The fact channels store data, compare it and report it, but the refactor pipeline does not read them. On main, cobol_refractor_controller.process_payload reads only program_ids, copy_deps and units from EngineFile. Everything else still comes from the forge's own parsers of the raw file:
| IR field | today's source (forge) | channel already in the master DB |
|---|---|---|
analysis.lineage (DD inputs/outputs) |
extract_lineage(work_path, ...) |
dataset_data → EngineFile.datasets (#3201) |
generation.schemas (record layouts) |
forge_schemas(...) |
record_data → EngineFile.records (#3246, PL/I #3250) |
| call targets / transaction routing | forge readers | call_site_data / transaction_data → EngineFile.calls (#3200, #3211) |
The galaxy_ir.py SCOPE comment already says the DB "carries almost everything the forge parsers derive". The refractor never switched over, so these channels today feed only the differential, the answer key, the audit JSON and the LLM brief.
The new #3249 channels (BMS map fields, DB2 DECLARE TABLE/DCLGEN, JCL PROC/SET resolution) have the same gap: they are stored but not used.
Scope
- When
engine_fileis present, sourcelineage,schemasand the call/transaction data fromEngineFileinstead of the forge readers. Keep the forge path as the fallback when there is no engine DB, and record which source was used (ir_source, per field). - Map
EngineFile.records(a flat item tree withchildren) to the shapeforge_schemasproduces. The known lossy difference isforge_flat_schema(see the differential), and any intentional divergence needs an explanation. - Once the Roadmap: Named System Facts — extend the fact-channel pattern to remaining forge-owned relations #3249 channels land, use them too: BMS field layouts for screen schemas, DB2 table shapes for SQL binding schemas, and resolved JCL DSNs for lineage.
- Out of scope: reachability-based dead code stays on the forge. It is deliberately not a fact channel (
docs/unreferenced_by_name_contract.md), andusage_statusmust not be used for dead-code masking.
Acceptance
- The refactor output for the mainframe corpus is equal to or better than the forge-sourced output. Every difference is attributed to a named mechanism in
docs/refraction_engine_differential.md. refraction_differential.py --cistays green.- Tests cover both paths: engine-sourced (DB present) and forge fallback (no DB, or a pre-Mainframe call graph: no edges for COBOL CALL, CICS LINK/XCTL or JCL EXEC PGM=, and unresolved CALL targets are recorded nowhere #3200 DB).
- Update the
galaxy_ir.pySCOPE comment and theprocess_payloaddocstring ("Dead code, DD lineage and data items stay on the forge tools") to match what is actually consumed.
Metadata
Metadata
Assignees
Labels
legacy-modernizationCOBOL refractor, dead-code extraction, and JCL forgingpriority: highCore feature broken, but workarounds exist
Activity
Skills: tighten add-fact-channel checklist + add parallel-pr-agents s…
squid-protocol commentedon Sep 23, 2026
Ground-truth evidence for this issue, from the new ledger (#3415, cause
forge_flat_schema).The forge's flat
cobol_schema_forgereader misses 44 record fields that the engine'srecord_datacarries. It gets 1814/1851 on CBSA and 156/163 on zopeneditor; the engine gets 1851/1851 and 163/163. The misses fall into these shapes:ACTUAL-BALANCE-DISPLAY PIC +9(10).99in BNK1CAC/CRA/DAC/TFN/UAC, andNUMERIC-AMOUNT-DISPLAYin DBCRFUN/XFRFUN.ACCOUNT-KY2-BYTES REDEFINES ACCOUNT-KY2,WS-POINTER-BYTES/-NUMBER REDEFINES WS-POINTER, andRDATE-NUMERIC.WS-CHILD-DATA-BIRTH-MONTH/-YEAR.multiroot/sam/SAM1.cbllines with anR2change marker in the sequence area (cols 1–6), for exampleRPT-CRUNCH-*,NUM-PRE-CUSTOMERS,CUST-CNT-NAME.Once the refractor sources
schemasfromEngineFile.records, these 44 ledger entries stop reproducing.ground_truth_ledger.py checkwill then flag them, andupdateratchets them out. That is a measurable acceptance check for this issue. The record key section is stilldraft(records_validated: false), so these numbers show the forge agreeing with the key's own reader, which is weaker evidence than agreement with signed-off truth.squid-protocol commentedon Sep 23, 2026
CardDemo adds 341 more
forge_flat_schemamisses: the forge's flat reader gets 1498/1839 record fields, and the engine'srecord_datagets 1839/1839. Across the three corpora that's 385 ledger entries for this issue to ratchet out. (The CardDemo answer key lands alongside #3415. Its record section is adraft, like the others.)ci: mainframe ground-truth ledger, gated on every PR (#3415)
answer key: CardDemo key, verification tiers, seven draft-reader fixes (
squid-protocol commentedon Sep 24, 2026
#3437 fixes the forge's own record reader.
cobol_schema_forgenow reads whole data entries, and record fields are 3,853/3,853 exact on all three pinned corpora. That clears all 385forge_flat_schemaledger entries, plus a latentPIC 9(n).→ DECIMAL type bug. This issue's main goal is still open: have the refractor source lineage, schemas and calls fromEngineFilewhen a DB is present. Now that both readers agree with the key, that change can be checked field by field. One thing worth revisiting at the same time is the forge's 'one table named after the last 01 group' schema model.Forge: copybook resolver reads every copy shape (#3414); schema reade…
Refractor: DD lineage, dynamic CALLs and schemas from the engine's fa…