Skip to content

Fix/deps - #87

Closed
AsphodelRem wants to merge 65 commits into
mainfrom
fix/deps
Closed

Fix/deps#87
AsphodelRem wants to merge 65 commits into
mainfrom
fix/deps

Conversation

@AsphodelRem

Copy link
Copy Markdown
Collaborator

No description provided.

AsphodelRem and others added 30 commits June 29, 2026 00:59
* add Neo4j graph storage adapter

* serialize non-primitive node fields as json and use entity_type as a Neo4j label
The adapters package imported Neo4jStorage unconditionally, which made the
optional neo4j driver a hard requirement: without it ragu.graph.index failed
to import at all.

_json_fields was a dataclass field on Node, so it reached asdict() and broke
NetworkX persistence with "'_json_fields' is not a valid key" on write_gml.
The adapter now derives JSON-encoded fields from the declared dataclass types,
and picks the node label itself, so domain types carry no backend specifics.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Three divergences from NetworkXStorage, each reproduced against a live
Neo4j 5.26 before and after the fix:

- get_all_edges_for_nodes reported the queried node as the subject, so an
  incoming edge came back reversed: "Alice works at Acme" read as the opposite
- get_node_edges returned outgoing edges only, dropping half of a node's context
- MERGE keyed on the type label, so re-upserting an id whose type changed
  created a second node with the same id; reads then picked an arbitrary one

Adds tests/storage/test_graph_contract.py, a shared suite parameterized over
every graph backend, so such divergences surface in tests rather than in
production. It was red on neo4j and green on networkx before these fixes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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