fix(scheme): _slice_by_braces checks dead lang_id "lisp", causing 100% recall loss - #1929
Merged
Merged
Conversation
…% recall loss Closes #1928. StructuralExtractor._slice_by_braces (Integration Mode B) chose its scope-delimiter characters via `if lang_id == "lisp":` -- but "lisp" has never been a real key in LANGUAGE_DEFINITIONS (only "scheme" is), so that branch was unreachable dead code in production. Every real scheme file fell through to the curly-brace default; since scheme is entirely parenthesis-delimited, the downstream scope-body search never found an opener and silently discarded every func_start match -- a 100% function-recall drop for the whole language, confirmed via scheme/function/existence/agree[ctags]_vs[gitgalaxy] (92 occurrences). GitGalaxy's own func_start regex was never the problem (confirmed matching 31/31 standalone against real corpus source), and prism.py's comment stripping was confirmed clean too -- the drop was isolated specifically to this delimiter-selection branch via a live-pipeline before/after proof (monkey-patching lang_id to "lisp" immediately recovered real functions from the same input). Fix keys the delimiter choice off `lexical_family == "recursive_block_lisp"` (scheme's real value) instead of the dead lang_id string, so any future lisp-family language sharing this integration mode is covered automatically rather than needing its own hardcoded string. Also fixes tests/core_engine/test_detector.py::test_detector_mode_b_lisp_family, which had been passing for the wrong reason: its mock language was literally named "lisp" (matching the dead check by construction) with a mock lexical_family value ("lisp_style") the old code never actually consulted. Updated the mock to scheme's real lexical_family value so the test now validates the actual production mechanism. Verified directly against the tri-comparison gatherer: scheme function recall goes from 0 to 58 real functions found across the corpus (ctags finds 92 total -- a smaller residual gap remains, tracked separately, not blocking this fix; confirmed via spot-checks that the 50-occurrence GitGalaxy-alone shape this fix newly surfaces is real nested `define` forms ctags' scheme parser structurally misses, not a false-positive regression). Re-blessed both golden master fixtures for the resulting real, expected output change on the scheme/racket corpus files (function counts, risk/topology numbers that depend on them) -- see CONTRIBUTING.md-style explanation in this message; diff reviewed and confirmed scoped to scheme + natural global-aggregate ripple, no unrelated language affected. 144 core_engine/extraction tests pass (108 scheme-specific), full suite green (6747 passed), crucible_check.py clean on both venvs after re-blessing, ruff/mypy/format clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2 tasks
Contributor
squid-protocol
added a commit
that referenced
this pull request
Aug 20, 2026
…#1930) Investigates and validates the entire m4 tri-comparison ledger backlog plus scheme's original recall-gap shape, via the tri-comparison-ledger- sweep skill: - m4/function/existence/agree[ctags]_vs[gitgalaxy] (79): clean ctags-side limitation, not a GitGalaxy defect -- every sampled occurrence is a real AC_DEFINE/AC_DEFINE_UNQUOTED autoconf helper call (emits a C preprocessor #define at build time), not an M4 macro definition. ctags' M4 parser heuristically over-tags these as function definitions; noted in ctags_reader.py alongside the existing C RICHCMP_WRAPPER precedent. - m4/function/existence/agree[gitgalaxy]_vs[ctags] (1): real GitGalaxy false positive (func_start captured the AC_DEFUN keyword itself as a function name), fixed in PR #1927. - m4/class/existence/agree[gitgalaxy]_vs[ctags] (4): real GitGalaxy false positive -- m4's class_start is None but detector.py's class-extraction fallback doesn't check that, so it matches raw C struct declarations embedded as text inside autoconf feature-test macro arguments. Filed as #1925 (broader gap, 18 other class_start=None languages not yet checked), not fixed in this sweep. - scheme/function/existence/agree[ctags]_vs[gitgalaxy] (92): confirmed catastrophic GitGalaxy engine defect (100% function recall loss for the whole language), root-caused and fixed in PR #1929. A smaller residual gap remains post-fix (58/92 found) and a new, legitimate GitGalaxy-alone shape it surfaces (real nested `define` forms ctags' parser misses) is left unvalidated for a future sweep pass. Also filed #1926 (yacc: both real corpus files silently excluded by statistical_auditor.py's anomaly sweep, likely an n=2 degenerate-cohort Z-score issue -- not root-caused to the exact triggering check, flagged for follow-up). Regenerated tri_comparison_chart.svg and tri_comparison_points_of_interest.md; diff confirmed scoped to m4 (asterisks fully cleared) and scheme (0->58/92, still asterisked since the residual gap is real and not yet fully closed). Co-authored-by: Joe Esquibel <squid-protocol@users.noreply.github.com> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…races-lisp-check # Conflicts: # tests/golden_master_audit.json # tests/golden_master_zero_dep_audit.json
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
StructuralExtractor._slice_by_braces(Integration Mode B) chose its scope-delimiter characters viaif lang_id == "lisp":-- but"lisp"has never been a real key inLANGUAGE_DEFINITIONS(only"scheme"is), so that branch was unreachable dead code in production. Every real scheme file fell through to the curly-brace default; since scheme is entirely parenthesis-delimited, the downstream scope-body search never found an opener and silently discarded everyfunc_startmatch -- a 100% function-recall drop for the whole language, confirmed via the tri-comparison ledger'sscheme/function/existence/agree[ctags]_vs[gitgalaxy]shape (92 occurrences).func_startregex was never the problem (confirmed matching 31/31 standalone against real corpus source), andprism.py's comment stripping was confirmed clean too -- the drop was isolated specifically to this delimiter-selection branch via a live-pipeline before/after proof.lexical_family == "recursive_block_lisp"(scheme's real value) instead of the deadlang_idstring, so any future lisp-family language sharing this integration mode is covered automatically.test_detector_mode_b_lisp_family, which had been passing for the wrong reason: its mock language was literally named"lisp"(matching the dead check by construction) with a mocklexical_familyvalue the old code never actually consulted.Verification
defineforms ctags' scheme parser structurally misses (e.g.(module (create-bindings create-inits) (define (build-free-ref x) ...))) -- a genuine win, not a false-positive regression.tests/core_engine//tests/extraction/suite green (6747 passed).python tests/tools/crucible_check.py: full_precision PASS, zero_dependency PASS (after re-blessing golden masters for the real, expected output change on scheme/racket corpus files).ruff_audit.py --ci/mypy_audit.py --ci/ruff format --check: clean (verified my specific edits are format-clean; a large pre-existing, unrelated formatting drift intest_detector.pywas confirmed present even with my changes stashed out, and left untouched).Test plan
crucible_check.pydifferential scan clean (both venvs, post-reblessing)🤖 Generated with Claude Code