Page MenuHomePhabricator

Beta cluster: data-list-id is not being added on bookmark link
Closed, ResolvedPublic1 Estimated Story PointsBUG REPORT

Description

Discovered during testing of T393608: [ReadingLists] Move bookmark action button to toolbar (T393608#10835903)

Steps to replicate the issue (include links if applicable):

What happens?:

Bookmark doesn't fill.
There is an error index.js:106 Uncaught (in promise) readinglists-db-error-already-set-up in the console.

What should have happened instead?:
Bookmark is filled before and after page load

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Cannot be replicated on https://mylists.wmcloud.org/index.php/Main_Page

Requirement

When the bookmark icon is clicked while the Reading List beta feature is enabled, the bookmark should persist across page reloads. The icon must retain its "filled" state, indicating that the article remains bookmarked, and the data-list-id attribute should be correctly applied. This functionality must work consistently on the Beta cluster without throwing errors in the console.

BDD

Feature: Bookmark persistence and data attributes

Scenario: Bookmark persists after reload  
  Given the Reading List beta feature is enabled  
  And I visit an article on the beta cluster  
  When I click the bookmark icon  
  And I refresh the page  
  Then the bookmark icon should remain filled  
  And the data-mw-list-id attribute should be present  
  And there should be no console error related to readinglists-db

Test Steps

Test Case 1: Bookmark persists across reloads

  1. Enable the Reading list beta feature on https://en.wikipedia.beta.wmflabs.org.
  2. Visit: https://en.wikipedia.beta.wmflabs.org/wiki/BeforeEach-name-0.8910053679810723-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n
  3. Click the bookmark icon next to the watchstar.
  4. Refresh the page.
  5. Inspect the bookmark icon element in DevTools.
  6. AC1: The bookmark icon remains filled.
  7. AC2: The data-mw-list-id attribute exists on the icon element.
  8. AC3: There are no errors in the DevTools Console, specifically none containing readinglists-db-error-already-set-up.

QA Results - Beta

ACStatusDetails
1T394736#10869199
2T394736#10869199
3T394736#10869199

QA Results - Prod

ACStatusDetails
1T394736#10871550
2T394736#10871550
3T394736#10871550

Event Timeline

Jdlrobson-WMF moved this task from Incoming to Q4 on the Web-Team board.

@ssastry would you be able to help @Dillon and I debug this one?
It seems like getDefaultListIdForUser is returning false even though a default reading list exists.

https://gerrit.wikimedia.org/g/mediawiki/extensions/ReadingLists/+/af1d8c8c0e7f20bddaa187b74c2ea2f649ee457d/src/ReadingListRepository.php#204

Is this an issue with the code or the beta cluster? I cannot replicate locally or on https://mylists.wmcloud.org/

bd808 subscribed.

Swapping Beta-Cluster-reproducible for Beta-Cluster-Infrastructure until someone has a reasonable idea that this is due to configuration drift or other infrastructure concerns. Please do re-add the -infrastructure if and when notifying those project watchers seems helpful.

This is now reproducible on testwiki as well. Looking at the line that throws the error seen on testwiki, that is only triggered if you got a valid list id, but only if $silent is not set to true. Who passes $slient? Is it from the JS code?
From this 'git grep' output I don't see any calls to setupForUser that calls it with a true value?

maintenance/populateWithTestData.php:                           $repository->setupForUser();
src/Api/ApiReadingListsSetup.php:               $list = $this->getReadingListRepository( $this->getUser() )->setupForUser();
src/ReadingListRepository.php:  public function setupForUser( $silent = false ) {
src/ReadingListRepository.php:   * Check whether reading lists have been set up for the given user (i.e. setupForUser() was
src/Rest/SetupHandler.php:                      $this->getRepository()->setupForUser();

Change #1148906 had a related patch set uploaded (by Dillon; author: Dillon):

[mediawiki/extensions/ReadingLists@master] bookmark: Fix click event not working

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

Test wiki created on Patch demo by DHardy-WMF using patch(es) linked to this task:
https://patchdemo.wmcloud.org/wikis/f31a4afb9a/w/

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

https://patchdemo.wmcloud.org/wikis/f31a4afb9a/w/

Test wiki created on Patch demo by DHardy-WMF using patch(es) linked to this task:
https://patchdemo.wmcloud.org/wikis/b942019ae3/w/

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

[mediawiki/extensions/ReadingLists@wmf/1.45.0-wmf.2] bookmark: Fix click event not working

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

Change #1148906 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] bookmark: Fix click event not working

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

Okay I believe I'e managed to debug this @Dillon and work out why it works locally but not beta cluster.

In production we use CentralNotice
Check out ApiTrait::getReadingListRepository and how we use centralIdFromLocalUser to obtain ID. You'll need to do the same in HookHandler.php

I believe centralid should be the same as local id when you don't have CentralNotice installed.

$centralId = MediaWikiServices::getInstance()
			->getCentralIdLookupFactory()
			->getLookup()
			->centralIdFromLocalUser( $user, CentralIdLookup::AUDIENCE_RAW );

Note: the global ID is the ID across all projects e.g,. it is the same on fr.wikipedia.org and en.wikipedia.org
However localID can be different for those two wikis.

Change #1148939 abandoned by Jdlrobson:

[mediawiki/extensions/ReadingLists@wmf/1.45.0-wmf.2] bookmark: Fix click event not working

Reason:

There is an issue with https://gerrit.wikimedia.org/r/c/mediawiki/extensions/ReadingLists/+/1148906

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

Change #1149429 had a related patch set uploaded (by Dillon; author: Dillon):

[mediawiki/extensions/ReadingLists@master] bookmark: Use central ID lookup

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

Change #1149429 merged by jenkins-bot:

[mediawiki/extensions/ReadingLists@master] bookmark: Use central ID lookup

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

Jdlrobson-WMF set the point value for this task to 1.

This looks fixed now.

Jdlrobson-WMF lowered the priority of this task from High to Medium.May 22 2025, 5:48 PM

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

https://patchdemo.wmcloud.org/wikis/b942019ae3/w/

Edtadros subscribed.

Test Result - Beta

Status: ✅ Pass
Environment: Beta
OS: macOS Sequoia 15.5
Browser: Chrome Canary (latest at time of test)
Device: Ms
Emulated Device: NA

Test Steps

Test Case 1: Bookmark persists across reloads

  1. Enable the Reading list beta feature on https://en.wikipedia.beta.wmflabs.org.
  2. Visit: https://en.wikipedia.beta.wmflabs.org/wiki/BeforeEach-name-0.8910053679810723-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n
  3. Click the bookmark icon next to the watchstar.
  4. Refresh the page.
  5. Inspect the bookmark icon element in DevTools.
  6. AC1: The bookmark icon remains filled.

screenshot 95.mov.gif (1,278×1,294 px, 773 KB)

  1. AC2: The data-list-id attribute exists on the icon element.

This is a pass per T394736#10869211
I found nothing with 'data-list-id', but I did find 'data-mw-list-id'

screenshot 348.png (1,287×1,299 px, 428 KB)

  1. AC3: There are no errors in the DevTools Console, specifically none containing readinglists-db-error-already-set-up.

See AC1

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

Yep that's the one we're looking for! Thanks!

Test Result - Prod

Status: ✅ PASS
Environment: enwiki
OS: macOS Sequoia 15.5
Browser: Chrome Canary (latest at time of test)
Device: Ms
Emulated Device: NA

Test Steps

Test Case 1: Bookmark persists across reloads

  1. Enable the Reading list beta feature on https://test.wikipedia.beta.wmflabs.org.
  2. Visit: https://en.wikipedia.beta.wmflabs.org/wiki/BeforeEach-name-0.8910053679810723-I%C3%B1t%C3%ABrn%C3%A2ti%C3%B4n%C3%A0liz%C3%A6ti%C3%B8n
  3. Click the bookmark icon next to the watchstar.
  4. Refresh the page.
  5. Inspect the bookmark icon element in DevTools.
  6. AC1: The bookmark icon remains filled.

screenshot 100.mov.gif (1,278×1,264 px, 735 KB)

  1. AC2: The data-list-id attribute exists on the icon element.

//I found nothing with 'data-list-id', but I did find 'data-mw-list-id'

screenshot 367.png (1,279×1,264 px, 403 KB)

  1. AC3: There are no errors in the DevTools Console, specifically none containing readinglists-db-error-already-set-up.

See AC1