Page MenuHomePhabricator

Popups: Make use of conditional user defaults
Closed, ResolvedPublic3 Estimated Story Points

Description

popups creates one property (and on three Wikivoyages, two properties) for each newly registered user, unconditionally. This is an antipattern that can be avoided via conditional user options. This was introduced in T191888: Change page previews configuration for opt-in accounts.

Page-Previews extension should be updated to make use of conditional defaults, instead of inserting additional rows into the database.

Acceptance criteria

  • Existing users should get Popups disabled (e.g. before a certain date)
  • New users should get Popups enabled (e.g. created after a certain date)
  • Date to use should correspond to the date we updated mediawiki config in T197719

Requirement

Ensure that the Popups extension uses conditional user defaults for new and existing users to prevent database bloat.

BDD

Feature: Conditional User Defaults for Popups Extension

  Scenario: Disable popups for existing users before a certain date
    Given an existing user created before the cutoff date
    When the user views the preferences page
    Then the popups feature should be disabled by default

  Scenario: Enable popups for new users after a certain date
    Given a new user created after the cutoff date
    When the user views the preferences page
    Then the popups feature should be enabled by default

Test Steps

Test Case 1: Disable Popups for Existing Users Before Cutoff Date

  1. On the beta cluster, go to Special:Preferences for an existing user created before the cutoff date.
  2. Ensure the "Enable page previews" option is unchecked.
  3. AC1: Confirm that the popups feature is disabled by default.

Test Case 2: Enable Popups for New Users After Cutoff Date

  1. On the beta cluster, create a new user account.
  2. Go to Special:Preferences for the new user.
  3. Ensure the "Enable page previews" option is checked.
  4. AC2: Confirm that the popups feature is enabled by default.

QA

On beta cluster

Rollback plan

Since we've broken this change up into two patches (not including cleanup), it should be relatively safe to roll back. If the config patch needs to be rolled back, we will return to the current state. Once the config patch is deployed, provided we wait enough time to ensure it will stay in prod, we can deploy the patch to remove the old manual logic - if this needs to be rolled back, we will return to the intermediate state, where the database is being unnecessarily populated, but nothing strictly bad is happening. Once both patches are deployed we should again wait a bit, but then the cleanup patch is similarly revertible

QA Results - Beta

ACStatusDetails
1T364347#9851663
2T364347#9851663

QA Results - PROD

ACStatusDetails
1T364347#9886482 per T364347#9886511
2T364347#9886482

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

If you need DBAs perspective, this is quite important from our point of view, user_properties has been growing way too fast and is causing issues. This helps a lot and is a low-hanging fruit.

Jdlrobson set the point value for this task to 3.
Jdlrobson added a subscriber: Mabualruz.
Jdlrobson subscribed.

Hey @Ladsgroup, @Mabualruz is likely to pick this up this week! Thanks for your patience!

Change #1033398 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/extensions/Popups@master] feature(WIP-Popups): Make use of conditional user defaults

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

Change #1034480 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[operations/mediawiki-config@master] deploy(Popups): Make use of conditional user defaults

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

Change #1033400 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[operations/mediawiki-config@master] deploy(Popups): Post - Make use of conditional user defaults - Cleanup

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

Let's talk through the rollback plan before merging this:

  • How can we avoid disruption to existing users? What safeguards can we put in place?
  • If we deploy the configuration change first, how will that impact the existing code in production?
  • After the configuration change, how will we verify it's working? How will we verify it is not? How quickly after deployment will we know what's wrong.

There is a small change needed on the patch for Popups.

Please add rollback plan to description before moving back to code review.

SToyofuku-WMF updated the task description. (Show Details)

Added a rollback plan! Moving back to code review

@Jdlrobson as per our discussion in the Task sync:

The order of operation for this is :

  1. Backport the deploy(Popups): Make use of conditional user defaults
  2. feature(Popups): Conditional User Defaults Implementation rides the train
  3. deploy(Popups): Post - Make use of conditional user defaults - Cleanup to be backported

We also need to add a signoff step to follow up tasks to monitor the cleanup process and reduce the number of globals that try to control the default values and rely on $wgDefaultUserOptions and $wgConditionalUserOptions variables

@Mabualruz could you add suggested days for each of these steps. For example, do we want to backport today (last window of the week) or early next week?

@Jdlrobson

  1. Wednesday maximum Train day -1
  2. Next train
  3. Train day +1

Change #1034480 merged by jenkins-bot:

[operations/mediawiki-config@master] deploy(Popups): Make use of conditional user defaults

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

Mentioned in SAL (#wikimedia-operations) [2024-05-28T20:04:59Z] <cjming@deploy1002> Started scap: Backport for [[gerrit:1034480|deploy(Popups): Make use of conditional user defaults (T364347)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-28T20:07:39Z] <cjming@deploy1002> mabualruz and cjming: Backport for [[gerrit:1034480|deploy(Popups): Make use of conditional user defaults (T364347)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-05-28T20:20:51Z] <cjming@deploy1002> Finished scap: Backport for [[gerrit:1034480|deploy(Popups): Make use of conditional user defaults (T364347)]] (duration: 15m 52s)

Change #1036664 had a related patch set uploaded (by Jdlrobson; author: Mabualruz):

[mediawiki/extensions/Popups@wmf/1.43.0-wmf.7] feature(Popups): Conditional User Defaults Implementation

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

Change #1033398 merged by jenkins-bot:

[mediawiki/extensions/Popups@master] feature(Popups): Conditional User Defaults Implementation

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

Change #1036664 merged by jenkins-bot:

[mediawiki/extensions/Popups@wmf/1.43.0-wmf.7] feature(Popups): Conditional User Defaults Implementation

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

Mentioned in SAL (#wikimedia-operations) [2024-05-29T20:41:52Z] <jsn@deploy1002> Started scap: Backport for [[gerrit:1036664|feature(Popups): Conditional User Defaults Implementation (T364347)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-29T20:44:22Z] <jsn@deploy1002> jsn and jdlrobson: Backport for [[gerrit:1036664|feature(Popups): Conditional User Defaults Implementation (T364347)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

I attempted to backport this change, but during testing, I noted that it stops page previews working altogether. When I look at my preferences they are correctly set.

  • Both ext.popups.main and ext.popups are loaded and 'ready' according to mw.loader.getState
  • mw.popups.isEnabled() returns false
  • mw.config.get( 'wgPopupsConflictsWithNavPopupGadget' ) is false.

So I think the issue here is we changed the string to an integer:

image.png (176×480 px, 22 KB)

Will investigate further - we need to patch this before Monday to avoid this bug hitting production in next week's train.

Change #1037189 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[operations/mediawiki-config@master] Popups setting should be string not integer

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

Change #1037133 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Popups@wmf/1.43.0-wmf.7] Revert "feature(Popups): Conditional User Defaults Implementation"

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

Change #1037191 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/Popups@master] Use strings rather than integers

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

Change #1037133 abandoned by Jdlrobson:

[mediawiki/extensions/Popups@wmf/1.43.0-wmf.7] Revert "feature(Popups): Conditional User Defaults Implementation"

Reason:

https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Popups/+/1037191 is needed. Scrapping this plan.

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

Change #1037191 merged by jenkins-bot:

[mediawiki/extensions/Popups@master] Use strings rather than integers

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

Jdlrobson added a subscriber: Edtadros.

I'll backport https://gerrit.wikimedia.org/r/1037189 tomorrow.
Once that's done, we'll have to unfortunately continue this task in next sprint. I've created https://phabricator.wikimedia.org/T366225 to track deployment.

@Edtadros could you please prioritize QA on this ticket? It's pretty risky. Thanks in advance!

Change #1037189 merged by jenkins-bot:

[operations/mediawiki-config@master] Popups setting should be string not integer

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

Mentioned in SAL (#wikimedia-operations) [2024-05-30T20:05:08Z] <cjming@deploy1002> Started scap: Backport for [[gerrit:1037189|Popups setting should be string not integer (T364347)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-30T20:09:26Z] <cjming@deploy1002> cjming and jdlrobson: Backport for [[gerrit:1037189|Popups setting should be string not integer (T364347)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-05-30T20:18:48Z] <cjming@deploy1002> Finished scap: Backport for [[gerrit:1037189|Popups setting should be string not integer (T364347)]] (duration: 13m 39s)

Test Result - Beta

Status: ✅ PASS
Environment: Beta
OS: macOS Sonoma
Browser: Chrome
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Disable Popups for Existing Users Before Cutoff Date

  1. On the beta cluster, go to Special:Preferences for an existing user created before the cutoff date.
  2. Ensure the "Enable page previews" option is unchecked.
  3. AC1: Confirm that the popups feature is disabled by default.

screenshot 95.mov.gif (1×1 px, 1 MB)

Test Case 2: Enable Popups for New Users After Cutoff Date

  1. On the beta cluster, create a new user account.
  2. Go to Special:Preferences for the new user.
  3. Ensure the "Enable page previews" option is checked.
  4. AC2: Confirm that the popups feature is enabled by default.

screenshot 466.png (1×1 px, 289 KB)

Jdlrobson claimed this task.
Jdlrobson updated the task description. (Show Details)

@Jdlrobson @Edtadros Existing or new users still had the popup enabled by default. What cutoff date are you talking about for AC1? I just used my existing PROD username to test AC1.

Test Result - PROD

Status: ✅ AC1 per T364347#9886511
Environment: PROD
OS: macOS Sonoma 14.5
Browser: Chrome 125
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Disable Popups for Existing Users Before Cutoff Date

  1. On the beta cluster, go to Special:Preferences for an existing user created before the cutoff date.
  2. Ensure the "Enable page previews" option is unchecked.
  3. AC1: Confirm that the popups feature is disabled by default.

AC1 passes per T364347#9886511

Test Case 2: Enable Popups for New Users After Cutoff Date

  1. On the beta cluster, create a new user account.
  2. Go to Special:Preferences for the new user.
  3. Ensure the "Enable page previews" option is checked.
  4. AC2: Confirm that the popups feature is enabled by default.

2024-06-12_12-48-09.png (978×2 px, 298 KB)

Status: ❌ AC1 Failed

This one is hard to QA in production unfortunately as you may have changed the preference at some point, and your account needs to have been created before 2017. I am fairly confident adding the Verified tag on this - as we would have had feedback from end users if this was broken.

Ok sounds good, thanks for the information on that!

Change #1127898 had a related patch set uploaded (by Hashar; author: Hashar):

[operations/mediawiki-config@master] Remove obsolete $wgPopupsOptInStateForNewAccounts

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