feat(schema): add callee_declaring_role to CALLS; supertype-walk dedup; unresolved counters#180
Conversation
Populate callee_declaring_role on every CALLS emission, collapse interface+concrete duplicate candidates before overload_ambiguous, and expose pass3 unresolved counters in GraphMeta for PR-3 telemetry. Co-authored-by: Cursor <cursoragent@cursor.com>
HumanBean17
left a comment
There was a problem hiding this comment.
PR-1 review (CALLS-NOISE)
Verdict: Looks good to merge as PR-1 scope, with one follow-up I’d treat as important before PR-2 edge_filter lands on brownfield codebases.
What works well
- Scope matches
PLAN-CALLS-NOISE.mdPR-1: ontology 15,CALLS.callee_declaring_role, supertype dedup beforeoverload_ambiguous,GraphMetacounters,EDGE_SCHEMA+ docs — no PR-2/PR-3 leakage. _collapse_supertype_duplicatesmatches propose §3.3.1 (single concrete on receiver, supertype signature match, unrelated-candidate bail-out, never collapsesoverload_ambiguous).- Smoke tests cover dedup (
SupertypeDedupPatterns) and overload preservation (OverloadPatterns#sameArity). - Manual bank build:
ontology_version=15, counters present, allCALLSrows populated withcallee_declaring_role; spot-check shows 0 mismatches vs parentSymbol.roleon bank (expected — bank has no brownfield role stubs).
Request: brownfield role parity (medium)
Propose §3.1 / HV31 says callee_declaring_role should match the declaring type’s role including brownfield (same as parent Symbol.role at write time).
_callee_declaring_role_for_dst recomputes via resolve_role_and_capabilities(..., overrides=_PASS3_ROLE_OVERRIDES) where _PASS3_ROLE_OVERRIDES is empty and meta_chain is omitted. _write_nodes uses load_brownfield_overrides(project_root) + meta_chain.
On @CodebaseRole / brownfield-only typing, CALLS.callee_declaring_role can diverge from parent.role while bank tests stay green. PR-2 edge_filter={callee_declaring_role: ...} would be wrong on those codebases.
Suggested fix (either):
- Pass
source_rootintopass3_callsand use the sameoverrides+meta_chainas_write_nodes, or - Populate
callee_declaring_roleat_write_edgeswhen overrides are already loaded.
A small brownfield stub test (@CodebaseRole on declaring type → edge attr == parent Symbol.role) would lock this.
Notes (non-blocking)
- Dedup applicability: Fixture uses concrete-typed
JpaStyleRepoImpl repo. TypicalJpaStyleRepo repo(interface-typed) often already yields a single candidate (lookup walks supertypes, not implementors), so dedup’s main win is concrete-typed receivers. Worth one README sentence so operators don’t expect dedup on every JPA site. - Perf:
_callee_declaring_role_for_dstscans alltables.membersper emit — fine for bank; considermember_by_idif this shows up in profiles. - Docs drift:
AGENTS.md/ cursor rules still say v14 — fine out of PR-1 scope; small chore PR would help agents.
Correctness (no blockers)
overload_ambiguousguard on dedup path ✓- Phantom/chained still on
CALLSwith counters for PR-3 ✓ - Known-external phantoms →
OTHER✓ - DDL /
EDGE_SCHEMA/ write Cypher aligned ✓
Assuming CI green — thanks for keeping PR-1 tight.
Populate type_role_by_node_id during _write_nodes with the same brownfield overrides and meta_chain as parent Symbols; set CALLS.callee_declaring_role in _write_edges from that map. Add YAML brownfield parity test. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
ONTOLOGY_VERSION14 → 15; addCALLS.callee_declaring_role(DDL, emission,EDGE_SCHEMA).collapse_supertype_duplicatesper propose §3.3.1 — runs only before theoverload_ambiguousemit loop; never collapsesoverload_ambiguousrows.GraphMeta.pass3_unresolved_phantom_receiverandpass3_unresolved_chained(counts today's phantom-receiver / chained-receiverCALLSrows).Implements PR-1 from
plans/PLAN-CALLS-NOISE.md/ proposeCALLS-NOISE-AND-RESOLUTION-PROPOSE.md§6 PR-1.Test plan
test_pass3_supertype_dedup_jpa_repository_save_one_row,test_pass3_overload_ambiguous_still_n_rows,test_pass3_callee_declaring_role_bank_annotated_types,test_calls_edge_has_callee_declaring_role_column,test_graph_meta_unresolved_counters_present,test_edge_schema_calls_registers_callee_declaring_role, plus existingtest_overload_sameArity_emits_two_overload_ambiguous_edgesUnresolvedCallSite/EdgeFilter/phantomsdeletion in diffbank-chat-systembuild → ontology 15, counters present,callee_declaring_roleonCALLS.venv/bin/ruff check .pytest tests: 625 passed, 13 skipped; failures are pre-existing env (CLI entrypoint not onPATH, cocoindex/numpy in heavy lance tests) plus fixedtest_kuzu_graph_refuses_ontology_version_below_required/ regeneratedEDGE-NAVIGATION.mdMade with Cursor