Port website dev docs generated content scripts from JS to Rust to avoid intermediate formats#3909
Port website dev docs generated content scripts from JS to Rust to avoid intermediate formats#3909
Conversation
Summary of ChangesHello, 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! This pull request significantly refactors the website's documentation generation process by migrating key build scripts from JavaScript to Rust. This change aims to improve efficiency and simplify the build pipeline by allowing the Rust tools to directly produce the final output formats (SVG, HTML, and plain text), thereby removing the need for intermediate files and reducing the project's reliance on Node.js for these specific tasks. Highlights
Changelog
Ignored Files
Using Gemini Code AssistThe 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 by creating a comment using either
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 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
|
There was a problem hiding this comment.
Code Review
This pull request is a great improvement, porting two JavaScript build scripts to Rust. This change simplifies the build process by removing intermediate file formats and generating the final SVG and HTML files directly. The new Rust code is well-structured, but I've identified a few areas for improvement regarding panic safety, code duplication, and idiomatic Rust for string and I/O operations.
| } | ||
| } | ||
|
|
||
| fn write_tree_html(tree: &DebugMessageTree, out: &mut String) { |
There was a problem hiding this comment.
The HTML generation functions (write_tree_html, write_tree_html_children, etc.) build a String using multiple push_str calls. A more idiomatic and potentially more efficient approach is to use a type that implements std::fmt::Write along with the write!/writeln! macros. This would also make the functions more generic and robust. You could change their signatures to return a std::fmt::Result and write to a &mut impl std::fmt::Write.
| } | ||
| } | ||
|
|
||
| const FRONTEND_MESSAGE_STR: &str = "FrontendMessage"; |
There was a problem hiding this comment.
3 issues found across 10 files
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="tools/crate-hierarchy-viz/src/main.rs">
<violation number="1" location="tools/crate-hierarchy-viz/src/main.rs:195">
P2: Check for the actual `@viz-js/viz` package directory here, not just the `@viz-js` scope folder, or this can skip installation and fail at runtime.</violation>
</file>
<file name="tools/editor-message-tree/src/main.rs">
<violation number="1" location="tools/editor-message-tree/src/main.rs:32">
P2: Propagate `write_all` errors instead of discarding them, or this generator can succeed after producing a partial `.txt` file.</violation>
</file>
<file name=".github/workflows/website.yml">
<violation number="1" location=".github/workflows/website.yml:68">
P2: This generator now writes the downloadable `.txt` file under `website/static`, but the workflow only caches/restores `website/generated`. On cache hits the step is skipped, so the linked `hierarchical-message-system-tree.txt` will be missing from the built site.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
dfdc512 to
179937e
Compare
No description provided.