Skip to content

fix(impact): add HAS_METHOD and OVERRIDES to VALID_RELATION_TYPES#350

Merged
magyargergo merged 2 commits into
abhigyanpatwari:mainfrom
karesansui-u:fix/impact-valid-relation-types
Mar 18, 2026
Merged

fix(impact): add HAS_METHOD and OVERRIDES to VALID_RELATION_TYPES#350
magyargergo merged 2 commits into
abhigyanpatwari:mainfrom
karesansui-u:fix/impact-valid-relation-types

Conversation

@karesansui-u

Copy link
Copy Markdown
Contributor

Summary

The impact tool description advertises 6 edge types:

EdgeType: CALLS, IMPORTS, EXTENDS, IMPLEMENTS, HAS_METHOD, OVERRIDES

But VALID_RELATION_TYPES in local-backend.ts only contains 4:

export const VALID_RELATION_TYPES = new Set(['CALLS', 'IMPORTS', 'EXTENDS', 'IMPLEMENTS']);

When a user passes relationTypes: ['HAS_METHOD'], the filter silently drops it and falls back to the default 4 types, returning unrelated results instead of an error.

Fix

Add HAS_METHOD and OVERRIDES to VALID_RELATION_TYPES. Both types are defined in graph/types.ts and lbug/schema.ts, and are actively produced by mro-processor.ts and parsing-processor.ts.

Test plan

  • Updated security.test.ts — allowlist size 4→6, added assertions for HAS_METHOD and OVERRIDES
  • Updated local-backend.test.ts — added HAS_METHOD and OVERRIDES to valid types array
  • impact({target: "X", relationTypes: ["HAS_METHOD"]}) returns filtered results instead of falling back to defaults

The impact tool description advertises 6 edge types (CALLS, IMPORTS,
EXTENDS, IMPLEMENTS, HAS_METHOD, OVERRIDES), but VALID_RELATION_TYPES
only contains 4. When a user passes relationTypes: ['HAS_METHOD'], the
filter silently drops it and falls back to the default 4 types,
returning incorrect results.
@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown

@karesansui-u is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

@magyargergo

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🙏

@github-actions

github-actions Bot commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

CI Report

All checks passed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
✅ Unit Tests success 3 platforms
✅ Integration success 3 OS x 4 groups = 12 jobs

Test Results

Suite Tests Passed Failed Skipped Duration
Unit 1563 1562 0 1 8s
Integration 1161 1141 0 19 49s
Total 2724 2703 0 20 57s

✅ All 2703 tests passed

20 test(s) skipped — expand for details

Integration:

  • Python match/case as-pattern type binding > resolves u.save() to User#save via match/case as-pattern binding
  • Python match/case as-pattern type binding > does NOT resolve u.save() to Repo#save (negative disambiguation)
  • Swift constructor-inferred type resolution > detects User and Repo classes, both with save methods
  • Swift constructor-inferred type resolution > resolves user.save() to Models/User.swift via constructor-inferred type
  • Swift constructor-inferred type resolution > resolves repo.save() to Models/Repo.swift via constructor-inferred type
  • Swift constructor-inferred type resolution > emits exactly 2 save() CALLS edges (one per receiver type)
  • Swift self resolution > detects User and Repo classes, each with a save function
  • Swift self resolution > resolves self.save() inside User.process to User.save, not Repo.save
  • Swift parent resolution > detects BaseModel and User classes plus Serializable protocol
  • Swift parent resolution > emits EXTENDS edge: User → BaseModel
  • Swift parent resolution > emits IMPLEMENTS edge: User → Serializable (protocol conformance)
  • Swift cross-file User.init() inference > resolves user.save() via User.init(name:) inference
  • Swift cross-file User.init() inference > resolves user.greet() via User.init(name:) inference
  • Swift return type inference > detects User class and getUser function
  • Swift return type inference > detects save function on User (Swift class methods are Function nodes)
  • Swift return type inference > resolves user.save() to User#save via return type of getUser() -> User
  • Swift return-type inference via function return type > resolves user.save() to User#save via return type of getUser()
  • Swift return-type inference via function return type > user.save() does NOT resolve to Repo#save
  • Swift return-type inference via function return type > resolves repo.save() to Repo#save via return type of getRepo()

Unit:

  • buildTypeEnv > known limitations (documented skip tests) > Ruby block parameter: users.each { |user| } — closure param inference, different feature

Code Coverage

Combined (Unit + Integration)

Metric Coverage Covered Base Delta Status
Statements 61.51% 6840/11120 47.16% 📈 +14.4 🟢 ████████████░░░░░░░░
Branches 55.73% 4672/8383 42.47% 📈 +13.3 🟢 ███████████░░░░░░░░░
Functions 60.67% 591/974 46.3% 📈 +14.4 🟢 ████████████░░░░░░░░
Lines 63.45% 6117/9640 48.73% 📈 +14.7 🟢 ████████████░░░░░░░░
Coverage breakdown by test suite

Unit Tests

Metric Coverage Covered Base Delta Status
Statements 47.16% 5245/11120 47.16% = 0.0 🟢 █████████░░░░░░░░░░░
Branches 42.47% 3561/8383 42.47% = 0.0 🟢 ████████░░░░░░░░░░░░
Functions 46.3% 451/974 46.3% = 0.0 🟢 █████████░░░░░░░░░░░
Lines 48.73% 4698/9640 48.73% = 0.0 🟢 █████████░░░░░░░░░░░

Integration Tests

Metric Coverage Covered Base Delta Status
Statements 46.57% 5179/11120 47.16% 📉 -0.6 🔴 █████████░░░░░░░░░░░
Branches 43.96% 3686/8383 42.47% 📈 +1.5 🟢 ████████░░░░░░░░░░░░
Functions 44.14% 430/974 46.3% 📉 -2.2 🔴 ████████░░░░░░░░░░░░
Lines 47.67% 4596/9640 48.73% 📉 -1.1 🔴 █████████░░░░░░░░░░░

📋 View full run · Generated by CI

@magyargergo

Copy link
Copy Markdown
Collaborator

Could you please write a test where you directly test this in an integration test? 🙏

…ering

Seed graph with Method nodes and HAS_METHOD/OVERRIDES edges, then verify
that impact tool correctly filters by these relation types via callTool.
@karesansui-u

Copy link
Copy Markdown
Contributor Author

Added integration tests in local-backend-calltool.test.ts:

  • HAS_METHOD filtering: impact({target: 'AuthService', direction: 'downstream', relationTypes: ['HAS_METHOD']}) returns only methods, not CALLS-reachable symbols
  • OVERRIDES filtering: impact({target: 'authenticate', direction: 'downstream', relationTypes: ['OVERRIDES']}) traverses override edges
  • Negative case: impact({target: 'AuthService', direction: 'downstream', relationTypes: ['CALLS']}) returns 0 results (AuthService has no outgoing CALLS edges)

Seed data extended with Method nodes and HAS_METHOD/OVERRIDES edges. All 14 callTool tests + 87 existing tests pass.

@magyargergo magyargergo merged commit 480fae9 into abhigyanpatwari:main Mar 18, 2026
20 of 21 checks passed
motolese pushed a commit to motolese/datamoto-gitnexus that referenced this pull request Apr 23, 2026
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.

2 participants