Skip to content

fix(recall): dart/typescript/lua reach 100% function recall — close the last residuals - #2470

Merged
squid-protocol merged 1 commit into
mainfrom
dart-ts-recall-residuals
Aug 30, 2026
Merged

fix(recall): dart/typescript/lua reach 100% function recall — close the last residuals#2470
squid-protocol merged 1 commit into
mainfrom
dart-ts-recall-residuals

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Follow-up to #2467. Closes every remaining tree-sitter-comparable function-recall gap: all 31 languages with a tree-sitter baseline now measure 100.0% function recall against the pinned corpus. GitGalaxy ties or beats tree-sitter and Universal Ctags on function detection everywhere.

Language func recall
dart 99.9% → 100.0%
typescript 99.9% → 100.0%
lua 99.8% → 100.0%

Changes

#2462 dart — a method named extension

T? extension<T>() => … (theme_data.dart:993). extension is a built-in identifier, excluded across all 8 of dart func_start's keyword lists to reject real extension Foo on Bar { / extension type declarations. Narrowed to extension(?![ \t\n]*[(<]) — a real declaration is always extension <name> / extension type / extension on, never extension( or extension<. Verified: real extension decls (named, anonymous, generic, extension-type) still route to class_start, not func_start.

#2464 typescript — two shapes

  • createInstance<Ctor extends new (...args: any[]) => unknown, R extends InstanceType<Ctor>>(…): R; (instantiationService.ts:117) — a bodyless overload signature whose type-parameter list contains a function type. The zero-prefix branch's generic step-over truncated at the > of the inner =>. Made it =>-tolerant; alternatives stay mutually exclusive on their first char (=> vs =(?!>) vs [^<>=] vs <), so still linear (Rule 11). The mandatory :Type; / { terminator keeps a bare generic call statement (useCallback<() => void>(cb);) from matching.
  • cursorStateComputer = () => null; (codeEditorWidget.ts:1295) — GitGalaxy counted = () => endCursorState but not = () => null because null/undefined were blacklisted as arrow-body-start tokens. In the IDENT = (assignment) branch the body is always a value, so those two are no longer excluded there; the :-annotated member-signature branch (where () => null can be a real return type) keeps them.

#2461 / #2437 lua — local function lexerror erased before extraction

literals.lua is the escape-sequence torture fixture. t("[=[alo]]") puts a [=[ inside a string literal; _LUA_LONG_BRACKET_RE matched it as a real opener and scanned 87 lines for its ]=]. Separately, blanking a quoted "[[…]]" test string to "" collapsed it to four bare quotes that then read as a Python triple-quote and swallowed lines 48–114 — lexerror's declaration among them. The long-bracket shield now skips an opener sitting inside an unclosed single-line quote (_lua_lb_opener_in_string, applied in both _apply_literal_shield and _mask_lua_long_brackets / prism).

Also closes #2437: its symptom class (Mode-D _[Truncated] satellites) was already gone corpus-wide; this removes the last real miss it accounted for.

Differential Scan

  • pytest tests/extraction/ tests/core_engine/ — 6808 passed
  • per-language _strict ReDoS gauntlets (dart/typescript/javascript/lua) — 649 passed; explicit ReDoS timing check on the new TS generic step-over — linear
  • audit_check.py — clean (ruff format applied to detector.py)
  • tree_sitter_accuracy_audit --all --ci — 31 languages OK, only dart/lua/typescript improved; baselines + summary table regenerated
  • crucible_check.py --mode both — both golden masters re-blessed (theme_data.dart, instantiationService.ts, codeEditorWidget.ts, literals.lua) and re-verified green
  • tri-comparison chart / ledger / report regenerated --all --write — the three "GG behind tree-sitter" existence shapes (dart/lua/typescript) all flip to still_reproduces: false; every other movement is an improvement

Closes #2462, closes #2464, closes #2437.

🤖 Generated with Claude Code

https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S

…he last residuals

Follow-up to #2467. Clears every remaining tree-sitter-comparable recall gap;
`tree_sitter_accuracy_audit --all --ci` is clean across 31 languages and **every
one now has 100.0% function recall** against the pinned corpus.

- #2462 dart — a method literally named `extension` (`T? extension<T>() =>`,
  flutter/theme_data.dart:993). `extension` is a built-in identifier, excluded
  in all 8 of dart `func_start`'s keyword lists to reject real `extension Foo
  on Bar {` / `extension type` declarations. Narrowed the exclusion to
  `extension(?![ \t\n]*[(<])` — a real declaration is always `extension <name>`
  / `extension type` / `extension on`, never `extension(` or `extension<`.
  dart func recall 99.9% → 100.0%.

- #2464 typescript, two more shapes:
  * `createInstance<Ctor extends new (...args: any[]) => unknown, R extends
    InstanceType<Ctor>>(...): R;` (instantiationService.ts:117) — a bodyless
    overload signature whose type-parameter list contains a function type. The
    zero-prefix branch's generic step-over truncated at the `>` of the inner
    `=>`. Made it `=>`-tolerant (`=>` / lone `=` as explicit tokens, alternatives
    still mutually exclusive on first char → linear). The mandatory `:Type;`/`{`
    terminator keeps a bare generic call statement out.
  * `cursorStateComputer = () => null;` (codeEditorWidget.ts:1295) — GitGalaxy
    counted `= () => endCursorState` but not `= () => null`, because `null` /
    `undefined` were blacklisted as arrow-body-start tokens. In the `IDENT =`
    (assignment) branch the body is always a value, so those two are no longer
    excluded there (the `:`-annotated member-signature branch keeps them).
  typescript func recall 99.9% → 100.0%.

- #2461 / #2437 lua — `local function lexerror` (literals.lua:80) was erased
  before extraction. `literals.lua` is the escape-sequence torture fixture:
  `t("[=[alo]]")` puts a `[=[` INSIDE a string literal, which the long-bracket
  shield (`_LUA_LONG_BRACKET_RE`) matched as a real opener and scanned 87 lines
  for its `]=]`; separately, blanking a quoted `"[[...]]"` test string to `""`
  collapsed it to four bare quotes that then read as a Python triple-quote and
  swallowed lines 48–114 (the `lexerror` declaration among them). The
  long-bracket shield now skips an opener that sits inside an unclosed
  single-line quote (`_lua_lb_opener_in_string`, applied in both
  `_apply_literal_shield` and `_mask_lua_long_brackets` / prism). lua func
  recall 99.8% → 100.0%. Closes #2437 (its symptom class — no `_[Truncated]`
  satellites anywhere in the corpus — was already gone; this removes the last
  real miss it accounted for).

Regenerated: tree-sitter baselines (dart/lua/typescript) + summary table, both
golden masters (theme_data.dart, instantiationService.ts, codeEditorWidget.ts,
literals.lua), tri-comparison chart/ledger/report — the three "GG behind
tree-sitter" existence shapes (dart/lua/typescript) all flip to
`still_reproduces: false`. Docs: RECALL_AUDIT block, lua status doc.

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 bd27a19 into main Aug 30, 2026
30 checks passed
@squid-protocol
squid-protocol deleted the dart-ts-recall-residuals branch August 30, 2026 01:16
squid-protocol added a commit that referenced this pull request Aug 30, 2026
…discrepancies (#2473)

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.


Claude-Session: https://claude.ai/code/session_019Zm1uVBpVEZJ9SB7bWFR8S

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment