Skip to content

fix(wasm): utoopack unreachable and add tracing log#2124

Merged
xusd320 merged 1 commit intoutoo-wasmfrom
fix/wasm-pack-panic
Aug 15, 2025
Merged

fix(wasm): utoopack unreachable and add tracing log#2124
xusd320 merged 1 commit intoutoo-wasmfrom
fix/wasm-pack-panic

Conversation

@xusd320
Copy link
Copy Markdown
Contributor

@xusd320 xusd320 commented Aug 15, 2025

Summary

  • Fix pack config deserialize panic
  • Improve tracing log on wasm.

Test Plan

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @xusd320, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

The pull request addresses a critical deserialization panic in the pack configuration for WASM builds and significantly improves the tracing capabilities within the WASM module. It also updates dependencies and refactors the build process execution.

Highlights

  • WASM Configuration Refinement: The pack configuration handling in the WASM module has been enhanced to prevent deserialization panics. It now gracefully defaults to a production mode configuration if none is provided and correctly merges user-supplied configurations, ensuring robustness. The configuration file name has also been standardized from project_options.json to utoopack.json.
  • Enhanced Tracing and Logging: Tracing within the WASM module has been improved by updating the default tracing targets, enabling the logging of span close events, and setting the utoo_wasm module's log level to info for better visibility into the build process.
  • Build Process Execution Change: The asynchronous build task execution in the WASM environment has been switched from tokio::runtime::Runtime::spawn to tokio::runtime::Runtime::block_on, which might simplify the runtime management or address specific WASM threading/scheduling considerations.
  • Dependency and Workspace Updates: Key dependencies like opfs-project and tokio-fs-ext have been updated, and the tokio crate now includes the rt feature, indicating a more specific runtime requirement. Workspace dependency management for some crates has also been adjusted.
  • Demo Application Alignment: The utooweb-demo example has been updated to align with the new utoopack.json configuration file, improve the visual sorting of files in the tree view, enhance error reporting, and make minor UI adjustments for a better user experience.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces fixes for deserialization panics in the wasm pack configuration and enhances tracing logs for better debugging. The changes involve updating dependencies, refining the build process, and improving error handling. My review focuses on further improving code clarity and debuggability. I've suggested making an error message more descriptive and simplifying the construction of the tracing filter string for better maintainability.

Comment on lines +36 to 42
let mut trace = TRACING_OVERVIEW_TARGETS
.iter()
// .filter(|_| true)
.cloned()
.collect::<Vec<&str>>();
trace.push("utoo_wasm");
trace.extend(["utoo_wasm=info"]);
trace.join(",")
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.

medium

This block of code for building the filter string can be simplified for better readability and conciseness. Instead of creating a mutable vector and extending it, you can directly join the existing targets and append the new one.

Suggested change
let mut trace = TRACING_OVERVIEW_TARGETS
.iter()
// .filter(|_| true)
.cloned()
.collect::<Vec<&str>>();
trace.push("utoo_wasm");
trace.extend(["utoo_wasm=info"]);
trace.join(",")
let mut filter = TRACING_OVERVIEW_TARGETS.join(",");
filter.push_str(",utoo_wasm=info");
filter

std::result::Result::<RcStr, JsValue>::Ok(format!(r#"{{ "mode": {mode}}}"#).into()),
|config| {
let mut val = serde_json::value::Value::from_str(&config)
.map_err(|e| JsValue::from_str("Failed to parse pack config"))?;
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.

medium

The current error message Failed to parse pack config is not very descriptive and could make debugging difficult. It would be more helpful to include the underlying error from serde_json to provide more context on why the parsing failed.

Suggested change
.map_err(|e| JsValue::from_str("Failed to parse pack config"))?;
.map_err(|e| JsValue::from_str(&format!("Failed to parse pack config: {e}")))?;

@xusd320 xusd320 merged commit bd17cd5 into utoo-wasm Aug 15, 2025
7 checks passed
@xusd320 xusd320 deleted the fix/wasm-pack-panic branch August 15, 2025 09:34
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.

2 participants