Repository navigation
Open
Labels
bugSomething isn't working
Description
Describe the bug
The type-relationship facts that CLAUDE.md § "type node" specifies are incomplete, in both projections:
base_types[]holds raw type strings, not type ids. CLAUDE.md definesbase_types[]as "embedded type ids (struct/interface embedding — the explicit spine)". The emitter copies v1GoType.BaseTypes(internal/syntactic_analysis/v2emit/emit.go,emitType), and the symbol table fills that field withtypeStringoutput:embeddedTypesand the interface-embedding branch ininternal/syntactic_analysis/symbol_table.go. The values are strings such asnet/http.Handler,*github.com/go-chi/chi/v5/middleware.DefaultLogFormatterandio.Writer, notcan://<app>/go/<file>/<Type>ids.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_EMBEDSrows never resolve. The projector (internal/neo4j/project.go) passes eachbase_typesvalue toEdgeToSymbolas an id, which matches no:GoSymbol, so no edge is created.GO_SATISFIEShas no input at all. The graph therefore has neither embedding nor interface-satisfaction edges. - JSON:
base_typescannot be joined to type nodes by id. A string such asio.Writernames a library type that has no node at all.interfacesnever appears. - SDK: any type-hierarchy query on the Go facade (embedding spine, "which types implement this interface") gets nothing.
To Reproduce
- Run
cango -i testdata/chi -a 2 -o /tmp/out. - 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 hasinterfaces. - Run
cango -i testdata/chi --emit neo4j -o /tmp/g. The generated Cypher has noGO_EMBEDSorGO_SATISFIESrelationship 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.ImplementsforTand*T) against the in-project interfaces, and possibly the library interfaces the project uses. - Emitted as type ids, sorted.
- Computed by method-set matching (
- Neo4j:
GO_EMBEDSandGO_SATISFIESrows appear and resolve. Remove both relationships from the conformance test's no-data exemption list, which was added onfeat/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_EMBEDSandGO_SATISFIESbecause 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.
Metadata
Metadata
Assignees
Labels
bugSomething isn't working
Activity