Files
codegraph/__tests__
Colby McHenry 082353eb7f fix(impact): gate cross-known-family references/imports (TS↔native name collisions)
The cross-language gate added in dbc4862 covered only `references` edges from
the import/name-match strategies. Two holes remained, both surfaced validating
react-native-async-storage (a TS `type TestRunner` colliding with a Kotlin
`class TestRunner`):

1. Framework strategy was ungated. The React PascalCase component resolver
   name-matches `getNodesByName` with no language check (its COMPONENT_KINDS
   includes `class`), so a TS ref to `TestRunner` resolved onto the Kotlin
   class at confidence 0.8 — outranking the cross-language-penalized (0.5) TS
   name-match. Same hole for Svelte/Vue.
2. `imports` edges were never gated (only `references`), so a TS `import React`
   matched a Swift `React`, and a C++ `#include "X.h"` matched a same-named
   ObjC header on another platform (basename collision).

Adds `crossesKnownFamily` (both sides in a KNOWN family — jvm/apple/web/c — and
different) and applies it:
- `gateFrameworkLanguage`: new gate on the framework strategy for
  references/imports. Both-known so config↔code bridges (yaml/blade side is not
  a known family) and `calls` bridges (different kind) are untouched.
- `gateLanguage` (strategies 2/3): extended to also gate `imports`. Both-known
  so a `.vue`/`.svelte` file (own language tag) importing a `.ts` module is left
  alone, while a C++→ObjC header basename collision is dropped.
- `applyLanguageGate` (name-match candidates): filters `imports` candidates too,
  so a ref RE-POINTS to the same-family target instead of merely dropping.

Validated: async-storage cross-known-family references/imports → 0 (the 6 TS
refs + 5 imports re-point to the TS type); rn-device-info JS↔native `calls`
bridges intact (91 JS→Java, 37 JS→ObjC, full Java↔ObjC↔C++ pairing). Node count
unaffected (edge-resolution change only). Two regression tests added (both fail
without the fix). Full suite 1167 passed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-04 15:48:26 -04:00
..