100%

SCIP -> Neo4j importer (occurrence -> definition by symbol string)

Goal

Land the importer that turns compiler-resolved SCIP into symbol-string-keyed CALLS edges in the graph.

Implementation Sketch

  • Extend the existing edge importer intel_repo/neo4j/import_code_graph.py.
  • The generic per-source-file edge upsert helper at :327 (MERGE (s)-[r:{rel_type}{edge_key_merge}]->(c) SET r += row.props) already supports a 3-tuple MERGE key via edge_key_field (:271, used by upsert_file_emits with source_line) — reuse it for CALLS keyed by (caller symbol, callee symbol, source_line) so distinct call sites produce distinct edges, and carry provenance + SCIP role bitmask in row.props.
  • :Symbol + DECLARES MERGE batch already exists at intel_repo/neo4j/extract_symbols.py:600-620 (MERGE (s:Symbol ...) + MERGE (f)-[:DECLARES]->(s) at :619) — reuse for SymbolInformation definitions.
  • The occurrence->definition join is the SCIP symbol string equality the importer keys on; missing endpoints are non-fatal (OPTIONAL MATCH null -> MERGE skipped, per the helper’s WHERE s IS NOT NULL AND c IS NOT NULL clause at :317-326).

Spec References

SCIP symbol-string join contract (occurrence.symbol == SymbolInformation.symbol). intel_repo importer MERGE discipline: import_code_graph.py per-repo (repo, code) scoping + non-fatal missing-endpoint counting.

Work Items

  • Build the SCIP->Neo4j importer: parse an index.scip, MERGE :Symbol nodes from SymbolInformation, and join each reference Occurrence to its definition by globally-stable SCIP symbol string, MERGEing a provenance-tagged CALLS edge with the SCIP role bitmask. Verified by the intel_repo pytest gate (compiler-side test-all.sh does not exercise the Python/Neo4j path).

Test Coverage

  • L12 Production entry point — COVERED: the intel_repo pytest drives the real importer on a real index.scip fixture and asserts the symbol-string-keyed CALLS edge + role bitmask land in the graph.
  • L1 Parse .. L11 Spec — N/A: this is a Python/Neo4j importer, not a compiler pipeline stage; no Ori parse/typeck/canon/ARC/eval/LLVM/AOT/parity/leak/spec layer applies. The compiler-side ./test-all.sh does NOT exercise this path; the pytest gate is the verification surface.