Page MenuHomePhabricator

Watchlist Expiry: Update Special:RecentChanges to support watchlist expiry [medium]
Closed, ResolvedPublicBUG REPORT

Description

As a Watchlist Expiry user, I only want to see pages that I'm currently watching when I filter by watched pages in RecentChanges, so that I can focus on the pages that I currently care about.

Background: As a Watchlist Expiry user, when I view recent changes and filter to only show my watched pages, I don't want to see changes for expired items. I am guessing that Special:RecentChanges with watched filter should show the same changes as Special:Watchlist.

Acceptance Criteria:

  • Update Special:RecentChanges to support watchlist expiry, so that any expired items are not displayed when filtering by watched items
  • There are at least a couple of parts to this change:
    • Special:RecentChanges have a couple of filters related to Watched items ("On Watchlist", "New Watchlist changes", "Not on Watchlist"). These need to exclude (or I guess include for "Not on Watchlist") expired items.
    • Work out what this part of the code is doing and whether it needs to be updated to exclude expired items.
    • Check if this affects API:RecentChanges (I don't think it does...)

Steps to reproduce problem:

  1. Login as a user with watched pages
  2. Go to Special:RecentChanges?watchlist=watched

Expected behavior: You should only see changes for watched pages which have not expired
Observed behavior: You see changes for all watched pages, even if they have expired (unless they have been cleaned up from the database)

Visual Example:

rc_watch.png (1ร—1 px, 175 KB)

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald TranscriptMay 7 2020, 5:22 PM
ifried renamed this task from Watchlist Expiry: Update Special:RecentChanges to support watchlist expiry to Watchlist Expiry: Update Special:RecentChanges to support watchlist expiry [medium].May 12 2020, 11:13 PM
ifried moved this task from Needs Discussion to Up Next (May 6-17) on the Community-Tech board.

Change 602211 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@master] Exclude expired watchlist items from RecentChanges

https://gerrit.wikimedia.org/r/602211

Change 602211 merged by jenkins-bot:
[mediawiki/core@master] Exclude expired watchlist items from RecentChanges and RecentChangesLinked

https://gerrit.wikimedia.org/r/602211

I think we are always filtering out expired items which have yet to be purged, even if the "On Watchlist" filter is unchecked or "Not on Watchlist" is checked.

Looking at the SQL in the logs, with "On Watchlist" unchecked we have the condition:

... AND (we_expiry IS NULL OR we_expiry > '<current timestamp>')...

That condition is false for expired items that haven't been purged yet.

With "Not on Watchlist" checked we have the extra condition:

...AND (wl_user IS NULL)...

Which is also false if the expired item has yet to be purged.

@Samwilson Please double check my reasoning here.

(P.S. sorry for breaking Silent Friday, but if I waited for Monday you might not get this message until your Tuesday, which seems a bit unfair.)

Change 607413 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@master] Fix watchlist query for RecentChanges

https://gerrit.wikimedia.org/r/607413

Change 607413 merged by Samwilson:
[mediawiki/core@master] Fix watchlist query and filters for RecentChanges

https://gerrit.wikimedia.org/r/607413

@Samwilson With Watchlist Expiry disabled, if I select one of the watchlist filters on RecentChanges I get the error:

[f42a4c9a5de4f48ddc484228] /wiki/Special:RecentChanges?watchlist=notwatched&limit=500&days=3&enhanced=1&urlversion=2 Wikimedia\Rdbms\DBQueryError from line 1695 of /vagrant/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 1054: Unknown column 'we_expiry' in 'where clause' (127.0.0.1)
Function: SpecialRecentChanges::doMainQuery
Query: SELECT rc_id,rc_timestamp,rc_namespace,rc_title,rc_minor,rc_bot,rc_new,rc_cur_id,rc_this_oldid,rc_last_oldid,rc_type,rc_source,rc_patrolled,rc_ip,rc_old_len,rc_new_len,rc_deleted,rc_logid,rc_log_type,rc_log_action,rc_params,comment_rc_comment.comment_text AS `rc_comment_text`,comment_rc_comment.comment_data AS `rc_comment_data`,comment_rc_comment.comment_id AS `rc_comment_cid`,actor_rc_user.actor_user AS `rc_user`,actor_rc_user.actor_name AS `rc_user_text`,rc_actor,wl_user,wl_notificationtimestamp,page_latest,(SELECT GROUP_CONCAT(ctd_name SEPARATOR ',') FROM `change_tag` JOIN `change_tag_def` ON ((ct_tag_id=ctd_id)) WHERE ct_rc_id=rc_id ) AS `ts_tags` FROM `recentchanges` JOIN `comment` `comment_rc_comment` ON ((comment_rc_comment.comment_id = rc_comment_id)) JOIN `actor` `actor_rc_user` ON ((actor_rc_user.actor_id = rc_actor)) LEFT JOIN `watchlist` ON (wl_user = 4 AND (wl_title=rc_title) AND (wl_namespace=rc_namespace)) LEFT JOIN `page` ON ((rc_cur_id=page_id)) WHERE (wl_user IS NULL OR ( we_expiry IS NOT NULL AND we_expiry < '20200728152109' )) AND (rc_timestamp >= '20200725152109') AND rc_new IN (0,1) ORDER BY rc_timestamp DESC LIMIT 500

Backtrace:

#0 /vagrant/mediawiki/includes/libs/rdbms/database/Database.php(1679): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /vagrant/mediawiki/includes/libs/rdbms/database/Database.php(1654): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /vagrant/mediawiki/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /vagrant/mediawiki/includes/libs/rdbms/database/Database.php(1903): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /vagrant/mediawiki/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->select(array, array, array, string, array, array)
#5 /vagrant/mediawiki/includes/libs/rdbms/database/DBConnRef.php(313): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#6 /vagrant/mediawiki/includes/specials/SpecialRecentChanges.php(373): Wikimedia\Rdbms\DBConnRef->select(array, array, array, string, array, array)
#7 /vagrant/mediawiki/includes/specialpage/ChangesListSpecialPage.php(1025): SpecialRecentChanges->doMainQuery(array, array, array, array, array, FormOptions)
#8 /vagrant/mediawiki/includes/specialpage/ChangesListSpecialPage.php(630): ChangesListSpecialPage->getRows()
#9 /vagrant/mediawiki/includes/specials/SpecialRecentChanges.php(168): ChangesListSpecialPage->execute(NULL)
#10 /vagrant/mediawiki/includes/specialpage/SpecialPage.php(600): SpecialRecentChanges->execute(NULL)
#11 /vagrant/mediawiki/includes/specialpage/SpecialPageFactory.php(635): SpecialPage->run(NULL)
#12 /vagrant/mediawiki/includes/MediaWiki.php(307): MediaWiki\SpecialPage\SpecialPageFactory->executePath(Title, RequestContext)
#13 /vagrant/mediawiki/includes/MediaWiki.php(940): MediaWiki->performRequest()
#14 /vagrant/mediawiki/includes/MediaWiki.php(543): MediaWiki->main()
#15 /vagrant/mediawiki/index.php(53): MediaWiki->run()
#16 /vagrant/mediawiki/index.php(46): wfIndexMain()
#17 /var/www/w/index.php(5): require(string)
#18 {main}

I am guessing these queries need to be behind the feature flag.

Change 616962 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@master] Fix RecentChanges watchlist filters when WatchlistExpiry is off

https://gerrit.wikimedia.org/r/616962

Thanks Dom, I should've caught that earlier! New patch in review now.

Change 616967 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@REL1_35] Fix watchlist query and filters for RecentChanges

https://gerrit.wikimedia.org/r/616967

Change 616967 merged by jenkins-bot:
[mediawiki/core@REL1_35] Fix watchlist query and filters for RecentChanges

https://gerrit.wikimedia.org/r/616967

Change 616962 merged by jenkins-bot:
[mediawiki/core@master] Fix RecentChanges watchlist filters when WatchlistExpiry is off

https://gerrit.wikimedia.org/r/616962

Change 617440 had a related patch set uploaded (by Samwilson; owner: Samwilson):
[mediawiki/core@REL1_35] Fix RecentChanges watchlist filters when WatchlistExpiry is off

https://gerrit.wikimedia.org/r/617440

On beta, tested Special:RecentChanges and Special:RecentChangesLinked for permanently and temporarily watched and expired watched pages. Only tested the "On Watchlist" and "Not On Watchlist" filters.

On my local Vagrant, with Watchlist Expiry disabled, repeated the same tests. Results looked fine and no errors in the logs.

Test environment: https://en.wikipedia.beta.wmflabs.org MediaWiki 1.36.0-alpha (72ac5e1) 06:44, 31 July 2020; local vagrant MediaWiki 1.36.0-alpha (72ac5e1)

@dmaza I saw that T252136#6350203 had been merged and ready for QA, but I won't move it into QA in case you are not finished with it yet.

@dmaza I saw that T252136#6350203 had been merged and ready for QA, but I won't move it into QA in case you are not finished with it yet.

It was Sam's patch, I only reviewed and hit the +2. I should be ready for QA now.

Change 617440 merged by jenkins-bot:
[mediawiki/core@REL1_35] Fix RecentChanges watchlist filters when WatchlistExpiry is off

https://gerrit.wikimedia.org/r/617440

Ready for QA, although that might all be done.

Thanks! I have nothing more to do here.

ifried subscribed.

This looks good, as per the notes provided by Dom. I'm marking this work as Done.