Skip to content

Conversation

@ishaksebsib
Copy link
Contributor

@ishaksebsib ishaksebsib commented Oct 24, 2025

Description

This PR fixes a runtime error in DROP operations when attempting to drop non-existent nodes, ensuring graceful handling of empty traversals.

Problem

Queries like DROP N<NodeType>(id) on non-existent IDs failed with "Conversion error: Incorrect Type: Empty" because drop_traversal did not handle TraversalValue::Empty returned by collect_to_obj().

Solution

Added TraversalValue::Empty => Ok(()), in the match statement of drop_traversal. This treats empty traversals as successful no-ops.

Related Issues

None

Checklist when merging to main

  • No compiler warnings (if applicable)
  • Code is formatted with rustfmt
  • No useless or dead code (if applicable)
  • Code is easy to understand
  • Doc comments are used for all functions, enums, structs, and fields (where appropriate)
  • All tests pass
  • Performance has not regressed (assuming change was not to fix a bug)
  • Version number has been updated in helix-cli/Cargo.toml and helixdb/Cargo.toml

Additional Notes

curl -X POST http://localhost:6969/DeleteNode \
      -H "Content-Type: application/json" \
      -d '{
      "node_id": "550e8400-e29b-41d4-a716-446655440007"
      }'

Conversion error: Incorrect Type: Empty⏎

Greptile Overview

Updated On: 2025-10-24 19:24:02 UTC

Greptile Summary

Fixed runtime error when attempting to DROP non-existent nodes by adding TraversalValue::Empty => Ok(()) case to the match statement in drop_traversal().

  • Resolved "Conversion error: Incorrect Type: Empty" error when dropping nodes by ID that don't exist
  • Empty traversals now treated as successful no-ops, consistent with how other parts of the codebase handle TraversalValue::Empty
  • Minor formatting improvements applied to let-chain syntax for consistency

Important Files Changed

File Analysis

Filename Score Overview
helix-db/src/helix_engine/traversal_core/ops/util/drop.rs 5/5 Added handling for TraversalValue::Empty case in drop_traversal to gracefully handle dropping non-existent nodes; minor formatting fixes applied

Sequence 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
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

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.

1 participant