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

Bot keeps updating finished contest #25

Open
jhsoby opened this issue Feb 13, 2025 · 6 comments
Open

Bot keeps updating finished contest #25

jhsoby opened this issue Feb 13, 2025 · 6 comments

Comments

@jhsoby
Copy link
Member

jhsoby commented Feb 13, 2025

Per report in https://no.wikipedia.org/w/index.php?title=Brukerdiskusjon:Danmichaelo&oldid=prev&diff=24971035

The bot keeps updating the 2024-30 contest on fiwiki even though that contest was finished in August 2024.

Looking at the contests database with SELECT * FROM contests WHERE site = 'fi.wikipedia.org', I see this:

|       1755 | fi.wikipedia.org | Wikipedia:Viikon kilpailu/Viikon kilpailu 2024-22         |     1 |      1 | 2024-05-27 00:00:00 | 2024-06-02 23:59:59 | 2024-06-03 20:16:08 | ea205dd9-3e34-4fce-8455-67a5a482d4ac | config/config.fi-vk.yml      |
|       1756 | fi.wikipedia.org | Wikipedia:Viikon kilpailu/Viikon kilpailu 2024-30         |     1 |      1 | 2024-07-22 00:00:00 | 2024-08-04 23:59:59 | 2025-02-13 12:15:46 | 013de0a3-0a84-4828-a68a-9d3313d890bb | config/config.fi-vk.yml      |
|       1757 | fi.wikipedia.org | Wikipedia:Viikon kilpailu/Viikon kilpailu 2024-31         |     0 |      0 | 2024-07-29 00:00:00 | 2024-08-04 23:59:59 | NULL                | NULL                                 | config/config.fi-vk.yml      |
|       1759 | fi.wikipedia.org | Wikipedia:Viikon kilpailu/Viikon kilpailu 2024-23         |     1 |      1 | 2024-06-03 00:00:00 | 2024-06-09 23:59:59 | 2024-06-10 05:15:52 | c5236d75-4021-4a01-acab-46b0c7e99853 | config/config.fi-vk.yml      |

So the 2024-30 contest is set as finished, but the 2024-31 contest is not. The contest for week 30 was set to last for two weeks (week 30 and 31), but the bot should be able to handle that.

@jhsoby
Copy link
Member Author

jhsoby commented Feb 13, 2025

I don't see any obvious flaw in the infobox template on the page, nor anything surprising in fiwiki.yml. The config for week2 is the same as what is used in the template.

@zache-fi, do you have any ideas?

@jhsoby
Copy link
Member Author

jhsoby commented Feb 13, 2025

I am now trying:

UPDATE contests SET closed = 1 WHERE contest_id = '1757';
UPDATE contests SET ended = 1 WHERE contest_id = '1757';

Then restarting the job. It seems to have worked – the bot didn't edit the 2024-30 page after I did this.

So I think the immediate problem/symptom is fixed. But why did it happen in the first place? That's the question.

@zache-fi
Copy link

zache-fi commented Feb 13, 2025

It is not in the configs. It could be possible that bot doesn't handle the redirect and it has created a bogus competition to the db.

There were a temporary fix to prevent the bot editing the page Viikon_kilpailu_2024-30 by protecting the page. However result was that the ukbot crashed so I unprotected the page yesterday.

Also, JakeNorthernlynx tried to close the Viikon_kilpailu_2024-30 unsuccesfully multiple times and there is repeated messages by bot in his talk page for closing the competition.

I think that the quick fix could be closing the competition by directly editing the db.

@zache-fi
Copy link

Actually there was also competition page for the week 2024-31, but the page was changed to be redirect

@jhsoby
Copy link
Member Author

jhsoby commented Feb 13, 2025

Actually there was also competition page for the week 2024-31, but the page was changed to be redirect

* https://fi.wikipedia.org/w/index.php?title=Wikipedia:Viikon_kilpailu/Viikon_kilpailu_2024-31&oldid=22414096

That could be the explanation, yeah. As far as I understand, every time the bot runs (?) it actually checks all contest pages that match the pattern, and adds new pages to the database at that point.

So when I check SELECT * FROM contests WHERE site = 'fi.wikipedia.org';, the database already has future contests (weeks 08 and 09). So what happened here was probably that it added that contest to the database, and then later it was created as a redirect. Then there is a logical flaw somewhere (but where?) in that it follows the redirect, but uses the redirect target info and updates that instead of the contest it's actually trying to check. Do you agree?

@zache-fi
Copy link

zache-fi commented Feb 13, 2025

Based on just reading the code and i didn't actually check this

1.) It will get open contests from db in get_contest_page_titles() and it will get the "Wikipedia:Viikon kilpailu/Viikon kilpailu 2024-31"

'SELECT name FROM contests WHERE site=%s AND name LIKE %s AND ended=0 AND closed=0 AND start_date < %s',

2.) The list of contents is passed to discover_contest_pages() which will update page based on redirect to " "Wikipedia:Viikon kilpailu/Viikon kilpailu 2024-30" but it doesn't update the state variable so the state is still that the competition is open.

page = page.resolve_redirect()

state is in p[0] when it yields the result

yield p[0], page

3.) It also uses the redirected page title when handling notifications and closing the competition. Because this it never closes the competition got in step 1.

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

No branches or pull requests

2 participants