Repository navigation
Description
What
_get_param_count() in tests/tools/tree_sitter_accuracy_audit.py measures GitGalaxy's args
signature extraction against tree-sitter as ground truth. For python, function_definition
resolves its parameter list directly via the parameters field (the same top-level branch C-family
and JS-family languages use), but the counted_types whitelist that branch checks against only
included generic/JS-shaped node type names (identifier, assignment_pattern, etc.) — none of
tree-sitter-python's own per-parameter wrapper types.
python's grammar wraps every non-bare parameter in one of five python-specific node types that
were missing from the whitelist:
typed_parameter(x: int)default_parameter(x=1)typed_default_parameter(x: int = 1)list_splat_pattern(*args)dictionary_splat_pattern(**kwargs)
Only a fully bare x (no annotation, no default) parsed as identifier and was ever counted.
Confirmed via direct tree-sitter-python parse:
def foo(a, b: int, c=1, d: str = "x", *args, e, **kwargs):
real arity is 7; pre-fix _get_param_count measured 2 (only a and e).
This is the same false-defect shape as #1319/#1339 (per-language node-type gaps in this same
whitelist), just never caught for python because python routes through the generic top-level
parameters-field branch instead of one of the special-cased fallback branches those issues
audited.
Impact
This is a bug in the audit tool, not GitGalaxy's own args regex — _count_top_level_args in
detector.py was already counting these correctly. But because the tool undercounted the "real"
ground truth for any function using type hints, defaults, or splat args (i.e. most real-world
Python), it manufactured a large volume of false args-count mismatches: args_exact_match on the
language-crucible python corpus measured 63.0% (1868/2966 comparable), tracked in
docs/self_scan/tree_sitter_accuracy_history.csv and gating tests/tree_sitter_accuracy_baseline_python.json.
Note: this is distinct from the python args-accuracy figure in docs/language_status/python.md §9
(~35%, ast-based, the actual CI gate for python's engine accuracy, downstream of #1193's
comment-truncation bug) — that ast-based counter already summed
posonlyargs+args+kwonlyargs+vararg+kwarg correctly and is unaffected by this issue. This issue is
scoped to the separate tree-sitter-based comparison used for --history/--chart uniformity only.
Fix
Add the five python-specific node types to _get_param_count's counted_types whitelist.
Deliberately excludes positional_separator (bare /) and keyword_separator (bare * with no
following name) — both are arity markers, not parameters, matching the convention GitGalaxy's own
_count_top_level_args already uses.
Verified post-fix: args_exact_match rises to 98.6% (2926/2966 comparable), no regressions on
the other gated metrics (found_functions/extra_functions/found_classes/extra_classes
unchanged since those don't touch _get_param_count).
Fix + baseline regeneration in progress on branch fix/python-tree-sitter-args-node-types.
Activity
fix(tests): python's _get_param_count only counted bare identifiers (#…