Repository navigation
Description
Summary
Continuing the typescript func_start diagnosis from #1629 (same 159-miss diff, same corpus): a second, distinct root cause accounts for the rest of the recall gap not covered by #1629's brace-less-body drop — func_start's parameter-list terminator breaks on a nested ( inside a parameter's own type annotation (i.e. any callback-typed parameter), causing the whole signature to go unmatched at the regex level, not just misrecorded.
Root cause
gitgalaxy/standards/language_standards.py's typescript func_start rule's zero-prefix branch (the one that matches bare method names like constructor(...)) closes its parameter list with:
\([^)]*\)[^=;{]*=>[ \t\n]{0,50})?\{|:[^{;]{0,200}[ \t\n]{0,50};))
i.e. \([^)]*\) — a flat, non-nesting character class. If any parameter's own type annotation contains a ) (which any callback/arrow-typed parameter does — (x: () => void) has an inner ()), the class stops at the first ) it sees, which is the inner callback's, not the real closing paren of the outer parameter list. The match then fails to find its terminator and the entire function/method/constructor signature is dropped — this is a regex-level non-match, confirmed directly (not a downstream _slice_by_braces issue like #1629):
>>> rule.search("constructor(a: number) {")
<re.Match ...> # matches fine
>>> rule.search("constructor(transport: ConnectionTransport, onDisconnect: () => void) {")
None # nested `()` in the 2nd param breaks it
>>> rule.search("addObjectListener(eventName: (string | symbol), handler: (...args: any[]) => void) {")
None # same shape, non-constructor methodThis isn't a rare shape — callback-typed parameters (onClose: () => void, handler: (err: Error) => void, event-emitter-style constructors) are idiomatic TypeScript, especially in class constructors that wire up dependency callbacks.
Evidence
19 of the 159 found_functions misses are named exactly constructor and land in files that follow this pattern, e.g. language-crucible/data/typescript/playwright/bidiConnection.ts:48:
constructor(transport: ConnectionTransport, onDisconnect: () => void, protocolLogger: ProtocolLogger, browserLogsCollector: RecentLogsCollector) {Verified via a single-file galaxyscope --db-only scan of bidiConnection.ts: function_data has zero rows named constructor for the whole file (both classes' constructors, lines 48 and 169, missing), while every other real method in the file (nextMessageId, rawSend, send, etc. — none with a nested-paren param) is found correctly.
The same shape also drops non-constructor methods, not just constructors — e.g. language-crucible/data/typescript/playwright/dispatcher.ts:89:
addObjectListener(eventName: (string | symbol), handler: (...args: any[]) => void) {Suggested fix direction
Same class of fix already applied elsewhere in this same regex for balanced-generic step-overs ((?:[^<>]|<[^<>]*>)* tolerates one level of <> nesting) — extend the parameter-list class to tolerate one level of nested parens: \((?:[^()]|\([^()]*\))*\), bounded the same way the generic step-over is, to avoid reintroducing a ReDoS shape (Rule 11 in how_to_add_a_language.md).
Filed under epic #1261, alongside #1629 (same corpus/diagnosis pass, different root cause).
Activity
uuzzrm commentedon Aug 15, 2026
Opened a PR for this: #1639
Went with the nested-paren approach you suggested in the issue (one level, same shape as the generic step-over). Typescript audit numbers moved from 1843 -> 1876 found / 309 -> 299 extra, and the baseline is updated to match.