Skip to content

fix(ten_rust): return an error from GraphLoc::check_node_exists for a location with no node - #2348

Open
RaphaelFakhri wants to merge 1 commit into
TEN-framework:mainfrom
RaphaelFakhri:fix/graph-loc-check-node-exists-panic
Open

RaphaelFakhri wants to merge 1 commit into
TEN-framework:mainfrom
RaphaelFakhri:fix/graph-loc-check-node-exists-panic

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Summary

GraphLoc::check_node_exists called unwrap() on get_node_name() and get_node_type(). Both return an error when the location has no extension, subgraph or selector. In the tman designer, adding a connection without selecting a node reaches this function and the server panics with the type of the node must be one of extension/subgraph/selector.

The function returns Result, so this change propagates the error with ?. The API caller receives an error instead of a crashed worker.

Fixes #1877

Test

Adds graph::loc to the ten_rust integration tests. It calls check_node_exists on an empty GraphLoc and asserts the returned error message.

  • Without the fix, the test panics at src/graph/connection/mod.rs:170 with the message from the issue.
  • With the fix, the test passes, and the other 84 graph:: tests still pass.
cd core/src/ten_rust
cargo test --test integration_test graph::

… location with no node

A GraphLoc with no extension, subgraph or selector made check_node_exists panic through unwrap, which crashed the tman designer server when a connection was added without a selected node. Propagate the error instead.

This branch has not been deployed

No deployments
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.

[BUG]

1 participant