Repository navigation
Description
Summary
While fixing dockerfile's func_start recall (Mode B brace-search silently dropping most real
functions because Dockerfile has no brace-delimited bodies -- the routing fix adds dockerfile
to detector.py's Mode A tuple, see the sibling PR/issue for that fix), a quick sweep of the
other lexical_family: "line_exclusive" languages not already special-cased in
_function_slice's routing (gitgalaxy/core/detector.py, ~line 1888) turned up at least two more
languages with the identical bug shape, confirmed via the same direct measurement
(galaxyscope --db-only, SUM(struct_func_start) vs SUM(function_count) across each
language's real language-crucible corpus):
| Language | Raw signal (struct_func_start) | Named function list (function_count) | Recall |
|---|---|---|---|
| jcl | 3 | 0 | 0% |
| m4 | 39 | 1 | 2.6% |
| makefile | 1 | 1 | 100% (but only 1 real match in the whole corpus -- too small a sample to confirm or rule out) |
Why this is the same bug, not a new one
None of these languages have brace-delimited function bodies in their real syntax:
- jcl:
func_startmatches// <name> EXEC ...job-step lines
(^[ \t]*//([A-Za-z0-9_#$@]*)[ \t]+EXEC\b) -- JCL is fixed-column mainframe syntax with no
brace concept anywhere. - m4:
func_startmatchesdefine(...)/m4_define(...)/autoconf'sAC_DEFUN(...)etc.
(^[ \t]*(?:m4_define|define|AC_DEFUN|...)\s*\(...\)) -- m4 macro definitions are
parenthesis-delimited with backtick/bracket quoting, not brace-delimited. - makefile:
func_startmatches atarget:/target::rule header -- the recipe body is
tab-indented lines below it, not a brace-delimited block (unless a recipe's own shell command
happens to contain literal{/}, the exact same coincidental-match risk dockerfile had with
${VAR}).
All three are lexical_family: "line_exclusive" (same as dockerfile) but aren't in
_function_slice's explicit Mode A routing tuple (assembly, agc_assembly, cobol,
fortran, abap, and now dockerfile), so they fall through to Mode_B_Braces, which only
"succeeds" when a { happens to appear by coincidence within the bounded search window -- the
exact mechanism diagnosed for dockerfile (and previously abap #1899, scheme #1157-ish).
Suggested fix
Same shape as the dockerfile fix: add jcl and m4 to the Mode A (_slice_by_labels) routing
tuple in gitgalaxy/core/detector.py's _function_slice (each instruction/definition's real
body legitimately ends at the next func_start match, the same "greedy to next match" heuristic
already proven for abap/cobol/fortran/assembly/dockerfile). makefile needs a bigger corpus
sample before concluding either way -- worth checking with a larger/second makefile corpus before
deciding whether it needs the same routing change or is genuinely fine as-is.
Full verification chain required per CLAUDE.md's Differential Scan protocol (extraction gauntlet
- strict tests per language, ruff/mypy audits,
crucible_check.pyagainst the full corpus, both
golden masters re-blessed) -- not bundled into the dockerfile fix since it's a distinct scope
decision (3 more languages, not yet confirmed how many real corpus occurrences are affected
repo-wide).
Note
jcl is also one of the 5 gg-only languages (abap, dockerfile, jcl, livecode, yaml -- neither
tree-sitter nor ctags) covered by the tri-comparison-ledger-sweep skill's manual-verification
fallback, so fixing this would be a natural next target for that same skill/procedure.
Activity
fix(yacc): route grammar-rule slicing through Mode A; map ctags 'l' k…
fix(core-engine): Rosetta sweep batch 2 — nine slicer/regex/DAG fixes…