Repository navigation
Description
What
Measuring GitGalaxy's own args-count accuracy against Python's ast module as ground truth
(same corpus/methodology as #1198 and docs/language_status/python.md §9): of the 2333 real
Python functions GitGalaxy's extraction correctly finds by name, only 757 (32.4%) have the
right parameter count recorded in function_data.args. This number is essentially unchanged
before and after #1193 (which fixed comment-stripping, not args-counting) -- it's a distinct,
separate bug.
Two clear, different failure shapes in the mismatches, not one uniform "off by a bit" error:
1. Simple single-line signatures overcounted, often by exactly 1:
gitgalaxy/cobol_refractor_controller.py::main real=0 got=2
gitgalaxy/cobol_refractor_controller.py::_init_sql_schema real=1 got=2
gitgalaxy/cobol_refractor_controller.py::close real=1 got=2
gitgalaxy/cobol_to_java_controller.py::format_java_header real=1 got=3
def main(): (zero real parameters) is recorded as 2 args. This looks like the args regex
capturing something inside the parameter list that isn't a real parameter (a default value
expression, a type-hint's own internal comma, or similar) and miscounting commas/tokens as
separate arguments.
2. Multi-line signatures zeroed out entirely:
gitgalaxy/core/detector.py::__init__ real=4 got=0
gitgalaxy/core/detector.py::splice real=6 got=0
gitgalaxy/core/detector.py::_slice_by_indentation real=5 got=0
gitgalaxy/core/detector.py::_slice_by_braces real=6 got=0
These are real, ordinary methods whose def line's parameter list spans multiple physical
lines (long parameter lists with type hints, e.g. detector.py's own coding_analysis). The
args extraction appears to simply fail to match anything across a line break, recording 0
instead of the real count -- a much more severe failure than the overcount case above, since it
silently reports "no parameters" for functions that clearly have several.
Impact
This means args-derived signals (encapsulation heuristics, complexity scoring inputs, anything
downstream keyed on parameter count) are unreliable for roughly two-thirds of this corpus's
functions. Function recall (finding that a function exists) is unaffected -- this is purely
about the accuracy of one specific field once a function is already found.
How this was found
Same pass as #1198: diffing a fresh full self-scan against ast.parse()'s real
FunctionDef.args parameter counts (posonlyargs + args + kwonlyargs + 1 each for */** ),
corpus-wide across this repo's 228 Python files, immediately after #1193 merged.
Suggested next step
Not yet root-caused. Two separate investigations given the two distinct failure shapes:
- For the overcount case, isolate why
def main():(a real zero-arg signature) parses to 2 --
check whether theargsregex/parser is picking up trailing content after the closing paren,
or miscounting an empty/whitespace-only parameter list. - For the multi-line zeroing, confirm whether the
argscapture is anchored to a single
physical line (nore.M/re.Sspanning) and, if so, whether it can be safely extended to
match across a parenthesized multi-line signature the same wayfunc_startalready does
(per its own docstring,func_startalready steps over decorators and PEP 695 generics
across multiple lines --argsextraction may need the same treatment).
Also worth checking whether this repro-confirmed pattern generalizes past Python -- the
args rule key exists for every language, and multi-line signatures are common in strongly
statically-typed languages (Java, C#, TypeScript, Rust) too.
Activity
ci(core): add AST-accuracy baseline-gated regression check (#1200)
fix(core): resolve line_exclusive comment delimiters per-language, no…
fix(core): correct function_data.args counting for Python (#1199)
fix(core): correct function_data.args counting for Python (#1199) (#1207
fix(core): add args regex capture group for 13 languages (#1209) (#1212)
fix(core): add args regex capture group for 7 more languages (#1209) (#…
fix(core): zig args accuracy 75.8% -> 100% (bare-body param-list capt…