fix(hql): handle TraversalValue::Empty in DROP operations #673
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.
Summary
This PR integrates the fix from #670 into the
arena-implementationbranch. It resolves runtime errors when attempting to DROP non-existent nodes, edges, or vectors.Problem
Queries attempting to drop non-existent items failed with:
This occurred because
drop_traversaldid not handleTraversalValue::Emptyreturned when querying for non-existent items.Solution
Added
TraversalValue::Empty => Ok(())case in the match statement ofdrop_traversalinhelix-db/src/helix_engine/traversal_core/ops/util/drop.rs:51.This treats empty traversals as successful no-ops, making DROP operations idempotent.
Testing
cargo checkpasses with no errorshelix_enginetests pass, including all DROP-related testsRelated
Co-Authored-By: ishaksebsib
Greptile Overview
Updated On: 2025-10-29 11:44:54 UTC
Greptile Summary
Added handling for
TraversalValue::Emptyin DROP operations to prevent runtime errors when attempting to drop non-existent nodes, edges, or vectors.TraversalValue::Emptyis handled elsewhere in the codebase (returns default/neutral values)Important Files Changed
File Analysis
TraversalValue::Emptyhandling to gracefully treat empty traversals as no-ops in DROP operationsSequence Diagram
sequenceDiagram participant Client participant HQL participant drop_traversal participant collect_to_obj participant Storage Client->>HQL: DROP N<NodeType>(non_existent_id) HQL->>collect_to_obj: Query for node by ID collect_to_obj->>Storage: Fetch node Storage-->>collect_to_obj: No results found collect_to_obj-->>HQL: TraversalValue::Empty HQL->>drop_traversal: Process traversal items alt Empty traversal (after fix) drop_traversal-->>HQL: Ok(()) - no-op HQL-->>Client: Success else Empty traversal (before fix) drop_traversal-->>HQL: ConversionError HQL-->>Client: Error: "Incorrect Type: Empty" end