Skip to content

feat(#408): /graph API endpoint — nodes + edges JSON for visualization - #422

Merged
ajianaz merged 3 commits into
developfrom
feat/408-graph-api
Jun 21, 2026
Merged

ajianaz merged 3 commits into
developfrom
feat/408-graph-api

Conversation

@ajianaz

@ajianaz ajianaz commented Jun 21, 2026

Copy link
Copy Markdown
Collaborator

Implements #408.

Summary

Add GET /graph endpoint to uteke-server for graph visualization.

API

GET /graph           → all nodes + edges + stats
GET /graph?namespace=foo  → (namespace param accepted, filtering is future work)

Response

{
  "nodes": [{ "id": "...", "label": "...", "entity_type": "...", ... }],
  "edges": [{ "source_id": "...", "target_id": "...", "relation": "...", ... }],
  "stats": { "node_count": N, "edge_count": N, ... }
}

New method

Uteke::graph_data(namespace) — wraps GraphStore.all_nodes() + all_edges().

Milestone: v0.3.0 — Graph RAG

Add GET /graph endpoint to uteke-server:
- Returns all graph nodes and edges as JSON
- Optional ?namespace=<ns> query param for filtering
- Response: { nodes: [...], edges: [...], stats: {...} }

New Uteke::graph_data() method exposes GraphStore.all_nodes()
and all_edges() in a single call for visualization clients.
@github-actions

github-actions Bot commented Jun 21, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

❌ Blocked — critical issues found.

🔴 Error (2)

  • crates/uteke-core/src/lib.rs:676 — In graph_data, the namespace-filtering branch does not actually filter anything. The predicate n.memory_id.as_deref().map_or(true, |_| true) always evaluates to true, so filtered_nodes contains every node regardless of namespace. The unused ns_string is then discarded with let _ = ns_string;. This means /graph?namespace=... returns global graph data instead of namespace-scoped data as the API suggests.
  • crates/uteke-core/src/lib.rs:682 — When namespace is provided, graph_data only rebuilds nodes and returns edges unchanged: (filtered_nodes, edges). Even if node filtering were implemented, this would still expose edges whose source_id or target_id point to nodes outside the selected namespace, producing inconsistent graph payloads and leaking cross-namespace relationships.

Review powered by cora-cli · BYOK · MIT

Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-core/src/lib.rs Fixed
Comment thread crates/uteke-core/src/lib.rs Fixed
let stats = gs.stats()?;

// Filter by namespace if specified.
let (nodes, edges) = if let Some(ns) = namespace {
.into_iter()
.filter(|n| {
// Memory-linked nodes: check memory namespace.
// Entity nodes: always include (shared across namespaces).
@ajianaz
ajianaz merged commit e4def8e into develop Jun 21, 2026
8 of 9 checks passed
@ajianaz
ajianaz deleted the feat/408-graph-api branch June 21, 2026 13:05
ajianaz added a commit that referenced this pull request Aug 13, 2026
#422)

* feat(#408): /graph API endpoint — nodes + edges JSON for visualization

Add GET /graph endpoint to uteke-server:
- Returns all graph nodes and edges as JSON
- Optional ?namespace=<ns> query param for filtering
- Response: { nodes: [...], edges: [...], stats: {...} }

New Uteke::graph_data() method exposes GraphStore.all_nodes()
and all_edges() in a single call for visualization clients.

* style: fmt fix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants