create_node: attach to a graph + write canonical WorkItem fields (parity with web)#49
Merged
Merged
Conversation
…ble) Node-level twin of the edge parity fix (#47). The web lists nodes per-graph (workItems where graph.id = currentGraph), but MCP create_node had no graph_id parameter and never created a BELONGS_TO relationship, so every node an AI created was orphaned and shown in NO graph view. This also undermined the edge fix: an AI's nodes never appeared, so neither did the edges between them. Add an optional graph_id to the create_node tool + CreateNodeArgs; when present, MATCH the graph and MERGE (n)-[:BELONGS_TO]->(g). A graph_id that matches no graph returns a clean error instead of silently creating an unattached node. Omitting graph_id stays backward-compatible. Real-Neo4j contract test covers all three: attached (BELONGS_TO + shows in get_graph_context), and unknown graph_id errors. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
MCP node creation also used non-canonical property names the GraphQL server/web schema don't read: priorityComputed (vs priorityComp), sphericalRadius/Theta/Phi (vs radius/theta/phi), and it never set positionX/Y/Z or priority at all. So AI-created nodes showed priority 0 at the origin in the web, and MCP was internally inconsistent (createNode + browseGraph used priorityComputed while updateNode and the priority/bottleneck analytics used priorityComp — updates were invisible to browse-by-priority and vice versa). Standardize createNode and executeBulkCreateNode on the canonical schema fields (positionX/Y/Z, radius, theta, phi, priority, priorityComp) while keeping the MCP-internal priorityExec/Indiv/Comm decomposition, and fix browseGraph by_priority to read priorityComp. Contract test now also asserts the canonical fields are set and no legacy priorityComputed remains. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🧪 Comprehensive Test Suite
Full-stack smoke gate runs in the CI workflow. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two related MCP↔web parity bugs in node creation (skeptical audit), both confirmed live and covered by a new real-Neo4j contract test.
1. Orphan nodes:
create_nodenever attached to a graphThe web lists nodes per-graph (
workItems(where: { graph: { id: currentGraph.id } })), butcreate_nodehad nograph_idparameter and never createdBELONGS_TO. Every node an AI created was orphaned → shown in no graph view. This also undermined the edge unify (#47): an AI's nodes never appeared, so neither did edges between them.Fix: optional
graph_idon the tool +CreateNodeArgs; when set,MATCH (g:Graph {id})…MERGE (n)-[:BELONGS_TO]->(g). Unknowngraph_id→ clean error, not a silent orphan. Omitting it stays backward-compatible.2. Non-canonical field names
create_node/bulk-create wrotepriorityComputed+sphericalRadius/Theta/Phiand omittedpositionX/Y/Z,priority,priorityComp— but the server schema + web readpositionX/Y/Z, radius, theta, phi, priority, priorityComp. So AI nodes rendered at priority 0 / the origin, and MCP was internally inconsistent (createNode/browseGraphusedpriorityComputed;updateNode+ priority/bottleneck analytics usedpriorityComp).Fix: standardize
createNode+executeBulkCreateNodeon the canonical schema fields (keeping the MCP-internalpriorityExec/Indiv/Comm), and fixbrowseGraph by_priorityto readpriorityComp.Verification
Live + contract test:
graph_idset →BELONGS_TO+ visible inget_graph_context; canonical fields (positionX,radius,priority,priorityComp) set, no legacypriorityComputed; unknowngraph_iderrors. Full CI-mode unit suite (305) green; contract suite (8) green.🤖 Generated with Claude Code