Page MenuHomePhabricator

Donor badge experiment: Remove cache polluting class
Closed, ResolvedPublic1 Estimated Story Points

Description

Background

We have the experiment prefix currently polluting the root element: wikimedia-donor-badge-.
We need to fix this.

In the event the badge has been turned on from a previous accidental early release, the minerva-badge-clientpref-1
class will be present on the HTML but the badge will not be shown as ext.wikimediaCustomizations.donorDelightBadge.styles
will not be present.

Goal

'ext.wikimediaCustomizations.donorDelightBadge.styles' and 'ext.wikimediaCustomizations.donorDelightBadge' modules are no longer added to the page, if the client is not in an assigned group of the experiment.

Engineering notes

For cached versions of the site the class wikimedia-donor-badge- will still be present on the HTML for 2 more weeks after next train.

Acceptance criteria for done

  • Don't load 'ext.wikimediaCustomizations.donorDelightBadge.styles' and 'ext.wikimediaCustomizations.donorDelightBadge' modules when client is not in assigned group of experiment.

BDD

Feature: Donor badge modules excluded for unassigned clients

  Scenario: Client not in an assigned experiment group
    Given I am a logged-out user on mobile web (Minerva)
    And I am not bucketed into any group of the donor-delight-badge experiment
    When the page renders
    Then the ext.wikimediaCustomizations.donorDelightBadge JS module is not loaded
    And the ext.wikimediaCustomizations.donorDelightBadge.styles CSS module is not loaded
    And no wikimedia-donor-badge-* / donor pollution class is present on <html>

Test Plan

Test Case 1: Unassigned client does not load the badge modules
On beta (en.wikipedia.beta is NOT a targeted wiki), mobile/Minerva, logged out:
clear any TestKitchen override (mw.testKitchen.clearExperimentOverrides()), remove the donor cookie; reload.
AC1: mw.testKitchen.getAssignments() is empty (client is unassigned).
AC2: mw.loader.getState('ext.wikimediaCustomizations.donorDelightBadge') is NOT 'ready' (state 'registered' = declared but not loaded/executed); same for '.styles'.
AC3: <html> carries no wikimedia-donor-badge-* / donor pollution class.

Test Results

ACStatusDetails for test run T427965#12008049
1unassigned client: mw.testKitchen.getAssignments() === []
2donorDelightBadge + .styles state 'registered' (NOT loaded) — see T427965_beta_AC1_1.png
3no donor class on <html> (hasDonorClass=false)

Event Timeline

Volker_E set the point value for this task to 1.
HFan-WMF triaged this task as High priority.Jun 2 2026, 5:52 PM

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

[mediawiki/extensions/WikimediaCustomizations@master] Donor badge: Stop adding module, remove HTML class pollution

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

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

[mediawiki/extensions/WikimediaCustomizations@master] Donor Delight Badge: Stop adding delight badge module to page

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

Change #1295491 merged by jenkins-bot:

[mediawiki/extensions/WikimediaCustomizations@master] Donor Delight Badge: Stop adding delight badge module to page

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

Volker to fold QA into a dedicated QA task.

Volker_E removed a project: Patch-For-Review.
Edtadros subscribed.

Test Result - Beta

Status: ✅ PASS
Environment: beta — en.wikipedia.beta.wmcloud.org/wiki/Paris (mobile/Minerva, logged out)
OS: macOS Tahoe 26.x
Browser: Chrome Canary (latest as of test date)
Device: MS
Emulated Device: iPhone 17 Pro Max

Setup: mw.testKitchen.clearExperimentOverrides(); remove donor cookie; reload on en.wikipedia.beta (not a targeted wiki, so the client is naturally unassigned).

Test Case 1: Unassigned client does not load the badge modules
✅ AC1: mw.testKitchen.getAssignments() returns [] — client is not in any assigned group.
✅ AC2: mw.loader.getState("ext.wikimediaCustomizations.donorDelightBadge") === "registered" and the .styles module === "registered" — declared in the manifest but NOT loaded/executed (an assigned group reports "ready"). So neither JS nor CSS is delivered to unassigned clients.
✅ AC3: no wikimedia-donor-badge-* / donor class present on <html> for the unassigned client.

Cross-reference: under an assigned group (e.g. control via override) the modules ARE loaded ("ready") — expected, since the JS must detect donation status before deciding whether to show the badge. The regression addressed here is the pollution class / module load for clients outside the experiment; cached HTML may retain the old class for ~2 weeks after the next train.

T427965_beta_AC1_1.png (1,395×1,508 px, 457 KB)

Volker_E assigned this task to Jdlrobson-WMF.