Repository navigation
Description
Description
Found investigating tri-comparison ledger shape scheme/function/existence/agree[ctags]_vs[gitgalaxy] (92 occurrences).
gitgalaxy/core/detector.py's StructuralExtractor._slice_by_braces (Integration Mode B) chooses its scope-delimiter characters based on language:
opener, closer = "{", "}"
if lang_id == "lisp":
opener, closer = "(", ")""lisp" has never been a real key in LANGUAGE_DEFINITIONS -- only "scheme" is registered. That means the parenthesis branch has been unreachable dead code in production for every real scan: lang_id is always "scheme", never "lisp", so every scheme file falls through to the curly-brace default. Since scheme is entirely parenthesis-delimited (no {/} anywhere), the downstream scope-body lookup never finds an opener, hits its if brace_idx == -1: continue bailout, and every single func_start match gets silently discarded -- a 100% recall drop for the whole language, independent of file content or corpus size.
This was never caught by tests/extraction/languages/test_scheme.py/test_scheme_strict.py because those test the func_start regex directly (which is correct in isolation), not the live _slice_by_braces integration path that actually turns regex matches into named function output -- the exact same "passes synthetic tests, fails on real corpus" gap this repo's tri-comparison-ledger-sweep skill has hit before (ABAP, cobol).
There was also a unit test (tests/core_engine/test_detector.py::test_detector_mode_b_lisp_family) asserting this mechanism works -- but it constructed a mock language literally named "lisp" (StructuralExtractor("lisp", MOCK_LANG_DEFS)), which happened to match the dead string check by construction, without ever exercising a real registered language. The mock's own lexical_family value ("lisp_style") was never consulted by the old code either, since the check was on lang_id, not lexical_family -- the test was passing for the wrong reason.
Steps to Reproduce
import sys
sys.path.insert(0, 'tests/tools')
from tri_comparison_gatherer import gather_language
results = gather_language('scheme')
print(sum(len(r.gg_funcs) for r in results)) # 0, despite dozens of real `(define (name ...))` formsConfirmed directly (isolated by a dispatched investigation, 2026-08-20): prism.py's comment/code splitter is clean (raw (define count unchanged before/after), and func_start's own regex matches correctly when run standalone (31/31 hits on one corpus file) -- the drop happens specifically in _slice_by_braces's bracket-selection logic.
Suggested fix
Key the delimiter choice off the language's lexical_family (scheme's real value: "recursive_block_lisp") instead of a hardcoded lang_id string, so any future lisp-family language sharing this integration mode is covered automatically rather than needing its own hardcoded string.
Evidence
Full discrepancy record in docs/self_scan/tri_comparison_ledger.json, shape scheme/function/existence/agree[ctags]_vs[gitgalaxy].
Activity
fix(scheme): _slice_by_braces checks dead lang_id "lisp", causing 100…