Skip to content

fix(abap): correct class-header stripping and function-body slicing - #1902

Merged
squid-protocol merged 1 commit into
mainfrom
fix/abap-engine-bugs
Aug 20, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
fix/abap-engine-bugs

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Fixes #1898 and #1899, both found via manual ABAP verification (ABAP has no tree-sitter grammar or ctags parser, so this was outside the normal tri-comparison pipeline -- see docs/language_status/abap.md §9).

  • Fixes prism.py: ABAP's positional comment stripper reuses Fortran/COBOL's column-1 anchor set, erasing real code as comments #1898 -- prism.py's _strip_positional_comments() reused the shared Fortran/COBOL POSITIONAL_ANCHORS set ({"*","C","c","/","!"}) for ABAP too. ABAP's own real column-1 comment marker is * only, but real ABAP classes are written flush-left (CLASS <name> DEFINITION), so column 1 is a literal C -- the shared rule erased every real class header into the comment stream before class_start ever ran. ABAP now gets its own anchor set (just *) and skips the column-7 fixed-form check entirely (a COBOL/Fortran concept that doesn't apply to free-form ABAP). COBOL and Fortran are unaffected -- verified with their own 321 passing tests plus an isolated Fortran column-1-C repro that still strips correctly.
  • Fixes detector.py: ABAP unregistered in ScopeParsingRegistry falls through to brace-based function slicing, dropping ~87% of real methods #1899 -- detector.py's ScopeParsingRegistry had no ABAP entry, so it silently fell through to Mode_B_Braces despite ABAP having no braces at all (METHOD ... ENDMETHOD., never {}). Only ~13% of real methods survived by coincidence. Routed ABAP through the existing Mode A (_slice_by_labels, "greedy to next func_start match") instead -- already used for COBOL's own label-only paragraphs (no closing keyword at all), and a correct fit here too since ABAP methods are never nested. No new slicing mode needed.

Verification

Re-verified against the real galaxyscope pipeline output, not just the raw regex:

  • function_count now equals struct_func_start exactly (124/124 on the abapGit corpus, 0 false positives/negatives).
  • struct_class_start/class_count now correctly show 2 per real class (DEFINITION + IMPLEMENTATION, matching the engine-wide "OO boundary" convention already established for objective-c) instead of 0.

Both golden master fixtures regenerated via crucible_check.py --update against the pinned language-crucible v1.0 corpus (full-precision and zero-dependency modes). Every one of the 296/298 diffs traces to ABAP's own numbers changing correctly, plus expected 3D-coordinate ripple in unrelated files from spatial_mapper's graph-relative repositioning -- confirmed via a full un-capped deep_compare dump (not just the 50-line CLI output), so no other language's own structural signatures moved.

Test plan

  • tests/extraction/languages/test_abap.py + test_abap_strict.py (129 tests) pass.
  • tests/extraction/languages/test_{cobol,fortran,assembly,agc_assembly}{,_strict}.py (871 tests, all Mode A / shared-anchor-set users) pass -- confirms no regression to the languages sharing this code path.
  • Full suite: python -m pytest tests/ -- 7004 passed, 2 skipped, 11 xfailed, 3 xpassed.
  • python tests/tools/crucible_check.py -- both full_precision and zero_dependency modes pass clean against the regenerated golden masters.
  • python tests/tools/audit_check.py -- ruff/mypy/dead-key/ast-accuracy all clear.
  • docs/language_status/abap.md §9 updated with before/after evidence for both fixes.

🤖 Generated with Claude Code

Two real, confirmed engine bugs, both found via manual ABAP verification
(ABAP has no tree-sitter grammar or ctags parser, so this was outside the
normal tri-comparison pipeline):

Fixes #1898: prism.py's _strip_positional_comments() reused the shared
Fortran/COBOL POSITIONAL_ANCHORS set ({"*","C","c","/","!"}) for ABAP too.
ABAP's own real column-1 comment marker is "*" only, but real ABAP classes
are written flush-left (`CLASS <name> DEFINITION`), so column 1 is a
literal "C" -- the shared rule erased every real class header into the
comment stream before class_start ever ran. ABAP now gets its own
anchor set (just "*") and skips the column-7 fixed-form check entirely
(a COBOL/Fortran concept that doesn't apply to free-form ABAP). COBOL and
Fortran are unaffected -- they still use the full shared anchor set
(verified: 321 passing tests across both, plus an isolated Fortran
column-1-C repro still stripping correctly).

Fixes #1899: detector.py's ScopeParsingRegistry had no ABAP entry, so it
silently fell through to Mode_B_Braces (brace-delimited function-body
slicing) despite ABAP having no braces at all (METHOD ... ENDMETHOD.,
never {}). Only ~13% of real methods survived by coincidence (a stray
brace-like character happening to sit nearby). Routed ABAP through the
existing Mode A (_slice_by_labels, "greedy to next func_start match")
instead -- already used for COBOL's own label-only paragraphs with no
closing keyword at all, and a correct fit here too since ABAP methods are
never nested. No new slicing mode needed.

Re-verified against the real galaxyscope pipeline (not just the raw
regex): function_count now equals struct_func_start exactly (124/124),
and struct_class_start/class_count now correctly show 2 per real class
(DEFINITION + IMPLEMENTATION pair, matching the engine-wide "OO boundary"
convention already established for objective-c) instead of 0.

Both fixtures regenerated via crucible_check.py --update against the
pinned language-crucible v1.0 corpus (full-precision and zero-dependency
modes). Every one of the 296/298 diffs traces to ABAP's own numbers
changing correctly, plus expected 3D-coordinate ripple in unrelated files
from spatial_mapper's graph-relative repositioning (never any other
language's own structural signatures) -- confirmed via a full deep_compare
dump, not just the 50-line capped CLI output. Full test suite (7004 tests)
and both crucible_check.py modes pass clean after the fix.

Updated docs/language_status/abap.md's manual-verification section to
record both fixes with before/after evidence.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@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 d94ad34 into main Aug 20, 2026
29 checks passed
@squid-protocol
squid-protocol deleted the fix/abap-engine-bugs branch August 20, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant