fix: a few regressions from previous PRs - #49
Conversation
Review Summary by QodoFix regressions and rename window features method
WalkthroughsDescription• Fix cookie deletion using wrong message type • Rename with_window_features to window_features for consistency • Fix window features application order and spacing • Update example code to use new method names • Remove unused imports and reorganize conditional compilation Diagramflowchart LR
A["Bug Fixes"] --> B["Cookie deletion message"]
A --> C["Method rename"]
A --> D["Code organization"]
B --> E["SetCookie instead of DeleteCookie"]
C --> F["with_window_features to window_features"]
D --> G["Remove unused imports"]
D --> H["Reorganize conditional blocks"]
File Changes1. crates/tauri-runtime-wry/src/lib.rs
|
Code Review by Qodo
1. window_features spacing unformatted
|
| if let Some(size) = features.size() { | ||
| self.window_builder = self.window_builder.inner_size(size.width, size.height); | ||
| } | ||
|
|
||
| if let Some(size) = features.size() { | ||
| self.window_builder = self.window_builder.inner_size(size.width, size.height); | ||
| if let Some(position) = features.position() { | ||
| self.window_builder = self.window_builder.position(position.x,position.y); | ||
| } |
There was a problem hiding this comment.
1. window_features spacing unformatted 📘 Rule violation ✓ Correctness
The new window_features implementation contains non-rustfmt spacing (extra spaces and missing spaces after commas), indicating cargo fmt --check would modify the file. This violates the requirement that Rust code conforms to the project rustfmt configuration.
Agent Prompt
## Issue description
The newly added `window_features` code has spacing that is not compliant with rustfmt (extra spaces and missing spaces after commas), so `cargo fmt --check` would likely fail.
## Issue Context
Project compliance requires all Rust code to pass `cargo fmt --all -- --check`.
## Fix Focus Areas
- crates/tauri/src/webview/webview_window.rs[1316-1322]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| // Remove this re-export in v3 | ||
| pub use tauri_runtime::Cookie; |
There was a problem hiding this comment.
2. cookie re-export undocumented 📘 Rule violation ✧ Quality
A new public re-export pub use tauri_runtime::Cookie; was added without a /// documentation comment. This violates the requirement that public API items include documentation comments.
Agent Prompt
## Issue description
A new public re-export (`pub use tauri_runtime::Cookie;`) was introduced without a Rust doc comment (`///`), which violates the requirement that public APIs are documented.
## Issue Context
This is part of the public `tauri::webview` module surface; it should be documented similarly to other public exports.
## Fix Focus Areas
- crates/tauri/src/webview/mod.rs[22-23]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| tauri::WebviewUrl::External("about:blank".parse().unwrap()), | ||
| ) | ||
| .window_features(features) | ||
| .on_document_title_changed(|window, title| { | ||
| window.set_title(&title).unwrap(); | ||
| }) | ||
| .title(url.as_str()); | ||
|
|
||
| let window = builder.build().unwrap(); | ||
| tauri::webview::NewWindowResponse::Create { window } |
There was a problem hiding this comment.
3. on_new_window uses unwrap() 📘 Rule violation ⛯ Reliability
The updated example code uses unwrap() on fallible operations (parse, set_title, and build), which can panic instead of surfacing errors. This conflicts with the guideline to return/propagate Result for fallible operations.
Agent Prompt
## Issue description
Example code added `unwrap()` on fallible operations (`parse`, `set_title`, `build`), which can panic and hides error conditions.
## Issue Context
Compliance requires fallible operations to return/propagate `Result` instead of panicking.
## Fix Focus Areas
- examples/api/src-tauri/src/lib.rs[92-101]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| Message::Webview( | ||
| *self.window_id.lock().unwrap(), | ||
| self.webview_id, | ||
| WebviewMessage::DeleteCookie(cookie.clone().into_owned()), | ||
| WebviewMessage::SetCookie(cookie.into_owned()), | ||
| ), |
There was a problem hiding this comment.
4. Delete_cookie sends setcookie 🐞 Bug ✓ Correctness
WryWebviewDispatcher::delete_cookie dispatches WebviewMessage::SetCookie instead of WebviewMessage::DeleteCookie, so Webview::delete_cookie will not delete cookies and may re-set them instead.
Agent Prompt
### Issue description
`WryWebviewDispatcher::delete_cookie` currently sends `WebviewMessage::SetCookie`, which routes to `webview.set_cookie` instead of `webview.delete_cookie`. This breaks the cookie deletion API.
### Issue Context
The runtime event loop matches on `WebviewMessage::SetCookie` vs `WebviewMessage::DeleteCookie` and performs different operations.
### Fix Focus Areas
- crates/tauri-runtime-wry/src/lib.rs[1712-1721]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| pub fn window_features(mut self, features: NewWindowFeatures) -> Self { | ||
| if let Some(size) = features.size() { | ||
| self.window_builder = self.window_builder.inner_size(size.width, size.height); | ||
| } | ||
|
|
||
| if let Some(size) = features.size() { | ||
| self.window_builder = self.window_builder.inner_size(size.width, size.height); | ||
| if let Some(position) = features.position() { | ||
| self.window_builder = self.window_builder.position(position.x,position.y); | ||
| } |
There was a problem hiding this comment.
5. Removed window_features alias 🐞 Bug ✓ Correctness
The public WebviewWindowBuilder::with_window_features method was removed and replaced with window_features without a deprecated alias, so any downstream code still calling with_window_features will fail to compile against this v2.7.0 API.
Agent Prompt
### Issue description
`WebviewWindowBuilder::with_window_features` was renamed to `window_features` without keeping the old method as a deprecated alias. In the v2.x series (currently 2.7.0), removing a public method is a breaking change and will cause downstream compilation failures.
### Issue Context
The builder is part of the public API and examples/docs now call `window_features`, but existing external code may still call `with_window_features`.
### Fix Focus Areas
- crates/tauri/src/webview/webview_window.rs[1304-1351]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
Benchmark PR from agentic-review-benchmarks#10