Don't include the document node path in the stable node id by default (#1388)

* Don't include the document node path in the stable node id by default

Make the inclusion of the document path for the stable node id optional
and only enable it for the MonitorNode for now

* Fix tests
This commit is contained in:
Dennis Kobert 2023-08-13 12:25:42 +02:00 committed by GitHub
parent dc4b16aead
commit 752df128e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 8 deletions

View file

@ -40,6 +40,8 @@ pub struct DocumentNode {
pub inputs: Vec<NodeInput>,
pub implementation: DocumentNodeImplementation,
pub metadata: DocumentNodeMetadata,
#[serde(default)]
pub skip_deduplication: bool,
pub path: Option<Vec<NodeId>>,
}
@ -97,6 +99,7 @@ impl DocumentNode {
input,
construction_args: args,
document_node_path: self.path.unwrap_or(Vec::new()),
skip_deduplication: self.skip_deduplication,
}
} else {
unreachable!("tried to resolve not flattened node on resolved node {:?}", self);
@ -1063,6 +1066,7 @@ mod test {
input: ProtoNodeInput::Network(concrete!(u32)),
construction_args: ConstructionArgs::Nodes(vec![(0, false)]),
document_node_path: vec![],
skip_deduplication: false,
};
assert_eq!(proto_node, reference);
}
@ -1080,6 +1084,7 @@ mod test {
input: ProtoNodeInput::Network(concrete!(u32)),
construction_args: ConstructionArgs::Nodes(vec![(14, false)]),
document_node_path: vec![1, 0],
skip_deduplication: false,
},
),
(
@ -1089,6 +1094,7 @@ mod test {
input: ProtoNodeInput::Node(10, false),
construction_args: ConstructionArgs::Nodes(vec![]),
document_node_path: vec![1, 1],
skip_deduplication: false,
},
),
(14, ProtoNode::value(ConstructionArgs::Value(TaggedValue::U32(2)), vec![1, 4])),