GitNexus/gitnexus/test/unit
Copilot d9ba9aa998
Some checks are pending
CI / quality (push) Waiting to run
CI / tests (push) Waiting to run
CI / e2e (push) Waiting to run
CI / Save PR Metadata (push) Blocked by required conditions
CI / CI Gate (push) Blocked by required conditions
SM-10: Add MRO fast path before D2 fuzzy widening in resolveCallTarget (#741)
* Initial plan

* Add MRO fast path before D2 fuzzy widening in resolveCallTarget

When receiverTypeName is known, try resolveMethodByOwner (owner-scoped
+ MRO lookup) before falling back to the expensive lookupFuzzy in D2.
This short-circuits cross-file member call resolution for the common
non-overloaded case.

The fast path is skipped when overload disambiguation hints are
available (overloadHints or preComputedArgTypes) to avoid picking the
wrong overload for same-return-type overloaded methods.

Passes heritageMap to resolveCallTarget from all 4 call sites:
- Language seed path (processCalls)
- Sequential path (processCalls)
- walkMixedChain fallback
- Worker path (processCallsFromExtracted)

Agent-Logs-Url: https://github.com/abhigyanpatwari/GitNexus/sessions/9e49521f-2472-47bc-96e9-be4a46b073f0

Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>

* fix(SM-10): address PR #741 review

Correctness:
- Module-alias guard for D0. When call.receiverName matches an active
  entry in ctx.moduleAliasMap for the current file, D0 is now skipped
  and resolution falls through to D1-D4 which respects the
  alias-narrowed candidate pool. Prevents a homonymous class in a
  different file from being picked by ctx.resolve(receiverTypeName)
  inside resolveMethodByOwner. New unit test pins the contract.

Unit tests (call-processor.test.ts — 3 new):
- D0 hit: child.parentMethod() resolves via MRO walk when
  heritageMap is provided.
- D0 skipped: same scenario still resolves via D1-D4 when heritageMap
  is undefined (backward-compat guard).
- Module-alias guard: two files both define class User with a save()
  method; 'import auth_mod as auth' in app.py must resolve
  auth.user.save() to auth_mod.py, not user_mod.py.

Integration language coverage (+3 fixtures/tests):
- swift-child-extends-parent — first-wins, gated on swiftAvailable.
- ruby-child-extends-parent   — first-wins.
- php-child-extends-parent    — first-wins (uses ParentClass since
  'Parent' is a PHP reserved word).

* test(SM-10): address second PR #741 review round

Unit tests (call-processor.test.ts, +2 new):
- overloadHints guard: Java source with two same-return-type overloads
  method(int) and method(String), int added first so lookupMethodByOwner
  would return it. processCalls auto-generates overloadHints for Java,
  forcing D0 to be skipped. o.method("hello") must resolve to
  method(String) via literal-inferred disambiguation.
- preComputedArgTypes guard: worker-path equivalent via
  processCallsFromExtracted with ExtractedCall.argTypes=['String'].
  Same two overloads, same correctness guarantee.

Integration tests (+2 fixtures + test blocks):
- go-child-extends-parent    — struct embedding, first-wins
  (Go structs are labeled 'Struct' not 'Class' in GitNexus).
- dart-child-extends-parent  — extends, first-wins, gated on
  dartAvailable like other Dart tests.

Documentation:
- Expanded the fallthrough comment in resolveMethodByOwner to clarify
  that unknown-extension paths land on plain lookupMethodByOwner
  without an ancestor walk, and that D1-D4 still runs on D0 miss.

* test(SM-10): D0 miss with heritageMap present falls through to D1-D4

Closes the last remaining gap from PR #741 review round 3. The existing
'D0 skipped' test only covered the heritageMap=undefined case, leaving
the miss-with-heritageMap path implicitly covered by integration tests
only. This adds a focused unit test where:

- Class Obj has a method doWork findable via tiered resolution
  (import-scoped) but intentionally NOT registered in methodByOwner
  (no ownerId), so lookupMethodByOwner misses.
- heritageMap is provided but built from an empty heritage array, so
  getAncestors(class:Obj) returns []. The MRO walk yields no parents.
- lookupMethodByOwnerWithMRO therefore returns undefined → D0 miss.
- D1 resolves the receiver type; D2 widens via lookupFuzzy;
  D3 file-filter picks the single matching candidate.
- A CALLS edge must still be emitted — D0 miss must not swallow
  the call.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: magyargergo <11230420+magyargergo@users.noreply.github.com>
Co-authored-by: Gergo Magyar <gergomagyar@icloud.com>
2026-04-08 23:24:07 +01:00
..
call-routing feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
group fix(group): address 4 HIGH-priority issues from PR #626 review 2026-04-02 12:55:33 +03:00
import-resolution feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
named-bindings refactor: SICP-informed LanguageProvider architecture (#488) 2026-03-24 13:42:39 +00:00
ai-context.test.ts feat: added skip-agents-md cli flag (#517) 2026-03-28 21:23:59 +00:00
analyze-api.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
analyze-job.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ast-cache.test.ts fix: guard createASTCache against zero maxSize to prevent LRU cache crash 2026-03-02 08:47:20 +00:00
bm25-search.test.ts refactor: migrate from KuzuDB to LadybugDB v0.15 (#275) 2026-03-15 15:53:01 +00:00
call-form.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
call-processor.test.ts SM-10: Add MRO fast path before D2 fuzzy widening in resolveCallTarget (#741) 2026-04-08 23:24:07 +01:00
calltool-dispatch.test.ts feat(group): add sync pipeline, CLI, MCP tools, and monorepo fixture 2026-04-02 00:40:31 +03:00
cli-commands.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
cli-index-help.test.ts fix: address PR review — remove redundancies and add wiki help test 2026-03-25 11:39:37 +05:30
cobol-copy-expander.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cobol-preprocessor.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
cohesion-consistency.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
community-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
compatible-stdio-transport.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
cors.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
csv-escaping.test.ts refactor: migrate from KuzuDB to LadybugDB v0.15 (#275) 2026-03-15 15:53:01 +00:00
dart-import-resolver.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
dart-type-extractor.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
embedder.test.ts test: add test suite with vitest (unit + integration + fixtures) 2026-03-01 20:07:02 +05:30
entry-point-scoring.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
eval-formatters.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
expo-routes.test.ts feat: add Expo Router file-based route detection (#503) 2026-03-25 11:05:55 +00:00
extract-element-type-from-string.test.ts feat: Phase 6 type resolution — for-loop Tier 1c, pattern matching, container descriptors, 10-language coverage (#318) 2026-03-17 17:10:22 +00:00
extract-generic-type-args.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
fetch-reason-parsing.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
field-extraction.test.ts feat(ts,js): TypeScript/JavaScript MethodExtractor config (#588) 2026-04-01 14:09:59 +01:00
framework-detection.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
git-clone.test.ts feat: unify web and cli ingestion pipeline (#536) 2026-03-28 14:07:11 +00:00
git-utils.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
git.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
graph.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
has-method.test.ts feat: MethodExtractor configs for Python, PHP, Swift, Dart, Rust, Ruby (#624) 2026-04-03 16:11:31 +01:00
heritage-map.test.ts feat(SM-8): Build HeritageMap from accumulated ExtractedHeritage[] (#739) 2026-04-08 19:00:08 +01:00
heritage-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
hooks.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
http-embedder.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
hybrid-search.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ignore-service.test.ts fix(ignore): respect negation patterns in .gitnexusignore (#654) 2026-04-06 08:32:47 +01:00
impact-batching-grouping.test.ts feat(group): add sync pipeline, CLI, MCP tools, and monorepo fixture 2026-04-02 00:40:31 +03:00
impact-confidence.test.ts feat: METHOD_IMPLEMENTS edges, overload disambiguation, MethodExtractor unification (#574) (#642) 2026-04-04 18:41:47 +01:00
import-processor.test.ts refactor: SICP-informed LanguageProvider architecture (#488) 2026-03-24 13:42:39 +00:00
index-repo-command.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
ingestion-utils.test.ts feat: METHOD_IMPLEMENTS edges, overload disambiguation, MethodExtractor unification (#574) (#642) 2026-04-04 18:41:47 +01:00
isWriteQuery.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
jcl-parser.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
language-skip.test.ts feat(ingestion): respect .gitignore and .gitnexusignore during file discovery (#231) 2026-03-16 13:26:20 +00:00
lazy-action.test.ts Improve MCP startup compatibility and lazy-load CLI commands (#207) 2026-03-07 07:47:09 +00:00
method-extraction.test.ts feat: same-arity overload disambiguation via type-hash suffix (#651) (#658) 2026-04-05 21:51:55 +01:00
method-props.test.ts feat: same-arity overload disambiguation via type-hash suffix (#651) (#658) 2026-04-05 21:51:55 +01:00
mro-processor.test.ts feat: METHOD_IMPLEMENTS edges, overload disambiguation, MethodExtractor unification (#574) (#642) 2026-04-04 18:41:47 +01:00
noise-filter.test.ts refactor: split global BUILT_IN_NAMES into per-language provider fields (#523) 2026-03-26 12:15:29 +00:00
parser-loader.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
pipeline-exports.test.ts test: add test suite with vitest (unit + integration + fixtures) 2026-03-01 20:07:02 +05:30
process-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
repo-manager.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
resources.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
route-tool-detection.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
run-analyze.test.ts feat: unify web and cli ingestion pipeline (#536) 2026-03-28 14:07:11 +00:00
schema.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
security.test.ts feat: METHOD_IMPLEMENTS edges, overload disambiguation, MethodExtractor unification (#574) (#642) 2026-04-04 18:41:47 +01:00
sequential-language-availability.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
server.test.ts feat: configure eslint with unused import removal (#564) 2026-03-28 15:28:09 +00:00
setup-codex.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
setup.test.ts fix(setup): prefer global gitnexus binary over npx for MCP config (#653) 2026-04-06 07:46:10 +01:00
shape-check.test.ts fix: shape_check false positives — quoted keys, DOM leaks, errorKeys (#501) 2026-03-26 05:43:37 +00:00
shared-type-extractors.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
skill-gen.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
skip-git-cli.test.ts feat: added skip-agents-md cli flag (#517) 2026-03-28 21:23:59 +00:00
staleness.test.ts feat(group): add group infrastructure and contract matching 2026-04-02 00:39:43 +03:00
stdout-silence.test.ts fix(mcp): unify stdout silencing to prevent embedder/pool-adapter conflicts (#645) 2026-04-04 11:56:49 +01:00
structure-processor.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
suffix-index-ambiguity.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
symbol-resolver.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
symbol-table.test.ts feat(SM-9): Add lookupMethodByOwnerWithMRO using HeritageMap (#740) 2026-04-08 20:46:45 +01:00
tools.test.ts feat(group): add sync pipeline, CLI, MCP tools, and monorepo fixture 2026-04-02 00:40:31 +03:00
topological-sort.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
tree-sitter-queries.test.ts Java method reference (#622) 2026-04-02 15:16:35 +01:00
type-env.test.ts [cli] Replace owner-filtered method lookups in type-env (#736) 2026-04-08 17:41:09 +01:00
utils.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
vue-sfc-extractor.test.ts feat(vue): Vue SFC support + destructured call result tracking (#604) 2026-04-03 14:18:55 +05:30
wiki-flags.test.ts feat: configure prettier with pre-commit hook (#563) 2026-03-28 14:58:04 +00:00
wiki-llm-client.test.ts fix(wiki): Azure OpenAI compat and HTML viewer script injection (#618) 2026-04-01 21:30:43 +05:30