Skip to content

Conversation

@siillee
Copy link
Contributor

@siillee siillee commented Nov 6, 2025

Description

Changed the key used for openai, since we changed the keys in the secrets.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Other (please specify):

Screenshots/Videos (if applicable)

Pre-submission Checklist

  • I have tested my changes thoroughly before submitting this PR
  • This PR contains minimal changes necessary to address the issue/feature
  • My code follows the project's coding standards and style guidelines
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if applicable)
  • All new and existing tests pass
  • I have searched existing PRs to ensure this change hasn't been submitted already
  • I have linked any relevant issues in the description
  • My commits have clear and descriptive messages

DCO Affirmation

I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.

@siillee siillee self-assigned this Nov 6, 2025
@pull-checklist
Copy link

pull-checklist bot commented Nov 6, 2025

Please make sure all the checkboxes are checked:

  • I have tested these changes locally.
  • I have reviewed the code changes.
  • I have added end-to-end and unit tests (if applicable).
  • I have updated the documentation and README.md file (if necessary).
  • I have removed unnecessary code and debug statements.
  • PR title is clear and follows the convention.
  • I have tagged reviewers or team members for feedback.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 6, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The PR introduces backend access control with multi-user database isolation, adds a custom pipeline execution API, extends the Edge model with descriptive text labels, refactors data indexing workflows, and implements session persistence functionality. Configuration changes default backend access control to enabled, with multi-user support validation. New tests validate session persistence, edge text handling, and indexing changes.

Changes

Cohort / File(s) Summary
Backend Access Control & Configuration
.env.template, cognee/context_global_variables.py
ENABLE_BACKEND_ACCESS_CONTROL default changed from false to true. New multi-user support flags and backend_access_control_enabled() function added to validate and control database isolation per user.
Core API & Module Initialization
cognee/__init__.py, cognee/modules/run_custom_pipeline/__init__.py, cognee/modules/run_custom_pipeline/run_custom_pipeline.py
run_custom_pipeline function exported as public API. New async function accepts tasks and data, resolves pipeline executor, and invokes memify with DB configs and context setup.
Client & API Setup
cognee/api/client.py, entrypoint.sh
Logging setup called at module import; startup log message added. Shell startup commands replaced with exec to ensure proper log redirection via gunicorn.
Edge Model & Graph Representation
cognee/infrastructure/engine/models/Edge.py, cognee/modules/chunking/models/DocumentChunk.py
Edge model gains optional edge_text field with auto-population validator. DocumentChunk.contains expanded to include (Edge, Entity) tuples alongside plain entities.
Edge Processing & Graph Utilities
cognee/modules/graph/utils/expand_with_nodes_and_edges.py, cognee/modules/graph/utils/resolve_edges_to_text.py, cognee/modules/graph/cognee_graph/CogneeGraph.py
Entities in contains relationship now paired with descriptive Edge objects. Edge-to-text resolution refactored with modularized helpers for node extraction and title generation. Edge distance lookup prefers edge_text over relationship_type.
Search & Retrieval
cognee/modules/search/methods/search.py, cognee/modules/retrieval/utils/brute_force_triplet_search.py
Runtime environment checks replaced with backend_access_control_enabled() function call. Edge properties projection expanded to include edge_text.
User Authentication & Management
cognee/modules/users/methods/get_authenticated_user.py, cognee/modules/users/methods/get_default_user.py
Authentication requirement now driven by backend_access_control_enabled(). Return type annotation of get_default_user() changed from SimpleNamespace to User.
Session Persistence & Memify Tasks
cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py, cognee/tasks/memify/__init__.py, cognee/tasks/memify/cognify_session.py, cognee/tasks/memify/extract_user_sessions.py
New pipeline function persists user sessions to knowledge graph with write authorization checks. New session extraction and cognification tasks with error handling and validation.
Data Storage & Indexing
cognee/tasks/storage/index_data_points.py, cognee/tasks/storage/index_graph_edges.py
Data point indexing refactored to group by type/field with unified batching. Graph edge indexing simplified to delegate to index_data_points via new create_edge_type_datapoints() helper.
Bug Fixes
cognee/infrastructure/databases/vector/create_vector_engine.py
Error message corrected from "Unsupported graph database provider" to "Unsupported vector database provider".
Tests — Core Features
cognee/tests/test_edge_ingestion.py, cognee/tests/unit/modules/memify_tasks/test_cognify_session.py, cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py
New assertions validate edge_text presence and formatting. Unit tests added for session cognification and extraction with error scenarios.
Tests — Search & Indexing
cognee/tests/test_add_docling_document.py, cognee/tests/test_search_db.py, cognee/tests/test_library.py, cognee/tests/unit/infrastructure/databases/test_index_data_points.py, cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py
Search result access paths updated to navigate nested structure when backend access control enabled. Vector engine and edge indexing tests refactored for new indexing delegation model.
Tests — Integration & Load
cognee/tests/test_conversation_history.py, cognee/tests/test_load.py, cognee/tests/test_feedback_enrichment.py, cognee/tests/test_relational_db_migration.py
Session persistence integration tests added with graph node count assertions. Load test added to measure performance. Feedback enrichment test updated to use variable dataset name. Backend access control disabled in relational migration test setup.
Tests — Auth & Configuration
cognee/tests/unit/api/test_conditional_authentication_endpoints.py, cognee/tests/unit/modules/users/test_conditional_authentication.py
Authentication testing moved to lazy fixture-driven imports. Default authentication behavior tests removed; focus retained on explicit true parsing.
Examples — Enhanced & New
examples/python/run_custom_pipeline_example.py, examples/python/conversation_session_persistence_example.py, examples/python/code_graph_example.py, examples/python/relational_database_migration_example.py
New examples demonstrate custom pipeline and session persistence workflows. Existing examples updated to disable backend access control or handle nested search result structure.
Examples — Updated Search Result Handling
examples/python/agentic_reasoning_procurement_example.py, examples/python/memify_coding_agent_example.py, examples/python/feedback_enrichment_minimal_example.py, examples/python/simple_example.py
Search result access paths updated to reflect nested structure. Dataset parameter handling adjusted. Example output comments removed for simplification.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant API as persist_sessions_in_knowledge_graph_pipeline
    participant AuthZ as Authorization Check
    participant Context as Global Context
    participant MemifyPipeline as Memify Pipeline
    participant Graph as Knowledge Graph
    
    User->>API: Call with session_ids, dataset
    API->>AuthZ: Check user write access to dataset
    AuthZ-->>API: Access granted/denied
    alt Access Denied
        API-->>User: CogneeValidationError
    else Access Granted
        API->>Context: Set dataset & owner context
        API->>API: Build extraction tasks (extract_sessions)
        API->>API: Build enrichment tasks (cognify_session)
        API->>MemifyPipeline: Run pipeline with tasks & empty data
        MemifyPipeline->>Graph: Persist sessions as nodes/edges
        MemifyPipeline-->>API: Result
        API-->>User: Return pipeline result
    end
Loading
sequenceDiagram
    participant Caller
    participant CustomPipeline as run_custom_pipeline
    participant Executor as Pipeline Executor
    participant TaskRunner as Task Runner
    participant DataStores as Data Stores
    
    Caller->>CustomPipeline: tasks, data, dataset, user, configs
    CustomPipeline->>Executor: Resolve executor (background flag)
    CustomPipeline->>CustomPipeline: Set global context (dataset, user)
    CustomPipeline->>Executor: Invoke with tasks, data, DB configs
    Executor->>TaskRunner: Execute task sequence
    TaskRunner->>DataStores: Apply operations
    DataStores-->>TaskRunner: Results
    TaskRunner-->>Executor: Task completion
    Executor-->>CustomPipeline: Return result
    CustomPipeline-->>Caller: Pipeline result
Loading
sequenceDiagram
    participant Extract as extract_user_sessions
    participant Auth as Current User Context
    participant Cache as Cache Engine
    participant Yield as Caller
    
    Yield->>Extract: Call with session_ids
    Extract->>Auth: Get current user
    alt User not found
        Extract-->>Yield: CogneeSystemError
    else
        Extract->>Cache: Get cache engine
        alt Cache unavailable
            Extract-->>Yield: CogneeSystemError
        else
            loop For each session_id
                Extract->>Cache: Retrieve Q&A pairs
                Extract->>Extract: Format session string
                Extract-->>Yield: Yield session data
            end
        end
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Key areas requiring extra attention:

  • cognee/context_global_variables.py: New backend_access_control_enabled() logic and multi-user support flags affect access control throughout the system; validate environment variable parsing and fallback behavior
  • cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py: Authorization checks and context setup must prevent unauthorized data access; review dataset ownership validation and error propagation
  • cognee/tasks/storage/index_data_points.py and index_graph_edges.py: Significant refactoring of indexing logic with new grouping/batching strategy; verify no regression in index creation and ensure batch sizing is correct
  • Edge model and graph utility changes: New edge_text field and (Edge, Entity) tuple structure flow through multiple modules; ensure data structure consistency across chunking, graph expansion, and retrieval paths
  • Search result structure changes: Tests and examples updated to handle nested search results; validate this change is backward-compatible or properly gated by access control
  • Test coverage: New load test and session persistence tests add complexity; review performance assertions and async generator patterns in new memify tests

Possibly related PRs

  • feat: optimize repeated entity extraction #1682: Directly related—both add Edge.edge_text field and validator, update DocumentChunk.contains to include (Edge, Entity) tuples, and refactor graph/edge indexing to prefer edge_text
  • Merge main again #953: Overlapping backend access control implementation—both modify ENABLE_BACKEND_ACCESS_CONTROL handling and add/adjust context configuration helpers
  • release: 0.2.1.dev1 #1089: Extensive code-level overlap—shares context_global_variables access control changes, Edge.edge_text handling, expand/resolve edges utilities, and search/auth gating logic

Suggested labels

run-checks, feature, backend, graph

Suggested reviewers

  • borisarzentar
  • lxobr
  • hajdul88

Poem

🐰 A rabbit's ode to your grand expansion:
Edges now whisper their tale with text so true,
Sessions persist where knowledge graphs grew anew,
Custom pipelines run swift through the night,
Access controls guard each database's light,
Multi-user support hops forth so bright! 🌿

Pre-merge checks and finishing touches

❌ Failed checks (3 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description states 'Changed the key used for openai, since we changed the keys in the secrets' but the actual changeset contains extensive changes to backend access control, custom pipelines, session persistence, and edge handling. The description is largely incomplete and does not match the changeset. Provide a comprehensive description of the actual changes made, including the introduction of multi-user support, backend access control features, new pipeline functions, and session persistence capabilities.
Docstring Coverage ⚠️ Warning Docstring coverage is 64.62% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ⚠️ Warning The PR title 'test: fix weighted edges example' does not match the actual changes in the changeset, which involve extensive refactoring of backend access control, multi-user support, edge text handling, and numerous API changes across the codebase. Update the PR title to accurately reflect the primary changes, such as 'feat: implement backend access control and multi-user support with edge text enhancements' or similar, to better represent the scope of modifications.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@siillee siillee changed the base branch from dev to main November 6, 2025 10:49
@gitguardian
Copy link

gitguardian bot commented Nov 6, 2025

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@siillee siillee changed the base branch from main to dev November 6, 2025 10:49
@siillee siillee changed the base branch from dev to main November 6, 2025 10:52
@siillee siillee requested a review from pazone November 6, 2025 11:04
@siillee siillee changed the title test: fix weighted edges example test: fix weighted edges example (WORK IN PROGRESS, DO NOT MERGE) Nov 6, 2025
@siillee siillee marked this pull request as draft November 6, 2025 11:06
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
cognee/tests/test_add_docling_document.py (1)

42-52: Handle both enabled and disabled backend access control states.

This test hardcodes access to answer[0]["search_result"][0], which only exists when backend_access_control_enabled() is True. When backend access control is disabled (or when multi_user_support_possible() returns False), the search results are returned directly without the "search_result" wrapper, causing a KeyError.

Update the assertions to conditionally handle both cases, matching the pattern used in test_search_db.py:

from cognee.context_global_variables import backend_access_control_enabled

# After each cognee.search() call:
if backend_access_control_enabled():
    lowercase_answer = answer[0]["search_result"][0].lower()
else:
    lowercase_answer = answer[0].lower()
🧹 Nitpick comments (7)
cognee/tests/test_feedback_enrichment.py (1)

171-174: Consider refactoring to pytest pattern.

This test uses a standalone script structure with asyncio.run(main()) instead of pytest's async test pattern. According to the coding guidelines, async tests should use pytest.mark.asyncio.

Consider refactoring to:

-if __name__ == "__main__":
-    import asyncio
-
-    asyncio.run(main())
+import pytest
+
+@pytest.mark.asyncio
+async def test_feedback_enrichment():
+    """End-to-end integration test for feedback enrichment feature."""
+    # Move the main() function body here

This would:

  • Enable test discovery and execution via pytest
  • Improve CI/CD integration
  • Provide better test reporting and fixtures support

As per coding guidelines.

examples/python/run_custom_pipeline_example.py (1)

15-84: Consider adding error handling for production-ready examples.

The example demonstrates the API well but lacks error handling for common failures (LLM API errors, database connection issues, etc.). While this keeps the example concise, consider adding at least a try-except block around the pipeline operations to show best practices.

Example pattern:

 async def main():
+    try:
         # Create a clean slate for cognee -- reset data and system state
         print("Resetting cognee data...")
         await cognee.prune.prune_data()
         # ... rest of the code ...
+    except Exception as e:
+        logger.error(f"Pipeline execution failed: {e}")
+        raise
cognee/tests/unit/infrastructure/databases/test_index_data_points.py (1)

12-27: Test coverage is good but consider edge cases.

The test validates the happy path well. Consider adding tests for:

  • Empty data_points list
  • Data points with no index_fields
  • Data points with multiple index_fields
  • Batch size smaller than data points count

Example:

@pytest.mark.asyncio
async def test_index_data_points_with_empty_list():
    """Test that index_data_points handles empty list gracefully."""
    mock_vector_engine = AsyncMock()
    
    with patch.dict(
        index_data_points.__globals__,
        {"get_vector_engine": lambda: mock_vector_engine},
    ):
        result = await index_data_points([])
    
    assert result == []
    assert mock_vector_engine.create_vector_index.await_count == 0
cognee/tests/test_search_db.py (1)

150-150: Move import to module level.

The import of backend_access_control_enabled is placed inside the function. Per Python conventions, imports should be at the module level unless there's a specific reason (e.g., avoiding circular imports or optional dependencies).

Apply this diff to move the import to the top of the file:

 from cognee.modules.retrieval.graph_summary_completion_retriever import (
     GraphSummaryCompletionRetriever,
 )
 from cognee.shared.logging_utils import get_logger
 from cognee.modules.search.types import SearchType
 from collections import Counter
+from cognee.context_global_variables import backend_access_control_enabled
 
 logger = get_logger()

And remove it from line 150:

-
-        from cognee.context_global_variables import backend_access_control_enabled
-
         if backend_access_control_enabled():
cognee/modules/search/methods/search.py (1)

159-202: Consider removing unnecessary else clause (optional).

The else clause at line 159 is technically unnecessary since the if block at line 159 returns. Removing it would reduce indentation and align with Pylint's suggestion.

However, the current structure makes the two branches explicit, which may improve readability. This is a style preference, and the current code is acceptable.

cognee/modules/chunking/models/DocumentChunk.py (1)

35-35: Update the docstring to reflect the new tuple type.

The docstring at line 25 states that contains is "A list of entities or events contained within the chunk" but the type now includes tuple[Edge, Entity]. Please update the docstring to document this new capability.

Apply this diff to update the docstring:

-    - contains: A list of entities or events contained within the chunk (default is None).
+    - contains: A list of entities, events, or (Edge, Entity) tuples contained within the chunk (default is None).
cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py (1)

62-67: Remove unused mock from patch dict.

Line 66 includes "get_vector_engine": lambda: AsyncMock() in the patch dict, but this mock is not used in the test. The test validates initialization failure via get_graph_engine, so the vector engine mock appears to be leftover code.

Apply this diff to remove the unused mock:

     with patch.dict(
         index_graph_edges.__globals__,
         {
             "get_graph_engine": AsyncMock(side_effect=Exception("Graph engine failed")),
-            "get_vector_engine": lambda: AsyncMock(),
         },
     ):
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1e53138 and 5dc8d4e.

⛔ Files ignored due to path filters (7)
  • .github/workflows/e2e_tests.yml is excluded by !**/*.yml
  • .github/workflows/examples_tests.yml is excluded by !**/*.yml
  • .github/workflows/search_db_tests.yml is excluded by !**/*.yml
  • .github/workflows/test_different_operating_systems.yml is excluded by !**/*.yml
  • .github/workflows/test_suites.yml is excluded by !**/*.yml
  • .github/workflows/weighted_edges_tests.yml is excluded by !**/*.yml
  • docker-compose.yml is excluded by !**/*.yml
📒 Files selected for processing (45)
  • .env.template (1 hunks)
  • cognee/__init__.py (1 hunks)
  • cognee/api/client.py (2 hunks)
  • cognee/context_global_variables.py (3 hunks)
  • cognee/infrastructure/databases/vector/create_vector_engine.py (1 hunks)
  • cognee/infrastructure/engine/models/Edge.py (2 hunks)
  • cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py (1 hunks)
  • cognee/modules/chunking/models/DocumentChunk.py (2 hunks)
  • cognee/modules/graph/cognee_graph/CogneeGraph.py (1 hunks)
  • cognee/modules/graph/utils/expand_with_nodes_and_edges.py (2 hunks)
  • cognee/modules/graph/utils/resolve_edges_to_text.py (1 hunks)
  • cognee/modules/retrieval/utils/brute_force_triplet_search.py (1 hunks)
  • cognee/modules/run_custom_pipeline/__init__.py (1 hunks)
  • cognee/modules/run_custom_pipeline/run_custom_pipeline.py (1 hunks)
  • cognee/modules/search/methods/search.py (3 hunks)
  • cognee/modules/users/methods/get_authenticated_user.py (1 hunks)
  • cognee/modules/users/methods/get_default_user.py (1 hunks)
  • cognee/tasks/memify/__init__.py (1 hunks)
  • cognee/tasks/memify/cognify_session.py (1 hunks)
  • cognee/tasks/memify/extract_user_sessions.py (1 hunks)
  • cognee/tasks/storage/index_data_points.py (1 hunks)
  • cognee/tasks/storage/index_graph_edges.py (3 hunks)
  • cognee/tests/test_add_docling_document.py (1 hunks)
  • cognee/tests/test_conversation_history.py (2 hunks)
  • cognee/tests/test_edge_ingestion.py (1 hunks)
  • cognee/tests/test_feedback_enrichment.py (1 hunks)
  • cognee/tests/test_library.py (1 hunks)
  • cognee/tests/test_load.py (1 hunks)
  • cognee/tests/test_relational_db_migration.py (1 hunks)
  • cognee/tests/test_search_db.py (1 hunks)
  • cognee/tests/unit/api/test_conditional_authentication_endpoints.py (6 hunks)
  • cognee/tests/unit/infrastructure/databases/test_index_data_points.py (1 hunks)
  • cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py (2 hunks)
  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py (1 hunks)
  • cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py (1 hunks)
  • cognee/tests/unit/modules/users/test_conditional_authentication.py (0 hunks)
  • entrypoint.sh (1 hunks)
  • examples/python/agentic_reasoning_procurement_example.py (1 hunks)
  • examples/python/code_graph_example.py (2 hunks)
  • examples/python/conversation_session_persistence_example.py (1 hunks)
  • examples/python/feedback_enrichment_minimal_example.py (0 hunks)
  • examples/python/memify_coding_agent_example.py (1 hunks)
  • examples/python/relational_database_migration_example.py (1 hunks)
  • examples/python/run_custom_pipeline_example.py (1 hunks)
  • examples/python/simple_example.py (0 hunks)
💤 Files with no reviewable changes (3)
  • examples/python/simple_example.py
  • examples/python/feedback_enrichment_minimal_example.py
  • cognee/tests/unit/modules/users/test_conditional_authentication.py
🧰 Additional context used
📓 Path-based instructions (5)
{cognee,cognee-mcp,distributed,examples,alembic}/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

{cognee,cognee-mcp,distributed,examples,alembic}/**/*.py: Use 4-space indentation; name modules and functions in snake_case; name classes in PascalCase (Python)
Adhere to ruff rules, including import hygiene and configured line length (100)
Keep Python lines ≤ 100 characters

Files:

  • cognee/tests/test_library.py
  • cognee/tests/unit/api/test_conditional_authentication_endpoints.py
  • cognee/modules/users/methods/get_authenticated_user.py
  • cognee/modules/graph/cognee_graph/CogneeGraph.py
  • examples/python/agentic_reasoning_procurement_example.py
  • cognee/tasks/storage/index_data_points.py
  • cognee/modules/retrieval/utils/brute_force_triplet_search.py
  • cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py
  • cognee/tests/test_edge_ingestion.py
  • cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py
  • examples/python/conversation_session_persistence_example.py
  • cognee/modules/search/methods/search.py
  • cognee/modules/chunking/models/DocumentChunk.py
  • cognee/tests/test_feedback_enrichment.py
  • examples/python/relational_database_migration_example.py
  • cognee/tests/test_search_db.py
  • cognee/modules/users/methods/get_default_user.py
  • cognee/tests/test_relational_db_migration.py
  • cognee/infrastructure/databases/vector/create_vector_engine.py
  • examples/python/code_graph_example.py
  • cognee/context_global_variables.py
  • cognee/tests/test_add_docling_document.py
  • cognee/infrastructure/engine/models/Edge.py
  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py
  • cognee/tasks/memify/cognify_session.py
  • cognee/__init__.py
  • examples/python/memify_coding_agent_example.py
  • examples/python/run_custom_pipeline_example.py
  • cognee/tasks/memify/extract_user_sessions.py
  • cognee/api/client.py
  • cognee/modules/run_custom_pipeline/run_custom_pipeline.py
  • cognee/modules/run_custom_pipeline/__init__.py
  • cognee/tests/test_conversation_history.py
  • cognee/tests/unit/infrastructure/databases/test_index_data_points.py
  • cognee/modules/graph/utils/resolve_edges_to_text.py
  • cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py
  • cognee/tasks/memify/__init__.py
  • cognee/modules/graph/utils/expand_with_nodes_and_edges.py
  • cognee/tests/test_load.py
  • cognee/tasks/storage/index_graph_edges.py
cognee/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

cognee/**/*.py: Public APIs in the core library should be type-annotated where practical
Prefer explicit, structured error handling and use shared logging utilities from cognee.shared.logging_utils

Files:

  • cognee/tests/test_library.py
  • cognee/tests/unit/api/test_conditional_authentication_endpoints.py
  • cognee/modules/users/methods/get_authenticated_user.py
  • cognee/modules/graph/cognee_graph/CogneeGraph.py
  • cognee/tasks/storage/index_data_points.py
  • cognee/modules/retrieval/utils/brute_force_triplet_search.py
  • cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py
  • cognee/tests/test_edge_ingestion.py
  • cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py
  • cognee/modules/search/methods/search.py
  • cognee/modules/chunking/models/DocumentChunk.py
  • cognee/tests/test_feedback_enrichment.py
  • cognee/tests/test_search_db.py
  • cognee/modules/users/methods/get_default_user.py
  • cognee/tests/test_relational_db_migration.py
  • cognee/infrastructure/databases/vector/create_vector_engine.py
  • cognee/context_global_variables.py
  • cognee/tests/test_add_docling_document.py
  • cognee/infrastructure/engine/models/Edge.py
  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py
  • cognee/tasks/memify/cognify_session.py
  • cognee/__init__.py
  • cognee/tasks/memify/extract_user_sessions.py
  • cognee/api/client.py
  • cognee/modules/run_custom_pipeline/run_custom_pipeline.py
  • cognee/modules/run_custom_pipeline/__init__.py
  • cognee/tests/test_conversation_history.py
  • cognee/tests/unit/infrastructure/databases/test_index_data_points.py
  • cognee/modules/graph/utils/resolve_edges_to_text.py
  • cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py
  • cognee/tasks/memify/__init__.py
  • cognee/modules/graph/utils/expand_with_nodes_and_edges.py
  • cognee/tests/test_load.py
  • cognee/tasks/storage/index_graph_edges.py
cognee/tests/**/test_*.py

📄 CodeRabbit inference engine (AGENTS.md)

cognee/tests/**/test_*.py: Name test files as test_*.py
Use pytest.mark.asyncio for async tests
Tests should avoid external state; rely on fixtures and CI-provided env vars when providers are required

Files:

  • cognee/tests/test_library.py
  • cognee/tests/unit/api/test_conditional_authentication_endpoints.py
  • cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py
  • cognee/tests/test_edge_ingestion.py
  • cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py
  • cognee/tests/test_feedback_enrichment.py
  • cognee/tests/test_search_db.py
  • cognee/tests/test_relational_db_migration.py
  • cognee/tests/test_add_docling_document.py
  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py
  • cognee/tests/test_conversation_history.py
  • cognee/tests/unit/infrastructure/databases/test_index_data_points.py
  • cognee/tests/test_load.py
cognee/tests/unit/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Place unit tests under cognee/tests/unit/

Files:

  • cognee/tests/unit/api/test_conditional_authentication_endpoints.py
  • cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py
  • cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py
  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py
  • cognee/tests/unit/infrastructure/databases/test_index_data_points.py
examples/python/**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

When adding public APIs, provide or update targeted examples under examples/python/

Files:

  • examples/python/agentic_reasoning_procurement_example.py
  • examples/python/conversation_session_persistence_example.py
  • examples/python/relational_database_migration_example.py
  • examples/python/code_graph_example.py
  • examples/python/memify_coding_agent_example.py
  • examples/python/run_custom_pipeline_example.py
🧠 Learnings (8)
📚 Learning: 2025-10-27T09:21:14.154Z
Learnt from: CR
Repo: topoteretes/cognee PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-27T09:21:14.154Z
Learning: Applies to cognee/tests/**/test_*.py : Tests should avoid external state; rely on fixtures and CI-provided env vars when providers are required

Applied to files:

  • cognee/tests/unit/api/test_conditional_authentication_endpoints.py
📚 Learning: 2024-11-13T16:17:17.646Z
Learnt from: hajdul88
Repo: topoteretes/cognee PR: 196
File: cognee/modules/graph/cognee_graph/CogneeGraphElements.py:82-90
Timestamp: 2024-11-13T16:17:17.646Z
Learning: In `cognee/modules/graph/cognee_graph/CogneeGraphElements.py`, within the `Edge` class, nodes and edges can have different dimensions, and it's acceptable for them not to match.

Applied to files:

  • cognee/modules/graph/cognee_graph/CogneeGraph.py
  • cognee/modules/chunking/models/DocumentChunk.py
  • cognee/modules/graph/utils/expand_with_nodes_and_edges.py
📚 Learning: 2024-11-13T16:06:32.576Z
Learnt from: hajdul88
Repo: topoteretes/cognee PR: 196
File: cognee/modules/graph/cognee_graph/CogneeGraph.py:32-38
Timestamp: 2024-11-13T16:06:32.576Z
Learning: In `CogneeGraph.py`, within the `CogneeGraph` class, it's intentional to add skeleton edges in both the `add_edge` method and the `project_graph_from_db` method to ensure that edges are added to the graph and to the nodes.

Applied to files:

  • cognee/modules/graph/cognee_graph/CogneeGraph.py
  • cognee/modules/retrieval/utils/brute_force_triplet_search.py
  • cognee/infrastructure/engine/models/Edge.py
  • cognee/modules/graph/utils/expand_with_nodes_and_edges.py
📚 Learning: 2024-12-04T18:37:55.092Z
Learnt from: hajdul88
Repo: topoteretes/cognee PR: 251
File: cognee/tests/infrastructure/databases/test_index_graph_edges.py:0-0
Timestamp: 2024-12-04T18:37:55.092Z
Learning: In the `index_graph_edges` function, both graph engine and vector engine initialization failures are handled within the same try-except block, so a single test covers both cases.

Applied to files:

  • cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py
  • cognee/tests/unit/infrastructure/databases/test_index_data_points.py
  • cognee/tasks/storage/index_graph_edges.py
📚 Learning: 2025-10-27T09:21:14.154Z
Learnt from: CR
Repo: topoteretes/cognee PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-27T09:21:14.154Z
Learning: Applies to cognee/tests/**/test_*.py : Use pytest.mark.asyncio for async tests

Applied to files:

  • cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py
  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py
📚 Learning: 2024-11-13T14:55:05.912Z
Learnt from: 0xideas
Repo: topoteretes/cognee PR: 205
File: cognee/tests/unit/processing/chunks/chunk_by_paragraph_test.py:7-7
Timestamp: 2024-11-13T14:55:05.912Z
Learning: When changes are made to the chunking implementation in `cognee/tasks/chunks`, the ground truth values in the corresponding tests in `cognee/tests/unit/processing/chunks` need to be updated accordingly.

Applied to files:

  • cognee/modules/chunking/models/DocumentChunk.py
📚 Learning: 2025-10-27T09:21:14.154Z
Learnt from: CR
Repo: topoteretes/cognee PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-27T09:21:14.154Z
Learning: Applies to cognee/tests/unit/**/*.py : Place unit tests under cognee/tests/unit/

Applied to files:

  • cognee/tests/unit/modules/memify_tasks/test_cognify_session.py
📚 Learning: 2025-10-27T09:21:14.154Z
Learnt from: CR
Repo: topoteretes/cognee PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-27T09:21:14.154Z
Learning: Applies to examples/python/**/*.py : When adding public APIs, provide or update targeted examples under examples/python/

Applied to files:

  • examples/python/run_custom_pipeline_example.py
🧬 Code graph analysis (28)
cognee/tests/test_library.py (1)
cognee/modules/search/types/SearchType.py (1)
  • SearchType (4-19)
cognee/modules/users/methods/get_authenticated_user.py (1)
cognee/context_global_variables.py (1)
  • backend_access_control_enabled (36-50)
cognee/tasks/storage/index_data_points.py (5)
cognee/infrastructure/databases/vector/get_vector_engine.py (1)
  • get_vector_engine (5-7)
cognee/infrastructure/databases/vector/lancedb/LanceDBAdapter.py (2)
  • create_vector_index (292-295)
  • index_data_points (297-309)
cognee/infrastructure/databases/vector/pgvector/PGVectorAdapter.py (2)
  • create_vector_index (248-249)
  • index_data_points (251-263)
cognee/infrastructure/databases/vector/chromadb/ChromaDBAdapter.py (2)
  • create_vector_index (285-295)
  • index_data_points (297-319)
cognee/infrastructure/databases/vector/embeddings/EmbeddingEngine.py (1)
  • get_batch_size (38-45)
cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py (1)
cognee/tasks/storage/index_graph_edges.py (1)
  • index_graph_edges (42-77)
cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py (2)
cognee/tasks/memify/extract_user_sessions.py (1)
  • extract_user_sessions (12-73)
cognee/exceptions/exceptions.py (1)
  • CogneeSystemError (38-49)
examples/python/conversation_session_persistence_example.py (5)
cognee/api/v1/visualize/visualize.py (1)
  • visualize_graph (14-27)
cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py (1)
  • persist_sessions_in_knowledge_graph_pipeline (19-55)
cognee/modules/search/types/SearchType.py (1)
  • SearchType (4-19)
cognee/modules/users/methods/get_default_user.py (1)
  • get_default_user (13-36)
cognee/shared/logging_utils.py (1)
  • get_logger (212-224)
cognee/modules/search/methods/search.py (1)
cognee/context_global_variables.py (1)
  • backend_access_control_enabled (36-50)
cognee/modules/chunking/models/DocumentChunk.py (2)
cognee/infrastructure/engine/models/Edge.py (1)
  • Edge (5-38)
cognee/modules/engine/models/Event.py (1)
  • Event (8-16)
cognee/tests/test_search_db.py (1)
cognee/context_global_variables.py (1)
  • backend_access_control_enabled (36-50)
cognee/modules/users/methods/get_default_user.py (1)
cognee/modules/users/models/User.py (1)
  • User (13-40)
cognee/context_global_variables.py (2)
cognee/infrastructure/databases/vector/config.py (1)
  • get_vectordb_context_config (84-90)
cognee/infrastructure/databases/graph/config.py (1)
  • get_graph_context_config (140-148)
cognee/tests/unit/modules/memify_tasks/test_cognify_session.py (2)
cognee/tasks/memify/cognify_session.py (1)
  • cognify_session (9-40)
cognee/exceptions/exceptions.py (2)
  • CogneeValidationError (52-63)
  • CogneeSystemError (38-49)
cognee/tasks/memify/cognify_session.py (2)
cognee/exceptions/exceptions.py (2)
  • CogneeValidationError (52-63)
  • CogneeSystemError (38-49)
cognee/shared/logging_utils.py (3)
  • get_logger (212-224)
  • info (205-205)
  • debug (209-209)
cognee/__init__.py (1)
cognee/modules/run_custom_pipeline/run_custom_pipeline.py (1)
  • run_custom_pipeline (14-69)
examples/python/run_custom_pipeline_example.py (8)
cognee/modules/users/methods/get_default_user.py (1)
  • get_default_user (13-36)
cognee/shared/logging_utils.py (1)
  • setup_logging (288-555)
cognee/modules/pipelines/tasks/task.py (1)
  • Task (5-97)
cognee/modules/search/types/SearchType.py (1)
  • SearchType (4-19)
cognee/tasks/ingestion/ingest_data.py (1)
  • ingest_data (25-199)
cognee/tasks/ingestion/resolve_data_directories.py (1)
  • resolve_data_directories (10-84)
cognee/modules/run_custom_pipeline/run_custom_pipeline.py (1)
  • run_custom_pipeline (14-69)
cognee/api/v1/cognify/cognify.py (1)
  • get_default_tasks (246-297)
cognee/tasks/memify/extract_user_sessions.py (3)
cognee/exceptions/exceptions.py (1)
  • CogneeSystemError (38-49)
cognee/infrastructure/databases/cache/get_cache_engine.py (1)
  • get_cache_engine (54-67)
cognee/shared/logging_utils.py (2)
  • get_logger (212-224)
  • info (205-205)
cognee/api/client.py (1)
cognee/shared/logging_utils.py (2)
  • setup_logging (288-555)
  • info (205-205)
cognee/modules/run_custom_pipeline/run_custom_pipeline.py (3)
cognee/shared/logging_utils.py (1)
  • get_logger (212-224)
cognee/modules/pipelines/tasks/task.py (1)
  • Task (5-97)
cognee/modules/pipelines/layers/pipeline_execution_mode.py (1)
  • get_pipeline_executor (117-127)
cognee/modules/run_custom_pipeline/__init__.py (1)
cognee/modules/run_custom_pipeline/run_custom_pipeline.py (1)
  • run_custom_pipeline (14-69)
cognee/tests/test_conversation_history.py (3)
cognee/infrastructure/databases/graph/get_graph_engine.py (1)
  • get_graph_engine (10-24)
cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py (1)
  • persist_sessions_in_knowledge_graph_pipeline (19-55)
cognee/infrastructure/databases/vector/get_vector_engine.py (1)
  • get_vector_engine (5-7)
cognee/tests/unit/infrastructure/databases/test_index_data_points.py (2)
cognee/tasks/storage/index_data_points.py (1)
  • index_data_points (10-65)
cognee/infrastructure/engine/models/DataPoint.py (1)
  • DataPoint (20-220)
cognee/modules/graph/utils/resolve_edges_to_text.py (2)
cognee/infrastructure/engine/models/Edge.py (1)
  • Edge (5-38)
cognee/modules/retrieval/graph_completion_retriever.py (1)
  • resolve_edges_to_text (60-74)
cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py (6)
cognee/context_global_variables.py (2)
  • set_database_global_context_variables (53-113)
  • set_session_user_context_variable (23-24)
cognee/exceptions/exceptions.py (1)
  • CogneeValidationError (52-63)
cognee/modules/data/methods/get_authorized_existing_datasets.py (1)
  • get_authorized_existing_datasets (11-39)
cognee/modules/pipelines/tasks/task.py (1)
  • Task (5-97)
cognee/tasks/memify/extract_user_sessions.py (1)
  • extract_user_sessions (12-73)
cognee/tasks/memify/cognify_session.py (1)
  • cognify_session (9-40)
cognee/tasks/memify/__init__.py (2)
cognee/tasks/memify/cognify_session.py (1)
  • cognify_session (9-40)
cognee/tasks/memify/extract_user_sessions.py (1)
  • extract_user_sessions (12-73)
entrypoint.sh (1)
cognee/shared/logging_utils.py (2)
  • debug (209-209)
  • error (207-207)
cognee/modules/graph/utils/expand_with_nodes_and_edges.py (1)
cognee/infrastructure/engine/models/Edge.py (1)
  • Edge (5-38)
cognee/tests/test_load.py (3)
cognee/modules/search/types/SearchType.py (1)
  • SearchType (4-19)
cognee/shared/logging_utils.py (1)
  • get_logger (212-224)
cognee/api/v1/config/config.py (2)
  • data_root_directory (36-38)
  • system_root_directory (18-33)
cognee/tasks/storage/index_graph_edges.py (4)
cognee/modules/engine/utils/generate_edge_id.py (1)
  • generate_edge_id (4-5)
cognee/infrastructure/databases/graph/get_graph_engine.py (1)
  • get_graph_engine (10-24)
cognee/tasks/storage/index_data_points.py (1)
  • index_data_points (10-65)
cognee/infrastructure/databases/vector/pgvector/PGVectorAdapter.py (1)
  • index_data_points (251-263)
🪛 Pylint (4.0.2)
cognee/tests/unit/api/test_conditional_authentication_endpoints.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/tests/unit/modules/memify_tasks/test_extract_user_sessions.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

examples/python/conversation_session_persistence_example.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/modules/search/methods/search.py

[refactor] 159-202: Unnecessary "else" after "return", remove the "else" and de-indent the code inside it

(R1705)

cognee/context_global_variables.py

[refactor] 38-49: Unnecessary "elif" after "return", remove the leading "el" from "elif"

(R1705)

cognee/infrastructure/engine/models/Edge.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/tests/unit/modules/memify_tasks/test_cognify_session.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/tasks/memify/cognify_session.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

examples/python/run_custom_pipeline_example.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/tasks/memify/extract_user_sessions.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/modules/run_custom_pipeline/run_custom_pipeline.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)


[refactor] 14-14: Too many arguments (9/5)

(R0913)


[refactor] 14-14: Too many positional arguments (9/5)

(R0917)

cognee/tests/unit/infrastructure/databases/test_index_data_points.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)


[refactor] 7-7: Too few public methods (0/2)

(R0903)

cognee/modules/graph/utils/resolve_edges_to_text.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/memify_pipelines/persist_sessions_in_knowledge_graph.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

cognee/tasks/storage/index_graph_edges.py

[error] 1-1: Unrecognized option found: suggestion-mode

(E0015)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Test Weighted Edges with Different Graph Databases (kuzu)
  • GitHub Check: Test Weighted Edges Examples
  • GitHub Check: Test Weighted Edges with Different Graph Databases (neo4j)
🔇 Additional comments (27)
examples/python/relational_database_migration_example.py (1)

34-36: The review comment is based on incorrect assumptions about how the code works.

The code is handling the environment variable correctly:

  1. Import-time check concern is invalid: The backend_access_control_enabled() function in cognee/context_global_variables.py uses os.environ.get("ENABLE_BACKEND_ACCESS_CONTROL", None) and performs comparison with .lower() == "true", which is called at runtime when functions execute, not during module import. Setting the environment variable before calling main() is sufficient.

  2. String "false" handling is correct: The existing code uses .lower() == "true" for comparison, which safely handles string values. Setting "false" results in "false".lower() == "true" evaluating to False, which is the intended behavior. This pattern is also used in alembic migrations (b9274c27a25a_kuzu_11_migration.py:27), confirming it's an established and correct pattern throughout the codebase.

The code in the example is consistent with how this feature is used elsewhere, including in tests and migrations. No changes are needed.

Likely an incorrect or invalid review comment.

examples/python/memify_coding_agent_example.py (1)

92-93: Verify that this file should be included in this PR.

The PR title is "test: fix weighted edges example", but this file is memify_coding_agent_example.py. Additionally, the PR description mentions changing OpenAI API keys, but the actual change modifies the search result structure to use nested indexing. Please confirm that:

  1. This file should be part of this PR
  2. The PR title and description accurately reflect all changes being made
cognee/tests/test_feedback_enrichment.py (1)

136-136: No issues found. The dataset parameter change is correct and intentional.

The verification confirms this is a successful fix, not a bug:

  • Git history shows commit "45bb3130 fix: Use same dataset name accross cognee calls," confirming intent
  • All Cognee API calls (add, cognify, memify) now consistently use the same dataset ("feedback_enrichment_test"), improving clarity
  • The test prunes data upfront, preventing contamination across operations—aligning with the retrieved learning pattern
  • memify is designed to operate on existing knowledge graphs; using the same dataset is correct

The code is working as intended.

entrypoint.sh (1)

46-51: LGTM! Good containerization practices.

The use of exec ensures proper signal handling and makes the server process PID 1, while logging to stdout/stderr (--access-logfile - and --error-logfile -) follows containerization best practices.

examples/python/run_custom_pipeline_example.py (2)

1-8: LGTM! Clean imports.

Import structure follows Python conventions and includes necessary dependencies for the example.


9-13: Good documentation for setup prerequisites.

Clear instructions for users to configure their environment before running the example.

cognee/tests/unit/infrastructure/databases/test_index_data_points.py (1)

7-9: LGTM! TestDataPoint class is appropriately minimal for testing.

The Pylint warning about too few public methods (R0903) is a false positive for test fixtures and data classes.

cognee/modules/run_custom_pipeline/__init__.py (1)

1-1: LGTM! Standard module initialization.

Clean re-export pattern that makes run_custom_pipeline available as part of the public API.

cognee/__init__.py (1)

22-22: LGTM! New public API properly exposed with example.

The addition of run_custom_pipeline to the public API is clean and follows the existing pattern. An example has been provided at examples/python/run_custom_pipeline_example.py as per coding guidelines.

Based on learnings

.env.template (1)

172-174: Verify if this breaking change is documented and intentional for this PR.

Changing ENABLE_BACKEND_ACCESS_CONTROL from false to true by default is a breaking change, but it includes a runtime safeguard. The code in cognee/context_global_variables.py explicitly raises an EnvironmentError with a clear message if unsupported databases are used, preventing silent breakage.

However:

  1. No migration guide or breaking change documentation was found in the repository (no CHANGELOG, release notes, or migration docs).
  2. The PR description doesn't mention this change—it references fixing a weighted edges example and OpenAI key changes.
  3. The .env.template comment acknowledges users should "disable mode when using not supported graph/vector databases," but doesn't indicate this was previously the default.

Verify that:

  • This change is intentional for this PR and aligns with its stated objectives.
  • Migration documentation will be added to release notes or a migration guide for users with unsupported database providers.
  • The error message is sufficiently clear for users encountering this on startup.
examples/python/agentic_reasoning_procurement_example.py (1)

171-171: Ensure the nested result structure matches the search implementation.

The change from results[category][0] to results[category][0]["search_result"][0] aligns with backend access control changes. Verify this example still runs correctly with the new structure.

cognee/modules/retrieval/utils/brute_force_triplet_search.py (1)

74-74: LGTM!

The addition of edge_text to the edge properties projection aligns with the Edge model enhancement and ensures the new field is available in the memory fragment.

cognee/modules/graph/cognee_graph/CogneeGraph.py (1)

174-177: LGTM!

The edge distance lookup now correctly prefers edge_text when available and gracefully falls back to relationship_type. This maintains backward compatibility while supporting the new edge text functionality.

cognee/modules/search/methods/search.py (1)

11-11: LGTM!

The refactoring to use backend_access_control_enabled() centralizes the access control logic and improves maintainability by replacing scattered environment variable checks with a dedicated function.

Also applies to: 77-77

cognee/modules/users/methods/get_authenticated_user.py (1)

8-8: LGTM!

The integration of backend_access_control_enabled() correctly combines with the existing REQUIRE_AUTHENTICATION environment variable, ensuring authentication is required when either condition is true.

Also applies to: 14-17

cognee/tasks/memify/__init__.py (1)

3-4: LGTM!

The package-level exports follow Python conventions and properly expose the new session-related functionality.

cognee/tests/unit/infrastructure/databases/test_index_graph_edges.py (2)

7-33: LGTM!

The test correctly validates the new delegation pathway to index_data_points and verifies that edge datapoints contain the relationship_name attribute.


37-56: LGTM!

The test appropriately validates the empty relationships case by asserting index_data_points is called with an empty list.

cognee/tests/test_edge_ingestion.py (1)

55-80: LGTM!

The new test block thoroughly validates the edge_text feature by:

  • Ensuring contains edges exist for verification
  • Checking edge_text field presence in edge properties
  • Validating edge_text format includes expected components (relationship_name, entity_name, entity_description)
  • Confirming entity names appear in the edge_text content

The test logic is sound and provides good coverage for the edge_text feature introduced in this PR.

cognee/modules/graph/utils/expand_with_nodes_and_edges.py (2)

3-3: LGTM!

The Edge import is correctly added to support the new tuple-based contains structure.


250-266: Verify backward compatibility for consumers of DocumentChunk.contains.

The change from appending plain entity_node objects to appending (Edge(...), entity_node) tuples is a structural breaking change. Code that iterates over data_chunk.contains expecting Entity objects will need updates to handle the new tuple format.

Run the following script to identify code that may be affected:

cognee/infrastructure/engine/models/Edge.py (3)

1-1: LGTM!

The field_validator import is correctly added to support the new edge_text validation logic.


21-23: LGTM!

The docstring example clearly demonstrates the intended usage of edge_text for rich embedding representation in the contains relationship.


30-38: LGTM!

The edge_text field and its validator are well-implemented:

  • The validator uses mode="before" to auto-populate edge_text from relationship_type when not explicitly provided
  • The fallback logic is clean and maintains backward compatibility
  • This enables rich edge descriptions for embeddings while keeping the API simple
cognee/tests/test_conversation_history.py (2)

19-19: LGTM!

The get_graph_engine import is appropriately added to support the new graph validation assertions.


23-23: LGTM!

The Counter import is used effectively to aggregate node type counts for graph validation.

cognee/context_global_variables.py (1)

36-51: Nice safety gates around access control.

Defaulting to capability detection while guarding the env override keeps multi-user enforcement predictable. Looks good.

@siillee siillee changed the base branch from main to dev November 6, 2025 12:11
@siillee siillee changed the title test: fix weighted edges example (WORK IN PROGRESS, DO NOT MERGE) test: fix weighted edges example Nov 6, 2025
@siillee siillee marked this pull request as ready for review November 6, 2025 12:14
@siillee siillee merged commit b5a09df into dev Nov 11, 2025
77 of 100 checks passed
@siillee siillee deleted the fix-weighted-edges-example branch November 11, 2025 10:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants