GitNexus/gitnexus/test/integration/resolvers
ReidenXerx 66ad5c4980 fix(typescript): anchor pair-with-arrow @declaration.function on inner arrow
Addresses the medium-severity finding in @abhigyanpatwari's review of #1175:
the four `pair`-with-arrow patterns in `query.ts` anchored
`@declaration.function` on the outer `pair` node instead of the inner
`arrow_function` / `function_expression`. For multi-action object literals
like Zustand's

    persist((set) => ({
      addItem:    (item) => doA(item),
      removeItem: (item) => doB(item),
      fetchData:  ()     => doC(),
    }))

`pass2AttachDeclarations.atPosition(pair.startLine, pair.startCol)`
resolved to the *parent* `(set) => ({...})` callback's scope (because the
pair node starts at the property-key token, before the inner arrow's
`@scope.function` range). All three pair-function defs landed in the
same parent's `ownedDefs`, and `resolveCallerGraphId.ownedDefs.find(...)`
returned the FIRST one — `addItem` — for every walk-up. Calls inside
`removeItem` and `fetchData` mis-attributed to `addItem`; those two
functions had zero outgoing CALLS edges in the registry-primary path.

Single-pair fixtures (`bump` in `store.ts`, `queryFn` in `query-hook.ts`)
masked the defect because there is no ambiguity when only one
Function-like def lives in the parent's `ownedDefs` — `find()` is
deterministic over a single-element set.

Fix: move the `@declaration.function` anchor from the outer `pair` to
the inner `arrow_function` / `function_expression`, mirroring the
`lexical_declaration` patterns above (`const fn = () => {}`). The def
then lands in the arrow's own scope's `ownedDefs`, the
`rangesEqual(anchor.range, innermost.range)` auto-hoist promotes the
binding to the parent scope (so importers + lookups still find the name
in the surrounding scope), and each pair-arrow becomes an independent
caller anchor in the walk.

Tests:

  * Updated `useFeature → fetchData` expectation to `queryFn → fetchData`
    in `typescript-hof-callbacks.test.ts`. The new attribution is
    structurally correct: `fetchData()` is called from inside the named
    pair-arrow `queryFn: () => fetchData()`. The pre-fix expectation
    only worked because the pair-pattern bug rerouted the walk past the
    syntactic owner.

  * Added `multi-action-store.ts` fixture with three pair-arrows
    (`addItem` / `removeItem` / `fetchData`) plus three top-level call
    targets (`doA` / `doB` / `doC`). Four new tests pin per-action
    attribution: positive (each action calls its own target), negative
    (no sibling leakage), exact-set (the full pair set is what we
    expect), and the regression fingerprint (`addItem → doB` MUST be
    empty).

Validation:

  * `REGISTRY_PRIMARY_TYPESCRIPT=1 vitest run` on
    typescript-hof-callbacks (12 tests, +4 new), typescript-jsx-as-call
    (7), typescript (236), typescript-finalize, typescript-cross-file-imports,
    call-attribution-issue-1166 (18), all scope-resolution unit suites:
    886/886 pass on registry-primary AND legacy DAG paths.
  * Legacy DAG attribution was already correct via @abhigyanpatwari's
    `tsExtractFunctionName` pair-parent handling (#1179, merged into this
    PR earlier); this fix brings the registry-primary path to the same
    behavior, restoring parity for multi-action objects.
  * `npx prettier --check .`, `tsc --noEmit`, and `eslint` clean on the
    three modified/added files.

Made-with: Cursor
2026-04-30 18:26:51 +03:00
..
api-deep-flow.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cobol.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cpp.test.ts Extract resolveMemberCall from resolveCallTarget (SM-11) (#744) 2026-04-09 09:52:12 +01:00
csharp.test.ts fix(scope-resolution): allow same-range Module-as-parent for top-level scopes (closes #1086) (#1087) 2026-04-27 11:06:54 +01:00
dart.test.ts [dart] Add call patterns for await, cascade, lambda, and widget-tree contexts (#801) 2026-04-13 11:21:11 +01:00
express-routes.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
go.test.ts fix(go): align worker CALLS source IDs for receiver methods (#1043) 2026-04-23 08:08:56 +01:00
helpers.ts fix(ci): allow expected legacy parity failures (#1099) 2026-04-27 06:59:18 +01:00
java.test.ts Extract resolveMemberCall from resolveCallTarget (SM-11) (#744) 2026-04-09 09:52:12 +01:00
javascript.test.ts feat(SM-9): Add lookupMethodByOwnerWithMRO using HeritageMap (#740) 2026-04-08 20:46:45 +01:00
kotlin.test.ts Extract resolveMemberCall from resolveCallTarget (SM-11) (#744) 2026-04-09 09:52:12 +01:00
php-response-shapes.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
php.test.ts SM-10: Add MRO fast path before D2 fuzzy widening in resolveCallTarget (#741) 2026-04-08 23:24:07 +01:00
python-mcp-tools.test.ts fix(mcp): project tool_map flows from handlers (#1113) 2026-04-27 17:13:02 +01:00
python.test.ts fix(ingestion): classify Python class methods as Method (#1102) 2026-04-27 09:04:50 +01:00
route-mapping.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
ruby-sequential-mixin.test.ts feat(ingestion): language-agnostic heritage extractor with config+factory pattern (#890) 2026-04-17 17:51:17 +01:00
ruby.test.ts feat(ingestion): language-agnostic heritage extractor with config+factory pattern (#890) 2026-04-17 17:51:17 +01:00
rust.test.ts Extract resolveMemberCall from resolveCallTarget (SM-11) (#744) 2026-04-09 09:52:12 +01:00
shape-check.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
swift.test.ts fix(swift): use official prebuilt parser runtime (#1130) 2026-04-28 09:57:42 +01:00
typescript-hof-callbacks.test.ts fix(typescript): anchor pair-with-arrow @declaration.function on inner arrow 2026-04-30 18:26:51 +03:00
typescript-jsx-as-call.test.ts fix(typescript): address review findings — formatting + tighter test assertions 2026-04-29 15:51:01 +03:00
typescript.test.ts fix(ingestion): two-channel binding lifecycle (closes #1066) + scope-resolution I8 hardening (#1082) 2026-04-26 12:16:09 +01:00
vue.test.ts feat(vue): Vue SFC support + destructured call result tracking (#604) 2026-04-03 14:18:55 +05:30