Skip to content

fix(cobol): three fixed-format func_start false positives from the v1.2.0 corpus - #2481

Merged
squid-protocol merged 2 commits into
mainfrom
sweep/cobol-post-v1.2.0
Aug 30, 2026
Merged

fix(cobol): three fixed-format func_start false positives from the v1.2.0 corpus#2481
squid-protocol merged 2 commits into
mainfrom
sweep/cobol-post-v1.2.0

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

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_start false-positive shapes, all specific to strict fixed-format punched-card COBOL (columns 1–7), which the pre-v1.2.0 corpus never exercised:

# FP occ fix
1 CONTINUE no-op statement on its own line (003200 CONTINUE.) matched as a paragraph 36 CONTINUE → func_start reserved-verb shield (same class as LOCAL-STORAGE / #1890)
2 bare 6-digit sequence number on a lone-period line (012100 .) captured as a name 6 captured identifier must contain ≥1 letter (0000-MAIN still matches)
3 column-7 D debug indicator glued onto the real name: 064100D + DEBUG-LINE-TEST-03-ADDEBUG-LINE-TEST-03-A anchor consumes col-7 D only when a name-char follows; plus removed detector.py _slice_by_labels' C++-only BOOST_/TEST/TEST_F/TEST_CASE → match.group(0) fallback that was re-mangling any Mode-A name containing the substring TEST

Fix #3's detector.py change also corrects 5 JCL step namesLGTESTC1 / LGTESTP1-4 in cics-genapp/cobol.jcl were all collapsing to EXEC. Same bug class.

Impact

  • cobol Function/Method Declarations: 11,744 → 11,701 (−43 FP occurrences)
  • jcl: count unchanged, 5 step names corrected
  • Only cobol and jcl move 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 correctSECT-IC219-000N / NUMBERN are real COBOL SECTION headers that ctags tags as section kind, dropped by the harness's CTAGS_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-A in DB1034.2.cbl:665 still mangles. func_start in isolation and _extract_name are both correct for it; a fourth extraction path (a rescan/fallback) still emits match.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.py both modes against the full corpus.

🤖 Generated with Claude Code

squid-protocol and others added 2 commits August 30, 2026 09:57
….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>
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit e190671 into main Aug 30, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the sweep/cobol-post-v1.2.0 branch August 30, 2026 14:02
@squid-protocol squid-protocol added bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging threat: false-positive Accuracy tuning: Engine incorrectly flagged safe code priority: high Core feature broken, but workarounds exist labels Aug 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Unintended behavior or logic failure in the engine core-engine Modifications to the central physics and parsing engine legacy-modernization COBOL refractor, dead-code extraction, and JCL forging priority: high Core feature broken, but workarounds exist threat: false-positive Accuracy tuning: Engine incorrectly flagged safe code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant