Skip to content

tree_sitter_accuracy_audit: ruby's _get_param_count whitelist missing 'keyword_parameter' (follow-on gap from #1339) #1506

Closed

Description

@squid-protocol

Summary

args_exact_match for ruby measures 89/117 (76.1%) in docs/self_scan/tree_sitter_accuracy_history.csv. Sampled mismatches undercount real arity, e.g. rails/blob.rb::url real=1 got=4 and rails/blob.rb::create_before_direct_upload! real=0 got=8, where GitGalaxy's own count (got) is correct in every sampled case.

Root cause

Issue #1339 added a per-language node-type whitelist to _get_param_count's counted_types tuple, including ruby's optional_parameter/splat_parameter/hash_splat_parameter/block_parameter -- but missed keyword_parameter, tree-sitter-ruby's node type for keyword arguments (name: value and bare name:), a distinct type from the positional-optional optional_parameter (name = value).

Confirmed via a live parse of:

def url(expires_in: 123, disposition: :inline, filename: nil, **options)

method_parameters children are keyword_parameter / keyword_parameter / keyword_parameter / hash_splat_parameter (4 total). Only hash_splat_parameter is in the current whitelist, so _get_param_count returns 1 instead of 4. Also confirmed both the optional form (key: nil) and the required form (filename:, no default) use the identical node type keyword_parameter in rails/blob.rb::create_before_direct_upload!'s 8-keyword-parameter signature -- no value-field branching needed, just add the one type name.

Reproduce: LANGUAGE_CRUCIBLE_PATH=/home/joe/nyx_projects/language-crucible python tests/tools/tree_sitter_accuracy_audit.py --lang ruby (no --ci) and read the "Sample args-count mismatches" section.

Suggested fix

Add "keyword_parameter" to the counted_types tuple in _get_param_count (tests/tools/tree_sitter_accuracy_audit.py), alongside the existing ruby entries, with a comment noting it covers both the optional (k: v) and required (k:) keyword-arg forms since tree-sitter-ruby uses one node type for both.

Out of scope

The "Sample extra" false-positive names in the same audit run (Anonymous_Block, __global_context__, module/class names like ActiveStorage::Blob appearing in the function list) are a separate func_start/class_start scoping issue, not part of this args-counting fix -- do not touch in this PR.

This only affects tests/tools/tree_sitter_accuracy_audit.py's own measurement accuracy (epic #1227/#1261), not GitGalaxy's actual args structural signature or risk scoring in any way.

Activity

  1. added
    bug
    testing
    core-engine
    threat: false-negative
    on Aug 13, 2026
  2. squid-protocol commented on Aug 14, 2026

    @squid-protocol
    OwnerAuthor

    Fixed by #1507 ('keyword_parameter' added to the ruby whitelist, see tests/tools/tree_sitter_accuracy_audit.py line ~1198). Closing as already resolved -- found while triaging the sweep backlog, PR merged but issue was never auto-closed.

  3. added this to the v2.4.8 milestone on Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginepriority: mediumtestingthreat: false-negative

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions