Skip to content

rust func_start misses bodyless multi-line trait method signatures (deserialize_* family) #1319

Closed

Description

@squid-protocol

What

Investigating #1311's rust extra_functions false positives required adding
function_signature_item (tree-sitter-rust's node type for a bodyless fn -- a trait
method requirement ending ; instead of { ... }) to tree_sitter_accuracy_audit.py's
NODE_MAPS, since two genuine false positives (IntoDeserializer::into_deserializer,
Deserializer::struct_variant) were bodyless trait signatures the audit tool's ground truth
was blind to, not real GitGalaxy regex defects.

That fix also raised real_functions for rust from 1457 to 1493 (+36) in language-crucible,
but found_functions only rose from 1453 to 1455 (+2) -- newly exposing a real, pre-existing
GitGalaxy recall gap
: 34 of those 36 newly-ground-truthed bodyless trait signatures are NOT
matched by rust's func_start regex. Rust's measured func recall dropped 99.7% -> 97.5% in the
baseline as a result (see tests/tree_sitter_accuracy_baseline_rust.json,
gitgalaxy/standards/language_standards.py's summary table).

Same pattern as #1266/#1302: fixing a measurement gap exposed a previously-invisible, real
detector gap as a side effect. Not caused by #1311's own changes (which only touch the audit
tool + baselines, no detector.py/language_standards.py regex changes) -- filed separately
since it's a recall (found_functions) issue, distinct in scope from #1311's precision
(extra_functions) investigation.

Evidence

All 34 missing names are in a single file/shape:
language-crucible/data/rust/serde/serde_core_de_mod.rs, e.g.:

fn deserialize_any<V>(self, visitor: V) -> Result<V::Value, Self::Error>
where
    V: Visitor<'de>;

Every miss is a multi-line trait method signature: the fn line has no {, the signature
continues onto a separate where clause line, and the whole thing terminates with ;. Rust's
func_start regex/slicing apparently assumes a { body is reachable within its search window
and silently drops the match when the terminator is ; after a where clause instead.

(3 additional wasmtime misses -- eat/expect/is in wasmtime_isle_parser.rs,
call_start in wasmtime_pulley_interp.rs -- are pre-existing, already present in the
baseline before this investigation; not part of this issue's scope, may share a root cause or
may not.)

Suggested next step

Trace rust's func_start Mode B (_slice_by_braces) handling in
gitgalaxy/standards/language_standards.py / gitgalaxy/core/detector.py for the
bodyless-trait-signature-with-where-clause shape -- likely wants a scala-style (#1266) or
csharp-style (#789) "no-brace-body, bounded by next terminator" branch, this time keyed on ;
rather than =>/bare =. Verify via tests/tools/crucible_check.py +
tests/tools/tree_sitter_accuracy_audit.py --lang rust before regenerating the baseline.

Related: #1311, #1266, #1261 (parent epic).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcore-enginetesting

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions