Skip to content

TypeScript func_precision_pct: Assignment Regex and Parameter Matching Bugs #1749

Description

@squid-protocol

The TypeScript precision is currently at ~85.6%. Investigation reveals a mix of actual regex bugs in GitGalaxy and measurement gaps in the audit script:

GitGalaxy Regex Bugs:

  • Assignment Regex Non-Consuming Lookahead: The assignment regex uses a non-consuming lookahead (?=...) to skip optional type annotations (like : Type = () =>). Because it's optional, it can falsely anchor on the last word of a complex type annotation that precedes the = sign instead of the actual variable name (e.g., capturing B in reduce: <A, B>(...) => B = ...).
  • Parameter Declarations Matched as Object Properties: The zero-prefix regex branch intended for object methods correctly matches things like method: () => {}. However, lacking parenthesis boundaries, it falsely triggers on function arguments with an arrow-function type annotation defined at the start of a line (e.g., f: (...a: A) => B), mistaking a parameter declaration for an object property holding a function.

Audit Script Ground-Truth Gaps (Not GitGalaxy's fault):

  • Missing Overload Signatures: The tree_sitter_accuracy_audit.py script is missing function_signature and method_signature from its TypeScript node types. GitGalaxy correctly flags them, but the audit script incorrectly counts them as "extra".
  • Missing Class Field Arrow Functions: Tree-sitter parses class fields like onmessage = (message) => {}; as a public_field_definition containing an arrow_function. The _get_node_name function lacks the logic to extract names from this specific parent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUnintended behavior or logic failure in the enginecore-engineModifications to the central physics and parsing enginetestingUnit, integration, and E2E pipeline verificationthreat: false-positiveAccuracy tuning: Engine incorrectly flagged safe code

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions