Skip to content
Prev Previous commit
Next Next commit
Fix lookup output type to allow numeric connections
Change lookup's registered output from PortType::String to PortType::Data
(matching the ndbx definition) and add Data → Float/Int/Point compatibility
rules. The runtime already returns NodeOutput::Float for numeric columns;
this fix lets the connection validator accept those wires.

https://claude.ai/code/session_01Ssbet1itX47TACaYWBM1Wo
  • Loading branch information
claude committed Feb 14, 2026
commit b7145edc27ed045efa5179779ccb9c0479d0b5ee
7 changes: 7 additions & 0 deletions crates/nodebox-core/src/node/port.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ impl PortType {
return true;
}

// Data output can connect to numeric inputs (e.g. lookup returns Float for numeric columns)
if matches!(output_type, PortType::Data)
&& matches!(input_type, PortType::Float | PortType::Int | PortType::Point)
{
return true;
}

// Everything can be converted to a string
if matches!(input_type, PortType::String) {
return true;
Expand Down
2 changes: 1 addition & 1 deletion crates/nodebox-gui/src/node_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1861,7 +1861,7 @@ pub fn create_node_from_template(template: &NodeTemplate, library: &NodeLibrary,
node = node
.with_input(Port::new("list", PortType::Data))
.with_input(Port::string("key", "x"))
.with_output_type(PortType::String);
.with_output_type(PortType::Data);
}
"filter_data" => {
node = node
Expand Down