Skip to content

fix(retrieval): Neo4j subgraph confidence/as_of parity + run integration tests in CI - #828

Merged
AmitoVrito merged 2 commits into
mainfrom
fix/issue-826-neo4j-subgraph-parity
Jul 21, 2026
Merged

AmitoVrito merged 2 commits into
mainfrom
fix/issue-826-neo4j-subgraph-parity

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Summary

Post-merge follow-up to #823 (WorldModelRAG). Two separate concerns:

1. Fix Neo4j backend parity bug — closes #826

Neo4jWorldGraphBackend.query_subgraph applied the min_confidence / as_of filters only to the returned edges, not to the node/document traversal. So the neo4j / memgraph backend returned entities (and their source documents) reachable only through low-confidence or time-expired edges — diverging from InMemoryWorldGraphBackend on confidence-filtered and time-travel queries.

  • Node/document traversal now prunes on a per-path validity predicate (all(r IN rels WHERE …)), matching the in-memory BFS.
  • upsert_relation now writes MENTIONS for both endpoints, so relation-provenance documents match too (a second, related parity gap).

2. Run testcontainers integration tests in CI — closes #827

The bug reached main because the only Neo4j test was testcontainers-gated and testcontainers was never a declared dependency — so it skipped in CI. Added an integration dependency-group + a dedicated CI integration job that runs the container-backed retrieval tests for real (GitHub runners have Docker). The fast test job stays lean.

Verification (real backends, not mocks)

  • 31 passed across test_world_model.py + test_property_graph.py with live Neo4j + Kuzu containers.
  • Regression proven: the new parity test fails on the pre-fix code (assert 'Bravo' not in {'Alpha','Bravo','Charlie','Delta'} — the expired-edge node leaked) and passes on the fix.

Commits (separated by concern)

  • fix(retrieval): filter Neo4j subgraph nodes and documents by confidence/as_of (#826)
  • ci(test): run testcontainers integration tests in CI (#827)

AmitoVrito and others added 2 commits July 21, 2026 19:30
…ce/as_of (#826)

Neo4jWorldGraphBackend.query_subgraph applied min_confidence/as_of only to the
returned edges, so nodes — and their source documents — reachable solely through
low-confidence or time-expired edges leaked into results, diverging from
InMemoryWorldGraphBackend on confidence-filtered and time-travel (as_of) queries.

Prune the node/document traversal with the same per-path validity predicate the
in-memory BFS uses, and record relation-provenance documents against both edge
endpoints (MENTIONS) so document parity holds too. Verified for parity against a
live Neo4j via testcontainers; regression test fails on the pre-fix code.

Also documents the WorldModelRAG Neo4j/Memgraph backend (#823) in the changelog.

Closes #826.

Co-authored-by: Abhay Krishna <[email protected]>
Add an `integration` dependency-group (testcontainers, neo4j, networkx, kuzu)
and a dedicated CI job that installs it and runs the container-backed retrieval
tests for real. testcontainers was previously undeclared and no CI job installed
these backends, so every Neo4j/Kuzu/property-graph test skipped in CI — which is
how the #826 parity bug reached main. The fast `test` job stays lean.

Closes #827.

Co-authored-by: Abhay Krishna <[email protected]>
@AmitoVrito
AmitoVrito merged commit cbe1406 into main Jul 21, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant