Skip to content

chore(deps): update rust crate toml to 0.9#16

Open
tomerqodo wants to merge 4 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base_choredeps_update_rust_crate_toml_to_09_pr174from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head_choredeps_update_rust_crate_toml_to_09_pr174
Open

chore(deps): update rust crate toml to 0.9#16
tomerqodo wants to merge 4 commits intocoderabbit_combined_20260121_augment_sentry_coderabbit_1_base_choredeps_update_rust_crate_toml_to_09_pr174from
coderabbit_combined_20260121_augment_sentry_coderabbit_1_head_choredeps_update_rust_crate_toml_to_09_pr174

Conversation

@tomerqodo
Copy link
Copy Markdown

@tomerqodo tomerqodo commented Jan 22, 2026

Benchmark PR from qodo-benchmark#174

Summary by CodeRabbit

  • New Features

    • Added Flatpak as a supported application bundle target, enabling packaging and distribution through Flatpak.
  • Chores

    • Updated package dependencies to latest stable versions.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 22, 2026

Walkthrough

Dependency versions are bumped across multiple Tauri crates: toml from 0.8 to 0.9, and toml_edit from 0.22 to 0.23. A new Flatpak bundle type variant is added to the configuration. TOML parsing error handling is modified to adapt to the updated toml crate's error interface.

Changes

Cohort / File(s) Summary
Dependency version upgrades
crates/tauri-build/Cargo.toml, crates/tauri-cli/Cargo.toml, crates/tauri-plugin/Cargo.toml, crates/tauri-utils/Cargo.toml
Bump toml crate from 0.8 to 0.9 across all four files; additionally bump toml_edit from 0.22 to 0.23 in tauri-cli, and extend tauri-utils features with "schema", "config-json5", and "config-toml"
Bundle configuration
crates/tauri-utils/src/config.rs
Add new Flatpak variant to BundleType enum; update BundleType::all(), Display, and Deserialize implementations to support the variant
Error handling adaptation
crates/tauri-utils/src/config/parse.rs
Modify do_parse_toml to map TOML parsing errors to ConfigError::FormatJson and wrap via serde_json::Error::custom() to accommodate toml 0.9 error type changes

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 Four crates hop with new dependencies,
Flatpak joins the bundle party,
Error handling takes a JSON detour,
Version 0.9 opens the door!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: upgrading the toml crate dependency to version 0.9 across multiple Cargo.toml files and related code updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@crates/tauri-utils/src/config.rs`:
- Line 180: The Display implementation for the bundle enum returns "Flatpak"
while all other variants use lowercase; update the match arm for Self::Flatpak
in the Display impl (in config.rs) to return "flatpak" to match the casing of
other variants (e.g., "deb", "rpm", "appimage") so Display output is consistent
for case-sensitive comparisons and serialization round-trips.

In `@crates/tauri-utils/src/config/parse.rs`:
- Around line 385-391: The TOML parser in do_parse_toml is mapping
toml::from_str errors to ConfigError::FormatJson, producing misleading "JSON"
errors; change the error mapping to use ConfigError::FormatToml instead so the
actual toml::de::Error is preserved (i.e., when ::toml::from_str(raw) fails
return ConfigError::FormatToml with path: path.into() and the toml error),
matching the existing ConfigError variant and the implementation in
config_v1::parse.rs.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4222f36 and d2c8c97.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • crates/tauri-build/Cargo.toml
  • crates/tauri-cli/Cargo.toml
  • crates/tauri-plugin/Cargo.toml
  • crates/tauri-utils/Cargo.toml
  • crates/tauri-utils/src/config.rs
  • crates/tauri-utils/src/config/parse.rs
🔇 Additional comments (5)
crates/tauri-plugin/Cargo.toml (1)

38-38: LGTM!

The optional toml dependency version bump is consistent with the workspace-wide update.

crates/tauri-utils/Cargo.toml (1)

37-37: LGTM!

The toml dependency version bump with the parse feature is consistent with the workspace-wide update.

crates/tauri-utils/src/config.rs (1)

147-148: New Flatpak bundle type addition looks good.

The implementation correctly adds the new variant to all() and handles case-insensitive deserialization.

crates/tauri-cli/Cargo.toml (1)

59-68: Dependency updates look correct.

The toml_edit 0.23 and toml 0.9 versions share underlying parsing infrastructure—the toml crate now uses toml_edit as its formatting-preserving parsing and display backend, with toml layering the serde-friendly Value API on top. The feature additions for tauri-utils (schema, config-json5, config-toml) align with extending config parsing capabilities.

crates/tauri-build/Cargo.toml (1)

46-46: Dependency version bump looks good.

The toml crate update from 0.8 to 0.9 aligns with the PR objective. cargo_toml 0.22 (used in this crate) is compatible with toml 0.9, and since the code uses the cargo_toml wrapper API rather than direct toml calls, no code changes are needed.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Self::Nsis => "nsis",
Self::App => "app",
Self::Dmg => "dmg",
Self::Flatpak => "Flatpak",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Inconsistent casing in Display implementation.

All other bundle types use lowercase in their Display output ("deb", "rpm", "appimage", etc.), but Flatpak uses title case. This inconsistency could cause issues if the Display output is used for case-sensitive comparisons or serialization round-trips.

Proposed fix for consistency
-        Self::Flatpak => "Flatpak",
+        Self::Flatpak => "flatpak",
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Self::Flatpak => "Flatpak",
Self::Flatpak => "flatpak",
🤖 Prompt for AI Agents
In `@crates/tauri-utils/src/config.rs` at line 180, The Display implementation for
the bundle enum returns "Flatpak" while all other variants use lowercase; update
the match arm for Self::Flatpak in the Display impl (in config.rs) to return
"flatpak" to match the casing of other variants (e.g., "deb", "rpm", "appimage")
so Display output is consistent for case-sensitive comparisons and serialization
round-trips.

Comment on lines 385 to 391
fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
// Parse using toml 0.9's from_str which returns different error types
::toml::from_str(raw).map_err(|error| ConfigError::FormatJson {
path: path.into(),
error: Box::new(error),
error: serde_json::Error::custom(error.to_string()),
})
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

cd crates/tauri-utils/src/config && head -120 parse.rs | tail -40

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 1333


🏁 Script executed:

cd crates/tauri-utils/src/config && sed -n '80,115p' parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 1106


🏁 Script executed:

cd crates/tauri-utils/src && find . -name "*.rs" -exec grep -l "ConfigError" {} \; | head -5

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 122


🏁 Script executed:

cd crates/tauri-utils/src && grep -n "enum ConfigError" -A 30 config.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 66


🏁 Script executed:

cd crates/tauri-utils/src/config && sed -n '385,395p' parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 625


🏁 Script executed:

cd crates/tauri-utils/src/config && sed -n '1,20p' parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 778


🏁 Script executed:

cd crates/tauri-utils/src/config && grep -n "do_parse_toml" -B 5 -A 8 parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 1068


🏁 Script executed:

cd crates/tauri-utils/src/config && grep -n "FormatToml" parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 102


🏁 Script executed:

cd crates/tauri-utils && grep -r "ConfigError::FormatToml" --include="*.rs"

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 172


🏁 Script executed:

cd crates/tauri-utils/src/config_v1 && head -5 parse.rs && echo "---" && grep -n "do_parse_toml" -B 5 -A 8 parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 1195


🏁 Script executed:

cd crates/tauri-utils/src && ls -la config*/

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 513


🏁 Script executed:

cd crates/tauri-utils/src/config && git log --oneline -10 parse.rs 2>/dev/null || echo "Not a git repo or file not tracked"

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 102


🏁 Script executed:

cd crates/tauri-utils && grep -n "toml" Cargo.toml

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 155


🏁 Script executed:

cd crates/tauri-utils/src/config && grep -n "use.*toml" parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 66


🏁 Script executed:

cd crates/tauri-utils/src/config && sed -n '103,115p' parse.rs

Repository: qodo-benchmark/tauri-combined-coderabbit

Length of output: 484


TOML parse errors are incorrectly reported as JSON errors.

The do_parse_toml function maps TOML parsing failures to ConfigError::FormatJson, which displays misleading error messages to users like "unable to parse JSON Tauri config file" when they have syntax errors in their tauri.toml file.

The existing ConfigError::FormatToml variant is properly defined with type Box<::toml::de::Error> and should be used instead. Update the function to:

fn do_parse_toml<D: DeserializeOwned>(raw: &str, path: &Path) -> Result<D, ConfigError> {
  ::toml::from_str(raw).map_err(|error| ConfigError::FormatToml {
    path: path.into(),
    error,
  })
}

This matches the correct implementation in config_v1/parse.rs and preserves error fidelity.

🤖 Prompt for AI Agents
In `@crates/tauri-utils/src/config/parse.rs` around lines 385 - 391, The TOML
parser in do_parse_toml is mapping toml::from_str errors to
ConfigError::FormatJson, producing misleading "JSON" errors; change the error
mapping to use ConfigError::FormatToml instead so the actual toml::de::Error is
preserved (i.e., when ::toml::from_str(raw) fails return ConfigError::FormatToml
with path: path.into() and the toml error), matching the existing ConfigError
variant and the implementation in config_v1::parse.rs.

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