fix: Address cascade delete bug, add missing test coverage, remove unused code#51
Merged
Merged
Conversation
…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
There was a problem hiding this comment.
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
authorityfield fromMultiverseCreateand unusedfield_validatorimport
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
UNWINDon empty dependents produced no rows, skipping the universe itself.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 connectedtest_neo4j_client_execute_write_without_connection- Validates RuntimeError when not connectedRemoved unused code:
authorityfield fromMultiverseCreate(not stored or returned)field_validatorimport frombase.py(no validators use it)💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.