Skip to content

feat: native engine does not extract prototype method definitions (Foo.prototype.bar = fn) #1421

@carlos-alm

Description

@carlos-alm

Problem

The native engine (Rust/napi-rs) does not extract prototype-based method definitions like:

Dog.prototype.bark = function() { ... };

Running codegraph build on such a file extracts Dog, Animal, etc. but NOT Dog.bark as a method node.

The WASM engine correctly extracts this via extractPrototypeMethodsWalk in src/extractors/javascript.ts.

Impact

The integration test in tests/integration/prototype-method-resolution.test.ts (added in #1317 work) fails when the native engine is active because:

  1. Dog.bark node does not exist in the DB
  2. d.bark() call edge cannot resolve to a non-existent node
  3. (new Dog('Rex')).bark() inline-new receiver call also fails

The test was pinned to WASM engine in branch fix/wasm-prototype-method-test-1381 (PR #1400) but that change was not yet merged to main.

Expected behavior

Both engines should produce identical results (as stated in CLAUDE.md: "Both engines must produce identical results").

Affected files

  • crates/codegraph-core/src/ — native extractor needs prototype assignment extraction
  • tests/integration/prototype-method-resolution.test.ts — test should either be pinned to WASM or the native engine fixed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions