Skip to content

fix: Address cascade delete bug, add missing test coverage, remove unused code#51

Merged
spuentesp merged 2 commits into
dl-1-cleanfrom
copilot/sub-pr-47-yet-again
Dec 28, 2025
Merged

fix: Address cascade delete bug, add missing test coverage, remove unused code#51
spuentesp merged 2 commits into
dl-1-cleanfrom
copilot/sub-pr-47-yet-again

Conversation

Copy link
Copy Markdown

Copilot AI commented Dec 28, 2025

Addresses feedback from PR #47 review: cascade delete could skip the universe node when dependencies are empty, missing test coverage for edge cases, and unused code in schemas.

Changes

  • Fixed cascade delete bug: Modified Cypher query to always include universe in deletion list. Previously, UNWIND on empty dependents produced no rows, skipping the universe itself.
-- Before: UNWIND could produce zero rows
WITH u, sources + axioms + ... AS dependents
UNWIND dependents AS dependent  -- Empty listno rowsu not deleted

-- After: Universe always included
WITH u, [x IN sources + axioms + ... WHERE x:Expected] + [u] AS nodes
UNWIND nodes AS n  -- Always includes u
  • Added missing test coverage:

    • test_delete_universe_with_force_no_dependencies - Verifies force delete with empty dependents (count=1)
    • test_neo4j_client_execute_read_without_connection - Validates RuntimeError when not connected
    • test_neo4j_client_execute_write_without_connection - Validates RuntimeError when not connected
  • Removed unused code:

    • authority field from MultiverseCreate (not stored or returned)
    • field_validator import from base.py (no validators use it)

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…e, add tests

Co-authored-by: spuentesp <112034353+spuentesp@users.noreply.github.com>
Copilot AI changed the title [WIP] Add foundational data layer for managing multiverse and universes fix: Address cascade delete bug, add missing test coverage, remove unused code Dec 28, 2025
@github-actions github-actions Bot added area/data-layer Data layer changes type/tests Tests touched labels Dec 28, 2025
Copilot AI requested a review from spuentesp December 28, 2025 03:46
@spuentesp spuentesp marked this pull request as ready for review December 28, 2025 03:46
Copilot AI review requested due to automatic review settings December 28, 2025 03:46
@spuentesp spuentesp merged commit c046cc2 into dl-1-clean Dec 28, 2025
3 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses technical debt from PR #47 by fixing a cascade delete bug, adding missing test coverage for edge cases, and removing unused code from schema definitions.

  • Fixed cascade delete bug where UNWIND on an empty dependents list would skip universe deletion
  • Added test coverage for Neo4j client connection errors and force delete with no dependencies
  • Removed unused authority field from MultiverseCreate and unused field_validator import

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/data-layer/src/monitor_data/tools/neo4j_tools.py Refactored Cypher query to use list comprehension with filtering, ensuring universe node is always included in deletion list by appending [u] after filtering
packages/data-layer/tests/test_tools/test_universe_tools.py Added test to verify force delete correctly handles empty dependencies edge case (deleted_count=1)
packages/data-layer/tests/test_db/test_neo4j.py Added tests to verify RuntimeError is raised when execute_read/execute_write are called without connection
packages/data-layer/src/monitor_data/schemas/universe.py Removed unused authority field from MultiverseCreate schema (not stored in database)
packages/data-layer/src/monitor_data/schemas/base.py Removed unused field_validator import from pydantic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@spuentesp spuentesp deleted the copilot/sub-pr-47-yet-again branch April 25, 2026 00:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/data-layer Data layer changes type/tests Tests touched

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants