magnusmanske / petscan_rs

The repo for the PetScan tool
https://petscan.wmflabs.org/
GNU General Public License v3.0
45 stars 10 forks source link

Breaking change: Flagged pages is broken #169

Closed lorinczz closed 1 month ago

lorinczz commented 5 months ago

Example and reason on the following link: https://phabricator.wikimedia.org/T367966

NovemLinguae commented 5 months ago

Here's a copy of the linked phab ticket:

PetScan query fails with the following error:

Server(ServerError { code: 1356, message: "View 'huwiki_p.flaggedpage_pending' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them", state: "HY000" })

NovemLinguae commented 5 months ago

A search of the codebase for flaggedpage_pending reveals this. This is probably the code that needs updating:

https://github.com/magnusmanske/petscan_rs/blob/3c3f3cc7ae76f441bdcc0604fe30f64c7bbac4c1/src/datasource_database.rs#L1083-L1091

zache-fi commented 5 months ago

Afaik, this would work with same logic than SQL query with flaggedpage_pending.

"yes" => sql.0 += " AND NOT EXISTS (SELECT FROM flaggedpages WHERE fp_pending_since IS NOT NULL AND fp_page_id=p.page_id )", "no" => { sql.0 += " AND EXISTS (SELECT FROM flaggedpages WHERE fp_pending_since IS NOT NULL AND fp_page_id=p.page_id )" }

lorinczz commented 5 months ago

Description of the change:

Get rid of flaggedpage_pending table

This table was useful when we had several quality tiers but not anymore.

As it's written in documentation of the table:

Basically the same as flaggedpages, without the rows where fp_pending_since is NULL. Was more useful in the past when there were multiple quality tiers.

Refactor the one place it actually makes the query (for updating stats) and Special:PendingChanges if you provide levels (which we don't)