Repository navigation
fix(abap): correct class-header stripping and function-body slicing - #1902
Merged
Merged
Conversation
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]>
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.
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).prism.py's_strip_positional_comments()reused the shared Fortran/COBOLPOSITIONAL_ANCHORSset ({"*","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 literalC-- the shared rule erased every real class header into the comment stream beforeclass_startever 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-Crepro that still strips correctly.detector.py'sScopeParsingRegistryhad no ABAP entry, so it silently fell through toMode_B_Bracesdespite 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 nextfunc_startmatch") 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
galaxyscopepipeline output, not just the raw regex:function_countnow equalsstruct_func_startexactly (124/124 on the abapGit corpus, 0 false positives/negatives).struct_class_start/class_countnow 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 --updateagainst the pinnedlanguage-cruciblev1.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 fromspatial_mapper's graph-relative repositioning -- confirmed via a full un-cappeddeep_comparedump (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.python -m pytest tests/-- 7004 passed, 2 skipped, 11 xfailed, 3 xpassed.python tests/tools/crucible_check.py-- bothfull_precisionandzero_dependencymodes 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