Skip to content

Go interface methods omit parameter and result type references #3736

Description

@oleksii-tumanov

What happened?

A Go interface method has a node, but its parameter and result types are absent
from its references edges. The same signature on a concrete receiver method
records both dependencies. Reverse-impact queries therefore miss the interface
contract when one of these types changes.

Steps to reproduce

Save as contract.go:

package contracts

type Request struct{}
type Response struct{}
type Service interface {
    Handle(Request) (Response, error)
}

type Impl struct{}
func (Impl) Handle(Request) (Response, error) { return Response{}, nil }

Extract it into a fresh output directory:

graphify extract . --code-only --no-cluster --out ./fresh-output

Error output or graph output

The fresh AST cache entry and extracted graph contain distinct .Handle() nodes
owned by Service and Impl. Their outgoing references, shown with owner-qualified
labels instead of node IDs, are:

Impl.Handle -> Request   references / parameter_type
Impl.Handle -> Response  references / return_type
Service.Handle           no references

Expected: Service.Handle has the same two type references as Impl.Handle.
The builtin error should remain filtered. A reverse-impact lookup for Request
currently reaches only the concrete method, not the interface requirement.

Graphify version

0.9.65, reproduced on v8 at 20a20d30d8e7eef77675651f0199d87f913bd3e7.

Environment

macOS, Python 3.12, installed from the frozen uv lockfile with all extras.

Additional context

Case-only method names also need distinct owners for these links. For example,
Run(InputA) and run(InputB) currently collapse to one method node. The
extractor already has a collision policy for ordinary Go methods, but interface
method declarations are not included in its scan.

#3672 added the interface method nodes in v0.9.65. This is a signature-reference
follow-up: ordinary Go methods already record these references. It does not
concern resolving calls through interface receivers.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions