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

An answer can be undeleted while the question it belongs to is still deleted #7489

Open
tripleee opened this issue Jan 20, 2023 · 2 comments
Labels
status: confirmed Confirmed as something that needs working on.

Comments

@tripleee
Copy link
Member

What problem has occurred? What issues has it caused?

Transcript here. At the very least, it should be more obvious what's going wrong. Probably add a try/except and an error message for this corner case, even though it's arguably esoteric.

What would you like to happen/not happen?

Smokey should be prepared for the parent link from the API to be missing, or whatever exactly it is that is failing here.

Analyzing the behavior probably requires mod privileges in practice, or at the very least helpful coordination with a mod who is prepared to recreate the conditions to repro.

@makyen
Copy link
Contributor

makyen commented Jan 20, 2023

This is something that's happened a few times previously (the error is recognizable and consistent). Our current scanning process requires that if an answer is reported to SD, then the question also needs to be available via the SE API. In other words, to report a deleted answer, the question needs to also be undeleted. I'm unsure if it's worthwhile to rework things in order to remove that requirement. I haven't looked for what all the existing dependencies are, but removing the need for the question would, potentially, limit future detections.

On the other hand, it would be reasonable for SD to recognize that the question being currently deleted is likely the problem and for SD to suggest that the person reporting the answer should check to verify that the question is also undeleted. SD doesn't have a way to know that's the actual issue, because the SE API doesn't provide data about deleted posts, not even an explicit indicator that the post is deleted.

The typical indication from the SE API that a post is deleted is merely that no data is returned when requesting data for the post, so we would generally be making a guess (but a good guess) that the issue was that the question was deleted while the answer was undeleted.

Side note: it is, in fact, possible to determine that the post is deleted, rather than non-existent, based on there being available flagging options for the post in order to raise an "in need of moderator intervention" flag, but to be able to get the flagging options requires an access_token, which we don't use for SmokeDetector.

@codygray
Copy link
Member

codygray commented Jan 27, 2023

[…] to report a deleted answer, the question needs to also be undeleted. I'm unsure if it's worthwhile to rework things in order to remove that requirement.

This is a completely reasonable requirement. Even if it is possible to remove this requirement for this specific edge case, I don't think it is worth the development time to do so.

The main purpose of this bug report is to improve the error message that gets displayed in such cases, with the hope of cluing the reporting moderator in to the actual problem.

[…] the error is recognizable and consistent […]

Only if you have already seen and investigated it before. Otherwise, it's completely opaque and non-recognizable.

If you report a post that's been deleted, as I did here, you get back the error message:

Post 1: Could not find data for this post in the API. It may already have been deleted.

That's the same error that I would expect to get when I report an answer associated with a deleted question.

Instead, I get:

I hit an error while trying to run that command; run !!/errorlogs for details.

and when running !!/errorlogs, I see:

### AttributeError on teward/Thoth at 2023-01-20T06:00:25Z: 'bool' object has no attribute 'as_dict'
File "/home/smokey/SmokeDetector/chatcommunicate.py", line 528, in __call__
result = self.__func__(*processed_args, alias_used=alias_used)
File "/home/smokey/SmokeDetector/chatcommands.py", line 2098, in report
output = report_posts(urls, msg.owner, msg.room.name, message_url, alias_used, custom_reason)
File "/home/smokey/SmokeDetector/chatcommands.py", line 2323, in report_posts
post._parent = Post(api_response=parent_data.as_dict)

### AttributeError on teward/Thoth at 2023-01-20T05:59:49Z: 'bool' object has no attribute 'as_dict'
File "/home/smokey/SmokeDetector/chatcommunicate.py", line 528, in __call__
result = self.__func__(*processed_args, alias_used=alias_used)
File "/home/smokey/SmokeDetector/chatcommands.py", line 2098, in report
output = report_posts(urls, msg.owner, msg.room.name, message_url, alias_used, custom_reason)
File "/home/smokey/SmokeDetector/chatcommands.py", line 2323, in report_posts
post._parent = Post(api_response=parent_data.as_dict)

It is not clear to me why the former can produce an easily-understood error message, while the latter produces an exceptional condition. This exceptional condition should not occur; it should be caught and displayed to the user as an error message. In other words, it is fine that the operation fails, but the operation should fail gracefully.

Although it might be both possible and desirable, it is not necessary to guess whether the root cause of the problem is the answer undeleted from a deleted question. It is sufficient to report that Smokey couldn't find data for the specified post using the SE API.

@stale stale bot added the status: stale label Jun 18, 2023
@Spevacus Spevacus added status: confirmed Confirmed as something that needs working on. and removed status: stale labels Aug 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: confirmed Confirmed as something that needs working on.
Development

No branches or pull requests

4 participants