Skip to content

Improve fix for corrupted font resource loading in older documents - #4482

Merged
timon-schelling merged 6 commits into
masterfrom
improve-resource-fixes
Aug 29, 2026
Merged

Improve fix for corrupted font resource loading in older documents#4482
timon-schelling merged 6 commits into
masterfrom
improve-resource-fixes

Conversation

@timon-schelling

Copy link
Copy Markdown
Member

improvements of 404d9f3

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

2 issues found across 5 files

Confidence score: 2/5

  • node-graph/nodes/gstd/src/platform_application_io.rs now panics when platform application IO or resource data is missing, turning an expected missing-resource case into a user-facing crash—restore the graceful empty-Resource fallback.
  • node-graph/graph-craft/src/application_io/resource/opfs.rs retains the on_disk marker after a background OPFS write fails, so later store calls skip retries and the resource can be lost after reload—clear the marker or schedule a retry.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="node-graph/graph-craft/src/application_io/resource/opfs.rs">

<violation number="1" location="node-graph/graph-craft/src/application_io/resource/opfs.rs:158">
P2: When a newly stored hash's background OPFS write fails, retaining `on_disk` prevents later `store` calls from retrying it, leaving the resource only in `cache` and risking its loss after reload. Clear the marker or schedule a retry when the write fails.</violation>
</file>

<file name="node-graph/nodes/gstd/src/platform_application_io.rs">

<violation number="1" location="node-graph/nodes/gstd/src/platform_application_io.rs:273">
P1: The `resource` node now panics when the platform application IO is absent or a resource's data is missing, instead of returning the previous graceful empty-`Resource` fallback. A missing resource is exactly the case this PR targets (older documents with corrupted/evicted font data), and on the WASM target a `panic!` aborts the whole application rather than degrading the single resource. Restore graceful handling: log the error and return `Resource::empty()` as before.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

};

let application_io = editor_api.into_element().application_io.as_ref().expect("ApplicationIo must be available when using resources");
let resource = application_io.load_resource(hash).await.unwrap_or_else(|| panic!("Resource {hash} not found"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1: The resource node now panics when the platform application IO is absent or a resource's data is missing, instead of returning the previous graceful empty-Resource fallback. A missing resource is exactly the case this PR targets (older documents with corrupted/evicted font data), and on the WASM target a panic! aborts the whole application rather than degrading the single resource. Restore graceful handling: log the error and return Resource::empty() as before.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At node-graph/nodes/gstd/src/platform_application_io.rs, line 273:

<comment>The `resource` node now panics when the platform application IO is absent or a resource's data is missing, instead of returning the previous graceful empty-`Resource` fallback. A missing resource is exactly the case this PR targets (older documents with corrupted/evicted font data), and on the WASM target a `panic!` aborts the whole application rather than degrading the single resource. Restore graceful handling: log the error and return `Resource::empty()` as before.</comment>

<file context>
@@ -269,19 +269,8 @@ pub async fn resource<'a: 'n>(
-	};
-
+	let application_io = editor_api.into_element().application_io.as_ref().expect("ApplicationIo must be available when using resources");
+	let resource = application_io.load_resource(hash).await.unwrap_or_else(|| panic!("Resource {hash} not found"));
 	Item::new_from_element(resource)
 }
</file context>

Comment thread node-graph/graph-craft/src/application_io/resource/opfs.rs
@timon-schelling
timon-schelling merged commit d5bb887 into master Aug 29, 2026
11 checks passed
@timon-schelling
timon-schelling deleted the improve-resource-fixes branch August 29, 2026 00:01
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