fix(cobol): three fixed-format func_start false positives from the v1.2.0 corpus - #2481
Merged
Conversation
….2.0 corpus The v1.2.0 language-crucible expansion (#2478) added ~600 files of strict fixed-format punched-card COBOL -- the NIST COBOL-85 CCVS conformance suite + cobol-check -- which newly exercised three func_start false-positive shapes. None affect free-format or Area-A/B COBOL; all are column-1-7 handling. 1. CONTINUE (no-op statement) on its own line -- `003200 CONTINUE.` -- matched as a paragraph. 36 occurrences (IF4014/IF4024/IF4034/cobol-sample SAMPLE1). Fixed: CONTINUE added to func_start's reserved-verb shield, same class as LOCAL-STORAGE (#1890). 2. A bare 6-digit sequence number on a lone-period line -- `012100 .` -- captured as a paragraph name. 6 occurrences. Fixed: the captured identifier must now contain >= 1 letter. Digit-led real names (`0000-MAIN`, `100-INIT-ROUTINE`) still match -- they have letters. 3. A column-7 `D` debug-line indicator glued onto the real paragraph name: `064100D` + `DEBUG-LINE-TEST-03-A` was captured as `DDEBUG-LINE-TEST-03-A`. Fixed in two places: - anchor: consume a col-7 `D`/`d` only when a name char immediately follows (`(?<=[0-9])[Dd](?=[A-Za-z])`), and let the identifier start right after a verified 6-digit+indicator prefix via `(?<=[0-9]{6}[ \-Dd])` alongside `\b`. A `D` followed by whitespace (`064000D PASS.`) is left alone so debug-only paragraph *redefinitions* aren't newly counted. - detector.py `_slice_by_labels`: removed the C++ GoogleTest / Boost.Test `BOOST_`/`TEST`/`TEST_F`/`TEST_CASE` -> `match.group(0)` fallback. That heuristic only makes sense for the brace-based extractor (where it still lives); in this label-based Mode A (assembly / COBOL / ABAP) func_start always captures a real identifier and match.group(0) is `<anchor> + <name>`, so a *substring* hit on `DEBUG-LINE-TEST-03-A` only re-mangled it. This also corrects 5 JCL step names -- LGTESTC1 / LGTESTP1-4 were collapsing to `EXEC`. Net: cobol Function/Method Declarations 11744 -> 11701 (-43 FP occurrences); jcl unchanged in count, 5 step names corrected. Only cobol/jcl move in the golden masters -- verified no other language affected. Both golden masters re-blessed; tri-comparison regenerated (cobol [gitgalaxy]_vs[ctags] shape 55 -> 10 occurrences). One residual, filed separately: `066600DDEBUG-LINE-TEST-05-A` in DB1034.2.cbl (a debug-line paragraph bracketed by `*` comment lines) still mangles via a fourth, not-yet-identified extraction path. Verified: cobol/assembly/abap/agc_assembly extraction + strict gauntlets (512 tests), language_standards strict, ruff/mypy (no new findings), crucible_check both modes against the full corpus. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…laxy#2481, residual #2480) cobol/function/existence/agree[gitgalaxy]_vs[ctags]: 55 -> 10 occurrences after the CONTINUE / bare-sequence-number / column-7-D fixes. 9 of the 10 remaining are GitGalaxy-correct SECTION headers (still the #1891 harness {"p"}-kind filter); 1 residual filed as #2480. credit/debit left empty -- still mixed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Contributor
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.
Follow-up from the v1.2.0 pin bump (#2478). The v1.2.0 corpus 10×'d cobol's function count (308→589 files but 11.7k functions) — investigation ([tri-comparison-ledger-sweep on cobol]) confirmed ~99.6% is legitimate: the NIST COBOL-85 CCVS conformance suite genuinely runs ~56 paragraphs/file (
F-INTPART-TEST-01…-23,OPEN-FILES,WRITE-LINE— all real, hand-verified). GitGalaxy finds fewer functions than ctags (10,183 vs 13,171).But it surfaced three real
func_startfalse-positive shapes, all specific to strict fixed-format punched-card COBOL (columns 1–7), which the pre-v1.2.0 corpus never exercised:CONTINUEno-op statement on its own line (003200 CONTINUE.) matched as a paragraphCONTINUE→ func_start reserved-verb shield (same class asLOCAL-STORAGE/ #1890)012100 .) captured as a name0000-MAINstill matches)Ddebug indicator glued onto the real name:064100D+DEBUG-LINE-TEST-03-A→DDEBUG-LINE-TEST-03-ADonly when a name-char follows; plus removed detector.py_slice_by_labels' C++-onlyBOOST_/TEST/TEST_F/TEST_CASE → match.group(0)fallback that was re-mangling any Mode-A name containing the substringTESTFix #3's detector.py change also corrects 5 JCL step names —
LGTESTC1/LGTESTP1-4incics-genapp/cobol.jclwere all collapsing toEXEC. Same bug class.Impact
cobolandjclmove in the golden masters — verified no other language affected. Both golden masters re-blessed; tri-comparison regenerated (cobol/function/existence/agree[gitgalaxy]_vs[ctags]55 → 10 occurrences). Of the 10 remaining, 9 are GitGalaxy correct —SECT-IC219-000N/NUMBERNare real COBOLSECTIONheaders that ctags tags assectionkind, dropped by the harness'sCTAGS_FUNC_KINDS["cobol"] = {"p"}filter (tests/tools/ctags_reader.py's cobol CTAGS_FUNC_KINDS drops section-kind tags, undercounting ctags-side cobol function readings #1891, pre-existing).One residual — filed as #2480
066600DDEBUG-LINE-TEST-05-AinDB1034.2.cbl:665still mangles.func_startin isolation and_extract_nameare both correct for it; a fourth extraction path (a rescan/fallback) still emitsmatch.group(0)for this one line (a debug-line paragraph bracketed by*comment lines). 1 occurrence in ~10,140 — low priority.Verified
cobol / assembly / abap / agc_assembly extraction + strict gauntlets (512 tests),
test_language_standards_strict,ruff_audit --ci/mypy_audit --ci(no new findings),crucible_check.pyboth modes against the full corpus.🤖 Generated with Claude Code