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

make "report on git" link clickable and auto fill bug report #3557

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

wagyourtail
Copy link
Collaborator

@wagyourtail wagyourtail commented Jul 12, 2022

@ZacSharp I did it

closes #3527

todo:

  • a method to resolve duplicates (attempt detect and compare stacktraces from same titled ones and comment instead?)
  • maybe get baritone to log error when non-command exceptions occur

@ZacSharp
Copy link
Collaborator

Searching by issue title and then locating the stacktrace sounds like a simple and workable solution. Users changing the title or stacktrace are hopefully rare and to deal with obfuscation regex should be powerful enough to use it to normalize the names.
Applying this to other exceptions sounds good, but if you are thinking about some toplevel thing there's probably a couple gotchas because there's a wider variety of things being caught.

@leijurv
Copy link
Member

leijurv commented Oct 3, 2022

is this even a good idea though?? wont this cause untold issue spam

@ZacSharp
Copy link
Collaborator

ZacSharp commented Oct 4, 2022

If you merge it as is, definitely. However I do think that automated deduplication is enough to stop the spam.
(Problem is just the deduplication. So far I've failed to find a way to read the "Marked as duplicated of..." events via API)

@ZacSharp
Copy link
Collaborator

Finding the direct duplicates seems to be reasonably easy. We just need to compress the relevant data into a search term and can then retrieve all duplicates in a single api request.
If we want to direct users to the original issue (in case the direct duplicate is itself a duplicate) however, that's more difficult. Theoretically GitHub has these nice "User marked this as a duplicate of #issue" issue events and an api to read issue events, but that api doesn't expose the id of the mentioned issue. As we probably don't want to try and guess which comment caused the event and as we probably also don't want to manually maintain the required data e.g. in a data repo, the only viable option I see is not telling the user which specific issue they just reproduced. That's basically the current situation but they are told to not report it. (An unhandled exception occurred. This has already been reported at https://github.com/cabaletta/baritone/issues).

To find the direct duplicate we could simply hash the complete stacktrace, but this will likely be overly specific in most cases, like with

this stacktrace
baritone.api.command.exception.CommandUnhandledException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at baritone.command.manager.CommandManager$ExecutionWrapper.execute(CommandManager.java:143)
	at baritone.command.manager.CommandManager$ExecutionWrapper.access$000(CommandManager.java:127)
	at baritone.command.manager.CommandManager.execute(CommandManager.java:83)
	at baritone.command.ExampleBaritoneControl.runCommand(ExampleBaritoneControl.java:146)
	at baritone.command.ExampleBaritoneControl.onSendChatMessage(ExampleBaritoneControl.java:71)
	at baritone.event.GameEventHandler.lambda$onSendChatMessage$2(GameEventHandler.java:69)
	at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:895)
	at baritone.event.GameEventHandler.onSendChatMessage(GameEventHandler.java:69)
	at net.minecraft.client.entity.EntityPlayerSP.handler$sendChatMessage$zze000(EntityPlayerSP.java:1416)
	at net.minecraft.client.entity.EntityPlayerSP.sendChatMessage(EntityPlayerSP.java)
	at net.minecraft.client.gui.GuiScreen.sendChatMessage(GuiScreen.java:456)
	at net.minecraft.client.gui.GuiScreen.sendChatMessage(GuiScreen.java:446)
	at net.minecraft.client.gui.GuiChat.keyTyped(GuiChat.java:126)
	at net.minecraft.client.gui.GuiScreen.handleKeyboardInput(GuiScreen.java:607)
	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:556)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1852)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1165)
	at net.minecraft.client.Minecraft.run(Minecraft.java:439)
	at net.minecraft.client.main.Main.main(Main.java:115)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:25)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at baritone.command.defaults.GcCommand.execute(GcCommand.java:38)
	at baritone.command.manager.CommandManager$ExecutionWrapper.execute(CommandManager.java:140)
	... 30 more
and this stacktrace
baritone.api.command.exception.CommandUnhandledException: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at baritone.command.manager.CommandManager$ExecutionWrapper.execute(CommandManager.java:143)
	at baritone.command.manager.CommandManager$ExecutionWrapper.access$000(CommandManager.java:127)
	at baritone.command.manager.CommandManager.execute(CommandManager.java:83)
	at baritone.command.ExampleBaritoneControl.runCommand(ExampleBaritoneControl.java:146)
	at baritone.command.ExampleBaritoneControl.onSendChatMessage(ExampleBaritoneControl.java:74)
	at baritone.event.GameEventHandler.lambda$onSendChatMessage$2(GameEventHandler.java:69)
	at java.util.concurrent.CopyOnWriteArrayList.forEach(CopyOnWriteArrayList.java:895)
	at baritone.event.GameEventHandler.onSendChatMessage(GameEventHandler.java:69)
	at net.minecraft.client.entity.EntityPlayerSP.handler$sendChatMessage$zze000(EntityPlayerSP.java:1416)
	at net.minecraft.client.entity.EntityPlayerSP.sendChatMessage(EntityPlayerSP.java)
	at net.minecraft.client.gui.GuiScreen.sendChatMessage(GuiScreen.java:456)
	at net.minecraft.client.gui.GuiScreen.sendChatMessage(GuiScreen.java:446)
	at net.minecraft.client.gui.GuiChat.keyTyped(GuiChat.java:126)
	at net.minecraft.client.gui.GuiScreen.handleKeyboardInput(GuiScreen.java:607)
	at net.minecraft.client.gui.GuiScreen.handleInput(GuiScreen.java:556)
	at net.minecraft.client.Minecraft.runTick(Minecraft.java:1852)
	at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:1165)
	at net.minecraft.client.Minecraft.run(Minecraft.java:439)
	at net.minecraft.client.main.Main.main(Main.java:115)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97)
	at GradleStart.main(GradleStart.java:25)
Caused by: java.lang.ClassCastException: java.lang.Integer cannot be cast to java.lang.String
	at baritone.command.defaults.GcCommand.execute(GcCommand.java:38)
	at baritone.command.manager.CommandManager$ExecutionWrapper.execute(CommandManager.java:140)
	... 30 more
(the difference is the line number in line 6, determined by whether you use chat control or prefix control)

To overcome this I'd suggest processing only part of the stacktrace. No line numbers (they only exist in dev anyway) and e.g. no lines higher up the trace than where the exception was caught.
If we want something that works with old issues or preserves more information (e.g. in case we adjust the search strategy) we'd of course need to put more effort into finding a suitable identifier. However I think hashing (parts of) the stacktrace is simple enough to keep on doing it alongside a newer strategy and not finding old issues is what Baritone does already.
Also I think (no evidence) that the really annoying duplicates are precise duplicates, so even the full stacktrace might be general enough to catch them (unless e.g. people who used Baritone v1.8.2 on Mc 1.18.2 used as many launcher+modloader combos as there were reports for the "bug").

If you want me to do so I can contribute the code for the api requests (I've already written a proof of concept implementation for testing anyways).

@wagyourtail
Copy link
Collaborator Author

the issue of the different obfuscation stuff for baritone when comparing stack traces does come up tho...

@ZacSharp
Copy link
Collaborator

ZacSharp commented Oct 21, 2022

If you say that's too much of a problem (and deobfing Baritones names is too much or doesn't help) then I guess I'll have to give up automated duplicate finding as well because a powerful enough implementation is to much effort.

We should still change the message though to tell people to use the search function.
(and maybe provide a "and if you don't find anything click <here>" template link? I haven't given up that one yet)

@wagyourtail
Copy link
Collaborator Author

Maybe a related issues with a title comparison based search, and then a create new anyway button or something if that returns results and the user " manually confirms" that it's different

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.

Autogenerated issue bodies for command exceptions
3 participants