Fix most known issues with migrations failing to open documents from the past year (#3148)

This commit is contained in:
Keavon Chambers
2025-09-07 11:10:03 -07:00
committed by GitHub
parent 89c9cf1352
commit a2c0693038
18 changed files with 313 additions and 62 deletions
@@ -1786,7 +1786,7 @@ impl DocumentMessageHandler {
pub fn deserialize_document(serialized_content: &str) -> Result<Self, EditorError> {
let document_message_handler = serde_json::from_str::<DocumentMessageHandler>(serialized_content)
.or_else(|e| {
log::warn!("failed to directly load document with the following error: {e}. Trying old DocumentMessageHandler");
log::warn!("Failed to directly load document with the following error: {e}. Trying old DocumentMessageHandler.");
// TODO: Eventually remove this document upgrade code
#[derive(Debug, serde::Serialize, serde::Deserialize)]
pub struct OldDocumentMessageHandler {
@@ -16,7 +16,13 @@ pub enum EditorError {
#[error("The operation caused a document error:\n{0:?}")]
Document(String),
#[error("This document was created in an older version of the editor.\n\nBackwards compatibility is, regrettably, not present in the current alpha release.\n\nTechnical details:\n{0:?}")]
#[error(
"This document was created in an older version of the editor.\n\
\n\
Full backwards compatibility is not guaranteed in the current alpha release.\n\
\n\
If this document is critical, ask for support in Graphite's Discord community."
)]
DocumentDeserialization(String),
#[error("{0}")]
@@ -568,7 +568,7 @@ impl NodeNetworkInterface {
let skip_footprint = 1;
let Some(input_type) = std::iter::once(node_types.call_argument.clone()).chain(node_types.inputs.clone()).nth(input_index + skip_footprint) else {
log::error!("Could not get type for {node_id_path:?}, input: {input_index}");
// log::warn!("Could not get type for {node_id_path:?}, input: {input_index}");
return (concrete!(()), TypeSource::Error("could not get the protonode's input"));
};
@@ -2629,7 +2629,7 @@ impl NodeNetworkInterface {
InputConnector::Node { node_id, input_index } => {
let Some(node_metadata) = self.node_metadata_mut(node_id, network_path) else { return };
let Some(input_metadata) = node_metadata.persistent_metadata.input_metadata.get_mut(*input_index) else {
log::error!("Node metadata must exist on node: {input:?}");
// log::warn!("Node metadata must exist on node: {input:?}");
return;
};
let wire_update = WirePathUpdate {
@@ -2721,7 +2721,7 @@ impl NodeNetworkInterface {
return;
};
let Some(input_metadata) = node_metadata.persistent_metadata.input_metadata.get_mut(*input_index) else {
log::error!("Node metadata must exist on node: {input:?}");
// log::warn!("Node metadata must exist on node: {input:?}");
return;
};
input_metadata.transient_metadata.wire = TransientMetadata::Unloaded;