Repository navigation
Fix #4026: read non-ASCII and END-xxx paragraph/section names in the graveyard finder - #4028
Merged
Merged
Conversation
Contributor
squid-protocol
marked this pull request as ready for review
September 30, 2026 00:59
…graveyard finder cobol_graveyard_finder's unit reader took only ASCII names and rejected every `END-...` word as a scope terminator: - `_NAME` is now Unicode-aware: a letter or digit in any script (full-width, CJK, full-width digits) plus `-`, U+FF0D and U+2212. `[^\W_a-z]` is exactly `[A-Z0-9]` on ASCII text, so ASCII behaviour is unchanged; U+3000 is not `\w` and stays a separator (#3956). `_V` uses the same word class, so PERFORM / GO TO / ALTER / CICS HANDLE labels follow the new names. - `_NOT_A_PARAGRAPH` rejects only the reserved END- words (END-IF, END-PERFORM, ... END-OF-PAGE), so `END-IPROC1.` in Area A is a paragraph. The answer key's own unit reader (tests/tools/cobol_answer_key.py) had the same `startswith("END-")` rule and gets the same reserved list: GENAPP's `End-Program.` (LGIPDB01, LGUCDB01, LGUCUS01, LGUPDB01, LGUPOL01) is a PERFORMed paragraph that the key, the forge and the engine all missed. Refraction snapshots for those five programs move total_paras by +1. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
#4031), log D037; D036 fixed by #4028 The fixed reader finds a real paragraph End-Program. in Area A in 5 GENAPP programs (lgipdb01 312, lgucdb01 142, lgucus01 119, lgupdb01 215, lgupol01 146). It is reached by fall-through from MAINLINE and by PERFORM END-PROGRAM. The key's reader, the forge and the engine all skipped it: each rejected every END- name as a scope terminator. - Answer key: units gains END-PROGRAM in those 5 programs, read against the source, with a dated key_fixed note in each verification. Dead is unchanged (MAINLINE-EXIT). - Ground-truth ledger: the forge now matches the key. The engine still misses the 5 units (its COBOL function-start rule, #4031), so they are ledgered as the open defect engine_end_prefixed_paragraph_not_a_unit (#4031). - Refraction differential: cics-genapp re-blessed with 1 (excerpt) and 5 (full) unexplained forge-only END-PROGRAM paragraphs, noted as #4031's. They go back to 0 when it lands. - Field testing: D037 logs the engine defect found by the ledger on cics-genapp, and D036 (#4026) is marked fixed_by #4028; report regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ
squid-protocol
force-pushed
the
fix/4026-unicode-unit-names
branch
from
September 30, 2026 12:13
1fa4c30 to
1f4eec0
Compare
squid-protocol
added a commit
that referenced
this pull request
Oct 1, 2026
…ND- words are terminators (#4069) The engine's COBOL func_start shield excluded every `END-...` word as a scope terminator, so a legal paragraph named END-... was never a unit. It now excludes only the reserved END- words -- the list #4028 gave the graveyard finder (COBOL 2014 / IBM Enterprise COBOL / GnuCOBOL). Golden masters re-blessed (both modes), because galaxyscope's output changes on real code: the NIST CCVS85 suite in language-crucible names ~600 paragraphs END-ROUTINE / END-ROUTINE-1 / END-RTN-EXIT / ... (`PERFORM END-ROUTINE THRU END-ROUTINE-13`) that the engine missed; COBOL units and archetype counts rise, and every file's map coordinates move slightly with the totals. cics-genapp's END-PROGRAM is a unit in 5 programs (ground-truth ledger: units tp 157 -> 162, the 5 #4031 rows ratcheted away, the fixed cause removed). Three of those END-PROGRAMs are reached only by fall-through, so the engine's unreferenced-by-name census flags them -- assigned to the existing deliberate cause (#2806: usage_status is a name census, not reachability). Tests: END-PROGRAM / END-IPROC1 / End-Program are units, END-IF / END-PERFORM / END-EXEC are not; the carried-forward `END-TargetFunc.` invalid case was the old behaviour and is now a valid one. Claude-Session: https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ Co-authored-by: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4026.
What changed
gitgalaxy/tools/cobol_to_cobol/cobol_graveyard_finder.py(the unit reader behind the refractor's dead-paragraph masking,cobol_dag_architect,cobol_microservice_slicerand the answer-key tooling):_NAMEis now[^\W_a-z](?:[^\W_a-z]|[\--−])*: a letter or digit in any script (full-width, CJK, full-width digits) plus-and the two full-width hyphens opensourcecobol4j writes (U+FF0D, U+2212, the same set as the engine'sWIDE_HYPHENS). On ASCII text[^\W_a-z]is exactly the old[A-Z0-9], so ASCII behaviour is unchanged. U+3000 is not\w, so it stays a separator (COBOL: a full-width space (U+3000) separator hides data entries and pictures (opensourcecobol4j dialect) #3956)._Vuses the same class ((?<![^\W_a-z])(?<![\--−]), two fixed-width lookbehinds), so_PERFORM,_GO_TO,_ALTER,_TERMINAL_TAIL,_TAIL_PERFORMand_CICS_LABELfollow the new names. No nested quantifiers were added.test_tool_regex_redospasses with the baseline unchanged.END-xxxparagraph names._NOT_A_PARAGRAPHnow rejects only the reserved END- words (ACCEPT, ADD, CALL, CHAIN, COLOR, COMPUTE, DELETE, DISPLAY, DIVIDE, EVALUATE, EXEC, FREE, IF, INVOKE, JSON, MULTIPLY, OF-PAGE, PERFORM, READ, RECEIVE, RETURN, REWRITE, SEARCH, SEND, START, STRING, SUBTRACT, UNSTRING, WAIT, WRITE, XML), plus GOBACK/EXIT/CONTINUE/STOP/DECLARATIVES as before.END-IPROC1.in Area A is a paragraph again.tests/tools/cobol_answer_key.py: the key's independent unit reader had the samestartswith("END-")rule. It now uses the same reserved list, with a test.What this found on a pinned corpus: GENAPP
End-Program.Fix 2 is not ledger-neutral. CICS GENAPP has a real paragraph
End-Program.(Area A,EXEC CICS RETURN END-EXEC., reached byPERFORM END-PROGRAM) in lgipdb01, lgucdb01, lgucus01, lgupdb01, lgupol01. The forge, the answer key and the engine all skipped it because of the same END- rule. The census reviewers didn't catch it either.total_paras+1 each and change nothing else (blessed in this PR).dead_parasstays{MAINLINE-EXIT}.ground_truth_ledger.py checkshows 5NEW mismatch forge | units | … | END-PROGRAM | fp, andtest_refraction_differential(cics-genapp, excerpt + full) shows 5 unexplainedparagraph/old END-PROGRAM. Per the mainframe-ground-truth protocol, the key is what's wrong here ("fix the key and its reader, with a test"). The reader fix is in this PR. Re-running the fixed reader over all six keys changes only these fiveunitslists (one{"name": "END-PROGRAM", "kind": "paragraph", "line": …}each). Nodeadentry changes. The key JSON edit itself was not applied because it needs the maintainer's approval (see Blocked below).END-[…]+shield inlanguages/cobol.py's func_start. Once the key gains END-PROGRAM, the engine side will likely show 5fnmismatches (an engine defect of the same class, in the galaxyscope scan path, so it's a separate change with a golden-master bless).Blocked / left to do (why this is a draft)
tests/cobol_mainframe/answer_key/cics-genapp.jsonunitsfor the 5 programs by re-running the fixed_unitsreader, then decide how to record it (akey_fixedruling / re-census of those 5 programs).ground_truth_ledger.py update, andassignany engine-side END-PROGRAMfnrows to an issue, or fix the engine shield.Verification
tests/cobol_mainframe/+tests/tools/(plainpytestfrom an outside directory): 1250 passed, 25 skipped, 2 failed. The 2 failures are the cics-genapp refraction-differential cases above, which are blocked on the key.PERFORMis followed (not dead), plus a CJK paragraph that really is dead; U+3000 not joining names (header andPERFORM);END-IPROC1.as a paragraph reached byAT END GO TO, withEND-IF./END-PERFORM./END-EXEC./END-OF-PAGE.still not paragraphs; the key reader'sEND-PROGRAMshape.tests/tools/audit_check.py: all clear (ruff, mypy, dead-key, ast-accuracy).ground_truth_ledger.py check: only the 5 genapp END-PROGRAM rows above. Nothing moved on carddemo, cbsa, zecs, dsf or zopeneditor-sample.cobol_graveyard_finderis not in the galaxyscope scan path. galaxyscope imports onlygalaxy_irfromtools/cobol_to_cobol, and neither imports the finder (sys.modulesafter importing both holds nocobol_graveyard_finder). Only the refractor, dag architect, slicer and schema forge use it.cobol_utf8,jp-compat,i18n_sjis, 353 programs, Shift-JIS decoded as cp932). Old and newprocedure_unitswere compared against an independent Area-A header scan:END-xPROC1programs (029–033).SORT … INPUT/OUTPUT PROCEDURE IS …, whichreachable_unitsdoes not follow, so they read as dead. In 021/023, sectionS1節is entered byGO TO L2見出し IN S1節(a qualified GO TO into its paragraph), so the section header itself reads unreached.Cross-repo / companion
The field-testing defect entry D036 for this issue is added by #4027 (not yet merged). After both merge, D036 gets
"fixed_by": "#4028". This PR does not add D036.🤖 Generated with Claude Code
https://claude.ai/code/session_01RZE6us7fUL6Hynk59rWLvZ