Skip to content

base_types holds type strings, not ids, and interfaces[] is never computed (GO_EMBEDS/GO_SATISFIES empty) #31

Open

Description

@sinha108

Describe the bug
The type-relationship facts that CLAUDE.md § "type node" specifies are incomplete, in both projections:

  1. base_types[] holds raw type strings, not type ids. CLAUDE.md defines base_types[] as "embedded type ids (struct/interface embedding — the explicit spine)". The emitter copies v1 GoType.BaseTypes (internal/syntactic_analysis/v2emit/emit.go, emitType), and the symbol table fills that field with typeString output: embeddedTypes and the interface-embedding branch in internal/syntactic_analysis/symbol_table.go. The values are strings such as net/http.Handler, *github.com/go-chi/chi/v5/middleware.DefaultLogFormatter and io.Writer, not can://<app>/go/<file>/<Type> ids.
  2. interfaces[] is never computed. CLAUDE.md defines it as the interfaces a type is computed to satisfy through method-set matching. No code fills it, so it is always absent.

Consequences

  • Neo4j: GO_EMBEDS rows never resolve. The projector (internal/neo4j/project.go) passes each base_types value to EdgeToSymbol as an id, which matches no :GoSymbol, so no edge is created. GO_SATISFIES has no input at all. The graph therefore has neither embedding nor interface-satisfaction edges.
  • JSON: base_types cannot be joined to type nodes by id. A string such as io.Writer names a library type that has no node at all. interfaces never appears.
  • SDK: any type-hierarchy query on the Go facade (embedding spine, "which types implement this interface") gets nothing.

To Reproduce

  1. Run cango -i testdata/chi -a 2 -o /tmp/out.
  2. Look at types.Router.base_types. It is ["net/http.Handler", "github.com/go-chi/chi/v5.Routes"]: strings, not ids. On chi, no type has interfaces.
  3. Run cango -i testdata/chi --emit neo4j -o /tmp/g. The generated Cypher has no GO_EMBEDS or GO_SATISFIES relationship rows.

Expected behavior

  • base_types[]:
    • An embedded in-project type gets its type id.
    • An embedded library type gets a resolvable target, either an @external-style type id with a ghost node or a separately named field. This is a schema decision, so record it in CLAUDE.md under the parity clause.
  • interfaces[]:
    • Computed by method-set matching (types.Implements for T and *T) against the in-project interfaces, and possibly the library interfaces the project uses.
    • Emitted as type ids, sorted.
  • Neo4j: GO_EMBEDS and GO_SATISFIES rows appear and resolve. Remove both relationships from the conformance test's no-data exemption list, which was added on feat/l4-sdg.

Additional context

  • This predates the L4 work: the same output comes from main.
  • It was found while reviewing the L4 Neo4j emission. The "every declared relationship is emitted" conformance test had to exempt GO_EMBEDS and GO_SATISFIES because they never get data.
  • Scope note: computing satisfaction over library interfaces can be large. Bound it to interfaces the project names, or decide the scope explicitly.

Activity

  1. added
    bug
    on Oct 26, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions