fix(dart): 100% function precision — clear the last 9 tri-comparison discrepancies - #2473
Merged
Conversation
…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
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 tostill_reproduces: false.Every tree-sitter-comparable language is now at 100.0% on both function recall and validated function precision.
Root causes
factory Foo.named(...) = _NamedFoo;parses asredirecting_factory_constructor_signature, missing from the audit's ground-truth node registry. GitGalaxy is correct; the audit wasn't counting them.tree_sitter_accuracy_audit.py(NODE_MAPS+_get_node_name+_get_param_count)in/onleaking through the return-type token loop — both are dart keywords omitted from the interior exclusion lists, soin nodeToEnsureGeometry.toList()…/on RenderObject {consumed the keyword and named the next identifier.language_standards.py(8 exclusion lists).,?, balanced(…)) swallows a whole method-call chain:x?.foo(a) ??\n Type.method(b)reads as<return type> <name>(.detector.py— new dart expression-position guard, mirroring the existing TS?/(-preceded guardsThe 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
extra_functions9 → 0,found_functions1748 → 1750,args_exact_match1748 → 1750why_gitgalaxy_beats_ast_here.mdClaim 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_strict— 198 passed; explicit ReDoS timing check on the new guard — linearaudit_check.py— cleantree_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--all --write— dart drops out ofpoints_of_interestentirely; the one moved shape flips tostill_reproduces: false🤖 Generated with Claude Code
https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S