Skip to content

detector (ts/js): name a quoted method key after a modifier by the key, not the modifier (#3760) - #3764

Merged
squid-protocol merged 1 commit into
mainfrom
claude/optimistic-heisenberg-bta91d
Sep 26, 2026
Merged

squid-protocol merged 1 commit into
mainfrom
claude/optimistic-heisenberg-bta91d

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

Summary

Fixes #3760.

async "array-objects"() {} (zod packages/bench/compile-vs-arktype.ts:414) was extracted as a function named async.

Root cause: the brace-safe stream blanks the whole string literal, quotes included. So func_start sees async () { and captures the modifier as the name. TypeScript captures it through its name group. JavaScript's match has no group and simply ends at async.

Fix (gitgalaxy/core/detector.py): _ts_js_quoted_method_name runs only when the captured name, or the match's last token, is one of the existing _TS_JS_RESERVED_MODIFIER_KEYWORDS (#2278). It then reads the raw code right after it. If a quoted literal sits there before the parameter list (an optional <T> is allowed), the unit takes that key as its name.

  • Quotes kept: the name keeps its quotes ("array-objects"), the convention Groovy's quoted method names already follow in _extract_name. A quoted key can never be reached by a bare call, so it can't collide with another name in the call resolver.
  • Real modifier names unaffected: a method really named get() or static async() has no literal after the name, so it keeps its name. The test covers both.
  • ReDoS-safe: the new regex has bounded quantifiers and never crosses a line.

Not in scope: "plain-key"() {} with no modifier in front is still not extracted at all. The blanked key leaves nothing for func_start to match. That's a recall gap, not this naming bug, and belongs in a follow-up.

Measured on zod (TypeScript Level 2 gate, #3761)

before after
confident links judged 1,519 1,527
confident precision 99.6% 99.6%
recall 56.9% 57.2%
resolution recall 73.7% 73.8%
unmapped confident links 224 216

tests/call_graph_resolution_typescript_baseline.json is regenerated to lock this in.

Type of change

  • Bug fix
  • New feature / language support
  • Parsing or engine logic (gitgalaxy/core/detector.py, language_standards.py, prism.py, or a per-language rule)
  • Docs, tooling, or CI only
  • Other (describe above)

CI checklist

  • ruff (pinned 0.16.0) format is clean on the touched files. ruff_audit.py --ci and dead_key_audit.py --ci are OK.
  • tests/core_engine/test_detector.py passes, 201 tests including the new test_detector_ts_js_quoted_method_key_after_modifier_is_not_named_by_the_modifier. The TS/JS extraction and strict suites plus test_call_resolver.py pass, 405 tests.
  • crucible_check.py, zero-dependency: PASS, no golden-master drift. Full-precision could not run locally: this environment's network policy blocks tiktoken's cl100k_base download. Name extraction doesn't depend on the mode, so CI's crucible-audit (full-precision) is the check for that half.
  • tree_sitter_accuracy_audit.py --ci --all: all OK, 30 languages.
  • CLI output schema unchanged.

Differential Scan target

https://github.com/colinhacks/zod (pinned in tests/import_graph_corpus.json)

Verification

$ galaxyscope <fixture> --db-only --debug   # [WORKER-TRACE] extracted functions
before  b.ts: ['async', 'normal']
after   b.ts: ['"array-objects"', 'normal', "'single-q'", 'get', 'async']   # same for .js
$ PYTHONPATH=$PWD python tests/tools/call_graph_resolution.py typescript --ci
| typescript | tsc | 99.6% (1527 judged) | 54.5% | 57.2% | 73.8% |
$ python tests/tools/crucible_check.py
✅ zero_dependency: PASS
$ python tests/tools/tree_sitter_accuracy_audit.py --ci --all
tree_sitter_accuracy_audit --all: all OK.   (30 languages)

🤖 Generated with Claude Code

https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt


Generated by Claude Code

…y, not the modifier (#3760)

`async "array-objects"() {}` (zod packages/bench/compile-vs-arktype.ts:414)
was extracted as a function named `async`. The brace-safe stream blanks the
whole string literal, quotes included, so func_start saw
`async                 () {` and captured the modifier as the name
(typescript through its name group, javascript through the bare match).

_ts_js_quoted_method_name reads the key back from the raw code when the
captured name is one of _TS_JS_RESERVED_MODIFIER_KEYWORDS and a quoted
literal sits between it and the parameter list (bounded regex). The name
keeps its quotes, as groovy's quoted method names already do; a quoted key
is never reachable by a bare call, so it cannot collide in the resolver.
A method really named `get()`/`async()` has no literal there and keeps its
name.

zod (TypeScript Level 2 gate): 1,519 -> 1,527 judged confident links,
recall 56.9% -> 57.2%, unmapped 224 -> 216; baseline regenerated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01AbvXUJpva5XxxbssoKG9Jt
@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 7b511e4 into main Sep 26, 2026
34 checks passed
@squid-protocol
squid-protocol deleted the claude/optimistic-heisenberg-bta91d branch September 26, 2026 18:07
@squid-protocol squid-protocol added this to the Compiler call-graph comparison milestone Sep 26, 2026 — with Claude
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.

[TypeScript] func_start names a quoted method async "array-objects"() {} as async

2 participants