Skip to content

fix(dart): 100% function precision — clear the last 9 tri-comparison discrepancies - #2473

Merged
squid-protocol merged 1 commit into
mainfrom
dart-func-precision
Aug 30, 2026
Merged

fix(dart): 100% function precision — clear the last 9 tri-comparison discrepancies#2473
squid-protocol merged 1 commit into
mainfrom
dart-func-precision

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Follow-up to #2470. dart was the only tree-sitter-comparable language below 100.0% validated function precision (9 discrepancies in the dart/function/existence/agree[gitgalaxy]_vs[tree_sitter] ledger shape). All 9 are now resolved and the shape flips to still_reproduces: false.

Every tree-sitter-comparable language is now at 100.0% on both function recall and validated function precision.

Root causes

# Cause Count Fix location
1 Redirecting factory constructorsfactory Foo.named(...) = _NamedFoo; parses as redirecting_factory_constructor_signature, missing from the audit's ground-truth node registry. GitGalaxy is correct; the audit wasn't counting them. 2 tree_sitter_accuracy_audit.py (NODE_MAPS + _get_node_name + _get_param_count)
2 in / on leaking through the return-type token loop — both are dart keywords omitted from the interior exclusion lists, so in nodeToEnsureGeometry.toList()… / on RenderObject { consumed the keyword and named the next identifier. 2 language_standards.py (8 exclusion lists)
3 Expression-position matches across a continuation line — the return-type token class (., ?, balanced (…)) swallows a whole method-call chain: x?.foo(a) ??\n Type.method(b) reads as <return type> <name>(. 5 detector.py — new dart expression-position guard, mirroring the existing TS ?/(-preceded guards

The category-3 guard drops a match whose consumed return-type prefix contains ?? / && / || / .. / a bare ! / a spaced ternary ? / a lowercase .method( call, or whose name is directly preceded by one of those operators. A real dart return type is a single type expression and contains none of them; Foo? bar() (attached ? = nullable type) is unaffected.

Result

  • dart extra_functions 9 → 0, found_functions 1748 → 1750, args_exact_match 1748 → 1750
  • summary table: Dart function precision 99.5% → 100.0% (all four metrics now 100%)
  • why_gitgalaxy_beats_ast_here.md Claim 5 extended (redirecting factory constructors — same "node type the naive ground-truth walk never registered" mechanism as getters/setters/operators)

Differential Scan

  • pytest tests/extraction/ tests/core_engine/ — 6808 passed
  • dart _strict — 198 passed; explicit ReDoS timing check on the new guard — linear
  • audit_check.py — clean
  • tree_sitter_accuracy_audit --all --ci — clean (dart baseline regenerated; real_functions +2 is the intentional ground-truth addition, gated metrics only improved)
  • crucible_check.py --mode both — both golden masters re-blessed (editable_text.dart, object.dart, navigator.dart) and re-verified green
  • tri-comparison chart / ledger / report regenerated --all --write — dart drops out of points_of_interest entirely; the one moved shape flips to still_reproduces: false

🤖 Generated with Claude Code

https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S

…discrepancies

Follow-up to #2470. dart was the only language below 100.0% validated function
precision. All 9 `agree[gitgalaxy]_vs[tree_sitter]` discrepancies are now
resolved; the shape flips to `still_reproduces: false`. Every tree-sitter-
comparable language is now at 100.0% on both function recall and precision.

Three root causes:

1. **Redirecting factory constructors (2) — audit blind spot, not an engine
   bug.** `factory Foo.named(...) = _NamedFoo;` parses as
   `redirecting_factory_constructor_signature`, a node type absent from the
   audit's `NODE_MAPS["dart"]["func_node_types"]` and unhandled in
   `_get_node_name` / `_get_param_count`. GitGalaxy's `func_start` finds all of
   them; the audit just wasn't counting them, so they read as phantom
   `extra_functions` (`flutter/navigator.dart`'s `_RestorationInformation.named`
   / `.anonymous`). Registered the node type — the redirect target is a
   `type_identifier` child after `=`, never an `identifier`, so the existing
   join-direct-`identifier`-children logic already yields the right `Foo.named`.
   Same mechanism as Claim 5 (getter/setter/operator); documented there.

2. **`in` / `on` leaking through the return-type token loop (2).** Both are dart
   keywords the interior keyword-exclusion lists omitted, so
   `in nodeToEnsureGeometry.toList()...` and `on RenderObject {` (a mixin `on`
   clause) got consumed as type tokens and the next identifier named. Added to
   all 8 exclusion lists (same spots as #2462's `extension` narrowing).

3. **Expression-position matches across a continuation line (5).** The
   return-type-prefix token class (`.`, `?`, balanced `(...)`) swallows a whole
   method-call chain: `x?.foo(a) ??\n Type.method(b)` reads as
   `<return type> <name>(`. New detector guard (dart, mirroring the existing TS
   `?`/`(`-preceded guards): drop a match whose consumed return-type prefix
   contains `??` / `&&` / `||` / `..` / a bare `!` / a spaced ternary `?` / a
   lowercase `.method(` call, or whose name is directly preceded by one of those
   operators. A real dart return type is a single type expression and never
   contains any of them; `Foo? bar()` (attached `?`) is unaffected.
   (`TextStyle`, `TextInput.attach`, `_scrollableNotificationIsFromSameSubtree`,
   `_intersectRects`, `targetFrameMatch.group`.)

dart: extra_functions 9 -> 0, found_functions 1748 -> 1750, args_exact_match
1748 -> 1750. Regenerated: dart baseline + summary table (Dart precision
99.5% -> 100.0%), both golden masters (editable_text.dart, object.dart,
navigator.dart), tri-comparison chart/ledger/report. Docs: RECALL_AUDIT block,
why_gitgalaxy_beats_ast_here.md Claim 5.

Full Differential Scan: pytest tests/extraction/ tests/core_engine/ (6808
passed), dart _strict (198 passed) + ReDoS timing check, audit_check clean,
tree_sitter_accuracy_audit --all --ci clean (dart only), crucible_check
--mode both re-blessed and green.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol merged commit f4c1114 into main Aug 30, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the dart-func-precision branch August 30, 2026 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant