Skip to content

COBOL func_start: a column-1 free-format paragraph keeps its whole name (part of #4203) - #4371

Merged
squid-protocol merged 1 commit into
mainfrom
fix/4203-free-format-col1-paragraph
Oct 4, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/4203-free-format-col1-paragraph

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Part of #4203: only the H-0028 shape. The PROGRAM-ID-as-unit design question stays open.

What was broken

In free-format COBOL a paragraph name may start in column 1, so its own hyphen can sit in column 7. estate-crucible H-0028, apps/MODN/cobol/MODRATE.cbl:25, has LOOKUP-RATE. under >>SOURCE FORMAT FREE. func_start's optional fixed-format margin (columns 1-6 plus the column-7 indicator) took LOOKUP as a sequence number, so the unit was recorded as RATE.

The \b meant to catch this greedy-margin trap (TargetFunc.) did not fire. A hyphen is not a regex word character, so there is a \b between - and R, even though the hyphen is a COBOL name character.

The fix

In cobol.py func_start, the name now starts only where no name character (letters, digits, _, -, national and wide characters) precedes it. When the margin-eater splits a word, the match backtracks to "no margin" and captures the whole name. The real fixed-format cases still lose their margin:

  • 000100 LOOKUP-RATE. → LOOKUP-RATE
  • 064100DDEBUG-LINE-A. → DEBUG-LINE-A, through the existing digit-sequence lookbehind
  • TargetFunc. → TargetFunc

Evidence

  • New tests/extraction/languages/test_cobol_free_format_col1_4203.py (MODRATE shape plus ABCDEF-GHIJ., whose 6-letter first word is the worst case). It fails on main: RATE / GHIJ. A margin-cases test pins the forms above.
  • A real scan with galaxyscope --db-only of MODRATE.cbl gives function_data = MAIN-PARA, LOOKUP-RATE.

Estate-crucible v0.3.0 (main → this branch)

units  89 pass / 2 missing / 4 phantom  ->  91 / 1 / 3
H-0028 #4203 FAIL -> PASS   (missing LOOKUP-RATE, phantom RATE)

Nothing else moves.

Golden masters

crucible_check.py --update --yes against the sibling language-crucible at v1.7.0: no drift in either leg. The crucible has no column-1 hyphenated paragraph in free-format source, so no golden file changes. The real-scan check above shows the change reaches the scan.

Ground-truth ledger

update: no change. check: clean.

Local checks

tests/cobol_mainframe, tests/extraction and tests/core_engine (pinned corpora): 13,233 passed. mypy_audit / ruff_audit (0.16.0) / dead_key_audit --ci report nothing new.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FNWHcUSn5p7eMxFTsB5rFo

…me (part of #4203)

In free-format source a paragraph name may start in column 1, which puts its own
hyphen in column 7 (`LOOKUP-RATE.`). func_start's optional fixed-format margin
took `LOOKUP` as a sequence number, and the unit was recorded as `RATE`. The `\b`
guard against this greedy-margin trap allowed the split because a hyphen is not
a regex word character, although it is a COBOL name character. A name now starts
only where no name character precedes it (estate-crucible H-0028).

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

github-actions Bot commented Oct 4, 2026

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol marked this pull request as ready for review October 4, 2026 23:12
@squid-protocol
squid-protocol merged commit e4ada9d into main Oct 4, 2026
38 checks passed
@squid-protocol
squid-protocol deleted the fix/4203-free-format-col1-paragraph branch October 4, 2026 23:12
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.

1 participant