Page MenuHomePhabricator

CommunityConfiguration does not invalidate cache following manual edits
Closed, ResolvedPublic

Description

Today, I discovered CommunityConfiguration does not invalidate cache when the underlying wikipage is edited manually:

I have no name!@b3b007ed45ec:/var/www/html/w$ php maintenance/shell.php 

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

PHP Notice:  Writing to directory /.config/psysh is not allowed. in /var/www/html/w/vendor/psy/psysh/src/ConfigPaths.php on line 331
Psy Shell v0.12.7 (PHP 8.3.14 — cli) by Justin Hileman
> \MediaWiki\MediaWikiServices::getInstance()->get('CommunityConfiguration.ProviderFactory')->newProvider('GrowthMentorList')->loadValidConfiguration()->getValue()
= {#6085
    +"Mentors": {#6098
      +"1": {#6099
        +"message": null,
        +"weight": 2,
        +"username": "Admin",
      },
      +"29": {#6089
        +"message": null,
        +"weight": 2,
        +"username": "Mentor",
      },
      +"3": {#6088
        +"message": "This experienced user knows you're new and can help you with editing.",
        +"weight": 2,
        +"username": "Test user 1",
      },
      +"107": {#6087
        +"message": null,
        +"weight": 2,
        +"username": "Test 202404091411",
      },
      +"134": {#6086
        +"message": null,
        +"weight": 2,
        +"username": "Alice-p8rvl7TzIq",
      },
    },
  }

> ^D

   INFO  Ctrl+D.

I have no name!@b3b007ed45ec:/var/www/html/w$ echo '{"Mentors": []}' | php maintenance/edit.php -u Admin 'MediaWiki:GrowthMentors.json'

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

Saving...
I have no name!@b3b007ed45ec:/var/www/html/w$ php maintenance/shell.php 

*******************************************************************************
NOTE: Do not run maintenance scripts directly, use maintenance/run.php instead!
      Running scripts directly has been deprecated in MediaWiki 1.40.
      It may not work for some (or any) scripts in the future.
*******************************************************************************

PHP Notice:  Writing to directory /.config/psysh is not allowed. in /var/www/html/w/vendor/psy/psysh/src/ConfigPaths.php on line 331
Psy Shell v0.12.7 (PHP 8.3.14 — cli) by Justin Hileman
> \MediaWiki\MediaWikiServices::getInstance()->get('CommunityConfiguration.ProviderFactory')->newProvider('GrowthMentorList')->loadValidConfiguration()->getValue()
= {#6085
    +"Mentors": {#6098
      +"1": {#6099
        +"message": null,
        +"weight": 2,
        +"username": "Admin",
      },
      +"29": {#6089
        +"message": null,
        +"weight": 2,
        +"username": "Mentor",
      },
      +"3": {#6088
        +"message": "This experienced user knows you're new and can help you with editing.",
        +"weight": 2,
        +"username": "Test user 1",
      },
      +"107": {#6087
        +"message": null,
        +"weight": 2,
        +"username": "Test 202404091411",
      },
      +"134": {#6086
        +"message": null,
        +"weight": 2,
        +"username": "Alice-p8rvl7TzIq",
      },
    },
  }

> ^D

   INFO  Ctrl+D.

I have no name!@b3b007ed45ec:/var/www/html/w$

This is not desirable. While manual edits are generally undesired, they are still a workflow we need to support (at least unless we move all CC pages to a super locked-down namespace). For certain workflows (like reverts), a manual edit is even the most likely action to be taken by an admin.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Change #1112839 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CommunityConfiguration@master] Rename ValidationHooks to WikiPageStoreHooks

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

Change #1112839 abandoned by Urbanecm:

[mediawiki/extensions/CommunityConfiguration@master] Rename ValidationHooks to WikiPageStoreHooks

Reason:

actually, let's use domain events here

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

Change #1112846 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CommunityConfiguration@master] WikiPageStore: Invalidate cache after manual edits are made

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

Urbanecm_WMF triaged this task as Low priority.
Urbanecm_WMF edited projects, added: Growth-Team (Current Sprint); removed: Growth-Team.
Urbanecm_WMF moved this task from Incoming to Code Review on the Growth-Team (Current Sprint) board.

Change #1113480 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CommunityConfiguration@master] [DNM] Test why WikiPageStorePageUpdatedSubscriberTest does not work

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

Change #1113480 abandoned by Urbanecm:

[mediawiki/extensions/CommunityConfiguration@master] [DNM] Test why WikiPageStorePageUpdatedSubscriberTest does not work

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

Urbanecm_WMF added subscribers: aaron, daniel.

This is now ready for code review. Thank you @daniel and @aaron for your help on this!

Change #1112846 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] WikiPageStore: Invalidate cache after manual edits are made

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

Etonkovidova subscribed.

There were few scenarios when updates were not displayed upon refreshing the page or navigating back and forth with browser nav buttons. For example, an admin changes something on a form and manually refreshes the page and the old value will be displayed.

Now all looks solid - all updates, on the form and manual updates (MediaWiki json page) are still displayed updated upon refreshing, navigating etc.