Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update winit to 0.30 #150

Merged
merged 4 commits into from
Aug 14, 2024
Merged

chore: update winit to 0.30 #150

merged 4 commits into from
Aug 14, 2024

Conversation

wusyong
Copy link
Member

@wusyong wusyong commented Aug 14, 2024

No description provided.

@wusyong wusyong requested review from pewsheen and dklassic August 14, 2024 06:14
Copy link
Collaborator

@pewsheen pewsheen left a comment

Choose a reason for hiding this comment

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

Is it a known issue that it crashes when closing a window on macOS?

[2024-08-14T09:11:43Z ERROR winit::platform_impl::macos::event_handler] tried to run event handler, but no handler was set

src/main.rs Outdated Show resolved Hide resolved
@wusyong
Copy link
Member Author

wusyong commented Aug 14, 2024

Is it a known issue that it crashes when closing a window on macOS?

[2024-08-14T09:11:43Z ERROR winit::platform_impl::macos::event_handler] tried to run event handler, but no handler was set

This is caused by surfman issue I think which is merged this week. I'll update the dep in follow up PR.

@wusyong wusyong requested a review from pewsheen August 14, 2024 10:09
@wusyong wusyong enabled auto-merge August 14, 2024 10:13
@wusyong wusyong added this pull request to the merge queue Aug 14, 2024
@rohankokkulabito
Copy link

rohankokkulabito commented Aug 14, 2024

Code Review Agent Run #90ad3f

  • AI Based Review: ✔️ Successful
  • Static Analysis: ✔️ Successful

High-level Feedback

Ensure that all dependencies are specified with exact versions to avoid compatibility issues. Replace 'expect' with proper error handling to prevent ungraceful crashes. Introduce error handling for operations within 'handle_winit_window_event' to manage potential errors gracefully. Ensure consistency between Cargo.toml and Cargo.lock to avoid dependency management issues.

Actionable Issues

📄 src/window.rs
Issues: Total - 1, High importance - 1
Line 100-100 🔴 High importance - 1   
📄 Cargo.lock
Issues: Total - 2, High importance - 2
Line 1336-1341 🔴 High importance - 1   
Line 3785-3785 🔴 High importance - 1   
📄 src/verso.rs
Issues: Total - 1, High importance - 1
Line 394-394 🔴 High importance - 1   

AI Code Review powered by Bito Logo

@rohankokkulabito
Copy link

rohankokkulabito commented Aug 14, 2024

Heya @wusyong & @pewsheen ,
Sorry to jump into your conversation, but I’ve got a little favor to ask! 😄

I’m Rohan, the Developer Community Manager at Bito. I’d like to run our AI Code Review Agent on your PRs. Think of it as letting AI take the “first pass” on your code reviews—covering security, performance, scalability, and optimization.

You don’t need to do anything for this initial setup. I’ll handle running the Agent and will share any potential fixes and suggestions it comes up with.

Later on, if you’re up for it, you can try it on your other PRs as well. I see that you have many PRs getting merged recently and having another set of eyes for the review would be very beneficial!

Looking forward to seeing what the Agent can uncover and hoping it helps make your code even better.

compositor: &mut IOCompositor,
) -> Self {
let window = WindowBuilder::new()
pub fn new_with_compositor(evl: &ActiveEventLoop, compositor: &mut IOCompositor) -> Self {

Choose a reason for hiding this comment

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

Bito Code Review Agent Run #90ad3f - 08/14/2024, 10:29 am

🔴 High importance
Issue: Using 'expect' for error handling can cause the program to panic if the window creation or handle retrieval fails. This is not ideal for production code as it can lead to ungraceful crashes. A similar issue was also found in src/window.rs (line 403).
Fix: Replace 'expect' with proper error handling to ensure the program does not panic and can handle errors gracefully.
Code suggestion
 @@ -105,7 +105,13 @@
          .expect("Failed to create window.");
 
      let rwh = window.window_handle().expect("Failed to get window handle");
 +    if rwh.is_err() {
 +        log::error!("Failed to get window handle: {:?}", rwh.err());
 +        return Err("Failed to get window handle");
 +    }
 +    let rwh = rwh.unwrap();

Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

Comment on lines +1336 to +1341
[[package]]
name = "dpi"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f25c0e292a7ca6d6498557ff1df68f32c99850012b6ea401cf8daf771f22ff53"

Choose a reason for hiding this comment

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

Bito Code Review Agent Run #90ad3f - 08/14/2024, 10:29 am

🔴 High importance
Issue: The addition of the "dpi" package in the Cargo.lock file without corresponding changes in the Cargo.toml file can lead to inconsistencies. The Cargo.lock file should be generated by Cargo based on the dependencies specified in Cargo.toml.
Fix: Ensure that the "dpi" package is added to the Cargo.toml file as a dependency. This will allow Cargo to manage the Cargo.lock file correctly.
Code suggestion
 @@ -20,6 +20,7 @@
  [dependencies]
  dom_struct = "0.0.1"
  domobject_derive = "0.0.1"
  downcast-rs = "1.2.1"
 +dpi = "0.1.1"
  dtoa = "1.0.9"
  dtoa-short = "0.3.5"
  dwrote = "0.11.0"

Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

@@ -3784,17 +3782,23 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
dependencies = [
"block2 0.5.1",
"objc2 0.5.2",
"block2",

Choose a reason for hiding this comment

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

Bito Code Review Agent Run #90ad3f - 08/14/2024, 10:29 am

🔴 High importance
Issue: Removing specific versions for dependencies can lead to potential issues if the latest versions introduce breaking changes. This can cause unexpected behavior or compatibility issues in the project. Similar issues were also found in: - Cargo.lock (line 6182) - Cargo.lock (line 3816)
Fix: Specify the exact versions of the dependencies "block2" and "objc2" to ensure compatibility and stability of the project.
Code suggestion
 @@ -3785,2 +3785,2 @@ dependencies = [
 - "block2",
 - "objc2",
 + "block2 0.5.1",
 + "objc2 0.5.2",

Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

/// Handle Winit events
fn handle_winit_event(&mut self, event: Event<()>) {
/// Handle Winit window events
pub fn handle_winit_window_event(&mut self, window_id: WindowId, event: WindowEvent) {

Choose a reason for hiding this comment

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

Bito Code Review Agent Run #90ad3f - 08/14/2024, 10:29 am

🔴 High importance
Issue: The function 'handle_winit_window_event' does not handle potential errors that might occur during the event handling process. For example, if 'compositor.maybe_start_shutting_down()' or 'window.handle_winit_window_event' fails, the function does not have a mechanism to handle these errors gracefully.
Fix: Introduce error handling for the operations within 'handle_winit_window_event'. Use 'Result' and 'match' to handle potential errors gracefully.
Code suggestion
 @@ -396,22 +396,22 @@
         if let WindowEvent::CloseRequested = event {
             // self.windows remove(&window_id);
             if let Err(e) = compositor.maybe_start_shutting_down() {
                 log::error!("Failed to start shutting down: {:?}", e);
             }
         } else {
             let mut need_repaint = false;
             for (id, window) in &mut self.windows {
                 if window_id == *id {
                     match window.handle_winit_window_event(
                         &self.constellation_sender,
                         compositor,
                         &event,
                     ) {
                         Ok(repaint) => need_repaint = repaint,
                         Err(e) => log::error!("Failed to handle window event: {:?}", e),
                     }
                 }
             }
             if need_repaint {
                 if let Err(e) = compositor.repaint_synchronously(&mut self.windows) {
                     log::error!("Failed to repaint synchronously: {:?}", e);
                 }
             }
         }

Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged

@rohankokkulabito
Copy link

Based on the above Code Suggestions, I can't wait to hear what you think?!
We will help you set up this tool in your workflow, and yes it will be free for open-source projects like yours.

Merged via the queue into main with commit faaadb2 Aug 14, 2024
6 checks passed
@wusyong wusyong deleted the winit branch August 14, 2024 11:00
@denjell-crabnebula
Copy link
Member

Hey there @rohankokkulabito - while your HUMAN interest is gratifying, AI tooling such as the one you represent is not appropriate for this organization or repo at its current stage of very early development, and it is very unlikely that we would ever adopt such a distraction.

As someone who has been involved in many open source projects, a better approach would have been to file an issue and gauge the response from the team before letting loose your LLM that tries to AI-SPLAIN us how to modify Cargo.lock

@tensor-programming
Copy link
Member

tensor-programming commented Aug 14, 2024

Is this thing going to eventually suggest that we start using the chromium engine instead of servo? I get that feeling... Say Hi to Devan for us...

@rohankokkulabito
Copy link

I appreciate the thoughtful feedback @denjell-crabnebula! 😅

You share a good idea about filing an issue first vs. plowing into an open PR. I'm new to open source and so is Bito's AI code reviewer, so I'm experimenting in (hopefully) non-invasive "human" ways to contribute, while letting our robot pal's work try to speak for itself.

Have you seen a tool like Bito's insert itself in a healthy, helpful way to an open source community before? Maybe I could learn from it. THANK YOU! 🙏

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.

5 participants