Skip to content

fix(graph): serve memory_edges in GET /graph; fix FK violations in MCP add_edge and dream - #1370

Merged
ajianaz merged 1 commit into
developfrom
fix/graph-view-and-fk
Oct 8, 2026
Merged

ajianaz merged 1 commit into
developfrom
fix/graph-view-and-fk

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

What

  • Uteke::graph_view (new graph_view.rs): one bounded graph for viewers. Edges = memory_edges between live memories (the data remember writes automatically; derived referenced_by backlinks omitted) plus explicit graph_edges, nodes keyed by memory id (memory_id field kept), namespace filter, node_id = that memory's neighbourhood, limit (default 500, max 5000) with a truncated flag. GET /graph and MCP uteke_graph use it (the MCP tool now also lists the latest edges and takes limit).
  • Edges carry source/target in addition to source_id/target_id.
  • fix: MCP uteke_graph_add_edge and dream contradiction edges violate graph_edges FK #1365: new GraphStore::add_edge_for_memories / remove_edge_between; MCP uteke_graph_add_edge / uteke_graph_remove_edge and dream contradiction edges used raw memory ids against the graph_nodes FK and failed.
  • Registry descriptions fixed: /edges is not an alias of /graph; /graph documents node_id/limit (docs/api-reference.md regenerated; docs/core-contract.json unchanged).

Why

Consumer check (graph audit, epic #1345): Corin's graph view calls GET /graph (+node_id), POST/DELETE /graph/edge, GET /edges. It expects memory_edges data keyed by memory id and {source,target,relation,weight} edges, but the server returned only graph_nodes/graph_edges (almost always empty, hence "0 usage") with source_id/target_id, and ignored node_id. A non-empty response would not even deserialize in Corin. The two write paths into that store (MCP, dream) were also broken by the FK, so nothing could fill it.

Behaviour change (LAB)

GET /graph node ids are now memory ids (previously graph-node ids; POST /graph/edge still returns the node ids it created, and both id kinds are still accepted by POST/DELETE). Existing test graph_edge_post_resolves_memory_ids_to_nodes updated accordingly. All graph routes are tier LAB, so no cloud contract change. Recall is not touched, so the benchmark gate is unaffected.

Testing

  • 7 new core tests (live-only, namespace, backlinks omitted, node_id, limit/truncated, explicit edges re-keyed, FK violation reproduced then fixed, deserialization into Corin's struct shape) + 1 new server test (node_id and limit over HTTP) + 1 updated.
  • cargo fmt --check, cargo clippy --workspace --all-targets clean; cargo test --workspace green (core 636, server 62); vecq-only core build green (633).
  • Not covered: running Corin against the new server (checked by reading its structs and the compat test); dream end-to-end edge creation (covered through add_edge_for_memories).

Fixes #1365, fixes #1366

🤖 Generated with Claude Code

… MCP add_edge and dream

- new Uteke::graph_view: unified, bounded graph (memory_edges + explicit graph edges), keyed by memory id, live memories only, node_id neighbourhood, limit + truncated; GET /graph and MCP uteke_graph use it
- edges also carry source/target (the names Corin reads)
- GraphStore::add_edge_for_memories / remove_edge_between: MCP uteke_graph_add_edge/remove_edge and dream contradiction edges no longer violate graph_edges FK
- fix registry descriptions: /edges is not an alias of /graph; /graph documents node_id/limit

Fixes #1365
Fixes #1366

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ajianaz ajianaz added bug Something isn't working scope:core Core engine work scope:server uteke-server / uteke-mcp binaries scope:mcp MCP (Model Context Protocol) server tools labels Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit b1056e4 into develop Oct 8, 2026
15 checks passed
@ajianaz
ajianaz deleted the fix/graph-view-and-fk branch October 13, 2026 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working scope:core Core engine work scope:mcp MCP (Model Context Protocol) server tools scope:server uteke-server / uteke-mcp binaries

Projects

None yet

1 participant