Skip to content

fix: scope graph entities by user#1010

Open
wayyoungboy wants to merge 1 commit into
oceanbase:mainfrom
wayyoungboy:fix/issue-1002-graph-entity-user-scope
Open

fix: scope graph entities by user#1010
wayyoungboy wants to merge 1 commit into
oceanbase:mainfrom
wayyoungboy:fix/issue-1002-graph-entity-user-scope

Conversation

@wayyoungboy

Copy link
Copy Markdown
Member

Summary

Closes #1002.

This PR scopes OceanBase graph entities by user_id so graph entity deduplication and seed discovery no longer reuse nodes across users.

Changes:

  • adds user_id to graph_entities and indexes (user_id, name)
  • writes user_id when creating graph entities
  • filters graph entity vector search by user_id
  • filters entity name lookups used by relationship deletion by user_id
  • recreates legacy unscoped graph tables when an existing graph_entities table lacks user_id
  • avoids dropping tables if schema inspection fails; startup raises instead
  • adds unit coverage for schema creation, legacy migration, entity creation, search scoping, and deletion lookup scoping

Validation

  • python -m pytest tests/unit/test_oceanbase_graph.py -q
  • python -m pytest tests/unit -q
  • python -m flake8 src/powermem/storage/oceanbase/oceanbase_graph.py tests/unit/test_oceanbase_graph.py --select=F601,F821,E999
  • git diff --check

@wayyoungboy wayyoungboy marked this pull request as ready for review June 11, 2026 03:23
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.

graph_entities table lacks user_id — cross-user data leakage in graph search

1 participant