Page MenuHomePhabricator

recentchanges API result contains wrong entries with redirect: False
Closed, ResolvedPublicBUG REPORT

Description

rcshow filters are documented as being exclusive:
https://www.mediawiki.org/wiki/API:RecentChanges#query+recentchanges:rcshow

but (at least) rcshow=redirect now includes non-redirects as well

Introduced by T407087: Refactor WatchedItemQueryService::getWatchedItemsWithRecentChangeInfo and ApiQueryRecentChanges, specifically rMW6d717a5fb9fa: recentchanges: Migrate ApiQueryRecentChanges to ChangesListQuery

Original Bug report:

C:\pwb\GIT\core>py -3.13 -m pwb -site:wikipedia:test site_generators_tests -v TestRecentChanges.test_flags
tests: max_retries reduced from 15 to 3
test_flags (__main__.TestRecentChanges.test_flags)
Test the site.recentchanges() with boolean flags. ... FAIL

======================================================================
FAIL: test_flags (__main__.TestRecentChanges.test_flags)
Test the site.recentchanges() with boolean flags.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "C:\pwb\GIT\core\tests\site_generators_tests.py", line 989, in test_flags
    self.assertIn('redirect', change)
    ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
AssertionError: 'redirect' not found in {'type': 'log', 'ns': 2, 'title': 'User:Kharlan test acctcreation 12412214211', 'pageid': 0, 'revid': 0, 'old_revid': 0, 'rcid': 943337, 'user': 'Kharlan test acctcreation 12412214211', 'oldlen': 0, 'newlen': 0, 'timestamp': '2025-10-29T08:39:25Z', 'comment': '', 'logid': 437789, 'logtype': 'newusers', 'logaction': 'create', 'logparams': {'userid': 71102}, 'tags': []}

----------------------------------------------------------------------
Ran 1 test in 4.574s

FAILED (failures=1)

See also https://test.wikipedia.org/w/api.php?rcprop=user%7Ccomment%7Ctimestamp%7Ctitle%7Cids%7Csizes%7Credirect%7Cloginfo%7Cflags%7Ctags&list=recentchanges&action=query&indexpageids=&rcshow=redirect&rclimit=5&meta=userinfo&uiprop=blockinfo%7Chasmsg&maxlag=5&format=jsonfm&formatversion=2

The API result contains wrong entries with redirect: False.

There is also a counterpart behaviour on test-wiki:
https://integration.wikimedia.org/ci/job/pywikibot-core-tox-deeptest-py313/194/console

I found the same problem with missing redirect on beta-wiki

Event Timeline

Xqt triaged this task as High priority.Wed, Oct 29, 8:51 AM
Xqt changed the subtype of this task from "Task" to "Bug Report".
Xqt moved this task from Backlog to CI test failures on the Pywikibot-tests board.

Change #1199728 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] Tests: temporary exclude testwiki from rc tests

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

Change #1199728 merged by jenkins-bot:

[pywikibot/core@master] Tests: temporary exclude testwiki from some rc tests

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

Okay, it looks like this was actually introduced in T407087

jsn.sherman renamed this task from test_flags of site_generators_tests.TestRecentChanges fails on test-wiki to recentchanges API result contains wrong entries with redirect: False.Wed, Oct 29, 7:07 PM
jsn.sherman raised the priority of this task from High to Unbreak Now!.Wed, Oct 29, 7:26 PM
jsn.sherman updated the task description. (Show Details)
jsn.sherman updated the task description. (Show Details)

Change #1199853 had a related patch set uploaded (by Kgraessle; author: Kgraessle):

[mediawiki/core@master] recentchanges API result contains wrong entries with redirect: False

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

Test wiki created on Patch demo by KGraessle-WMF using patch(es) linked to this task:
https://1689001532.catalyst.wmcloud.org/w/

Test wiki on Patch demo by KGraessle-WMF using patch(es) linked to this task was deleted:

https://1689001532.catalyst.wmcloud.org/w/

Test wiki created on Patch demo by KGraessle-WMF using patch(es) linked to this task:
https://d41f5e21e4.catalyst.wmcloud.org/w/

Change #1199862 had a related patch set uploaded (by Tim Starling; author: Kgraessle):

[mediawiki/core@wmf/1.45.0-wmf.25] recentchanges API result contains wrong entries with redirect: False

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

Change #1199853 merged by jenkins-bot:

[mediawiki/core@master] recentchanges API result contains wrong entries with redirect: False

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

Change #1199862 merged by jenkins-bot:

[mediawiki/core@wmf/1.45.0-wmf.25] recentchanges API result contains wrong entries with redirect: False

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

Mentioned in SAL (#wikimedia-operations) [2025-10-29T21:40:32Z] <dduvall@deploy2002> Started scap sync-world: Backport for [[gerrit:1199855|EntitySourceDefinitions: use false as DB name if pointing to current wiki (T408525)]], [[gerrit:1199862|recentchanges API result contains wrong entries with redirect: False (T408667)]]

Mentioned in SAL (#wikimedia-operations) [2025-10-29T21:43:05Z] <dduvall@deploy2002> tstarling, dduvall: Backport for [[gerrit:1199855|EntitySourceDefinitions: use false as DB name if pointing to current wiki (T408525)]], [[gerrit:1199862|recentchanges API result contains wrong entries with redirect: False (T408667)]] synced to the testservers (see https://wikitech.wikimedia.org/wiki/Mwdebug). Changes can now be verified there.

Mentioned in SAL (#wikimedia-operations) [2025-10-29T21:48:47Z] <dduvall@deploy2002> Finished scap sync-world: Backport for [[gerrit:1199855|EntitySourceDefinitions: use false as DB name if pointing to current wiki (T408525)]], [[gerrit:1199862|recentchanges API result contains wrong entries with redirect: False (T408667)]] (duration: 08m 15s)

Change #1199869 had a related patch set uploaded (by Zabe; author: Kgraessle):

[mediawiki/core@REL1_45] recentchanges API result contains wrong entries with redirect: False

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

Change #1199869 merged by jenkins-bot:

[mediawiki/core@REL1_45] recentchanges API result contains wrong entries with redirect: False

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

@Xqt you should be able to re-enable your test now that the fix has been backported.

Change #1199879 had a related patch set uploaded (by Xqt; author: Xqt):

[pywikibot/core@master] Revert Tests: temporary exclude testwiki from some rc tests

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

Change #1199879 merged by jenkins-bot:

[pywikibot/core@master] Revert Tests: temporary exclude testwiki from some rc tests

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

@Xqt you should be able to re-enable your test now that the fix has been backported.

Done. The tests passed and patch is merged, so the fix works. Thank you all.

Dillon moved this task from QA to Done on the Moderator-Tools-Team (Kanban) board.
dduvall lowered the priority of this task from Unbreak Now! to Medium.Thu, Oct 30, 5:08 PM
dduvall subscribed.

Deescalating priority and removing this from 1.45.0-wmf.25 train blockers. I'll leave resolution up to you all.

Thank you for the fix!

dduvall raised the priority of this task from Medium to Unbreak Now!.Thu, Oct 30, 5:11 PM
dduvall added a subscriber: Dillon.

Oh sorry, @Dillon. We collided. I'll set the priority back and leave it as a blocker for historical posterity. Thanks for resolving it.