Page MenuHomePhabricator

wish-index and focus-area-index parser function parameters not respected
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Assigned To
Authored By
MusikAnimal
Aug 6 2025, 1:30 AM
Referenced Files
F65949620: sort_title.webm
Sep 2 2025, 7:00 PM
F65927930: TitleSort.webm
Aug 28 2025, 10:45 PM
F65789371: 2025-08-19_08-51-25.mp4.gif
Aug 19 2025, 3:55 PM
F65789338: 2025-08-19_08-42-39.mp4.gif
Aug 19 2025, 3:55 PM
F65789336: 2025-08-19_08-42-09.mp4.gif
Aug 19 2025, 3:55 PM
F65789333: 2025-08-19_08-41-17.mp4.gif
Aug 19 2025, 3:55 PM
F65789331: 2025-08-19_08-38-27.mp4.gif
Aug 19 2025, 3:55 PM
F65789328: 2025-08-19_08-36-38.mp4.gif
Aug 19 2025, 3:55 PM

Description

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

What happens?:

Error: Call to a member function toBcp47Code() on null

What should have happened instead?:

Sensible defaults should have been used for the lang, sort, dir and limit parameters.

Other information

Even if a value is supplied, say for lang, it doesn't seem to take effect. It's an issue with the Vue app or init script, I believe.


Derived Requirement

Ensure that the #CommunityRequests:wish-index parser function initializes the Vue app without runtime errors by applying sensible default values for lang, sort, dir, and limit when parameters are not provided, and by correctly respecting any explicitly provided parameter values.

Test Steps

Test Case 1: Render wish index with no parameters

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index}}
  3. Click Show preview
  4. ✅❓❌⬜ AC1: The Vue app should render using default lang, sort, dir, and limit values without showing a PHP runtime error

Test Case 2: Render wish index with explicit lang parameter

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index:lang=en}}
  3. Click Show preview
  4. ✅❓❌⬜ AC2: The Vue app should render without errors and display content in the specified language

Test Case 3: Render wish index with all parameters provided

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index:lang=en|sort=upvotes|dir=desc|limit=10}}
  3. Click Show preview
  4. ✅❓❌⬜ AC3: The Vue app should respect the provided parameters and display the list sorted and limited as specified

Test Case 4: Validate Vue initialization without errors

  1. Repeat Test Case 1 or 2
  2. Open the browser developer console
  3. ✅❓❌⬜ AC4: There should be no JavaScript or Vue runtime error related to missing or null parameter values

Test Case 5: Graceful fallback when parameters are missing

  1. Repeat Test Case 1
  2. ✅❓❌⬜ AC5: The app should gracefully fallback to defaults without crashing or triggering toBcp47Code() on null

QA Results - commtech.toolforge

Event Timeline

MusikAnimal triaged this task as High priority.
MusikAnimal updated the task description. (Show Details)
MusikAnimal set the point value for this task to 3.

Change #1175981 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CommunityRequests@master] WishIndexTemplateRenderer: add default vals for args; fix init script

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

Change #1175981 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] WishIndexTemplateRenderer: add default vals for args; fix init script

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

@MusikAnimal Can you please review AC2, AC3 and AC5?

Test Result - commtech.toolforge

Status: ✅ PASS / ❓Need More Info / ❌ FAIL
Environment: commtech.toolforge
OS: macOS Sequoia 15.6
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit

Test Steps

Test Case 1: Render wish index with no parameters

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index}}
  3. Click Show preview
  4. AC1: The Vue app should render using default lang, sort, dir, and limit values without showing a PHP runtime error

Wish

WikitextResult
2025-08-12_11-41-24.png (1×964 px, 234 KB)
2025-08-12_11-40-51.png (690×950 px, 132 KB)

Test Case 2: Render wish index with explicit lang parameter

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index:lang=en}}
  3. Click Show preview
  4. ✅❌ AC2: The Vue app should render without errors and display content in the specified language

✅Wish

Wikitext: Lang-arResult
2025-08-12_11-42-13.png (1×940 px, 258 KB)
2025-08-12_11-42-37.png (747×947 px, 129 KB)

❌Focus- Did not translate even when focus page info is Hebrew

PageInfo-heWikitext-heResult
2025-08-12_11-45-42.png (848×888 px, 141 KB)
2025-08-12_11-44-41.png (1×956 px, 258 KB)
2025-08-12_11-40-51.png (690×950 px, 136 KB)

Test Case 3: Render wish index with all parameters provided

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index:lang=en|**sort=upvotes**|dir=desc|limit=10}}
  3. Click Show preview
  4. AC3: The Vue app should respect the provided parameters and display the list sorted and limited as specified

Is this result fine if I changed the sort to upvotes instead of the default of created?

WikitextResult
2025-08-12_11-47-52.png (1×937 px, 235 KB)
2025-08-12_11-47-38.png (850×949 px, 137 KB)

Test Case 4: Validate Vue initialization without errors

  1. Repeat Test Case 1 or 2
  2. Open the browser developer console
  3. AC4: There should be no JavaScript or Vue runtime error related to missing or null parameter values

2025-08-12_11-58-07.png (740×1 px, 270 KB)

Test Case 5: Graceful fallback when parameters are missing

  1. Repeat Test Case 1
  2. AC5: The app should gracefully fallback to defaults without crashing or triggering toBcp47Code() on null

Is this the correct result when the values are blank?

WikitextResult
2025-08-12_11-50-26.png (1×944 px, 257 KB)
2025-08-12_11-50-39.png (820×944 px, 133 KB)

Change #1178100 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CommunityRequests@master] WishIndexTemplateRenderer: provide defaults when given blank values

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

@MusikAnimal Can you please review AC2, AC3 and AC5?

  1. ✅❌ AC2: The Vue app should render without errors and display content in the specified language


❌Focus- Did not translate even when focus page info is Hebrew

I assume you mean Arabic, not Hebrew. In either case, there are no such translations for the focus area, so it will fallback to English. I set up FA3 for translation and added an Arabic translation for "Sony PSN". Checking just now with lang=ar, I see the translated focus area name in the results.

  1. AC3: The Vue app should respect the provided parameters and display the list sorted and limited as specified

Is this result fine if I changed the sort to upvotes instead of the default of created?

upvotes is not a valid value for sort. I am pleasantly surprised to see the API error bubbled its way up to the Vue app, and the error you see is correct. To sort by votes, you'd use sort=votecount.

The accepted values by the way are the same as what the action=query&list=communityrequests-wishes API accepts.

  1. AC5: The app should gracefully fallback to defaults without crashing or triggering toBcp47Code() on null

Is this the correct result when the values are blank?

That is indeed a bug! Thank you :) Patch attached above is now up for review.

Change #1178137 had a related patch set uploaded (by Dmaza; author: Dmaza):

[mediawiki/extensions/CommunityRequests@master] Move normalizeValue to parent class

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

Change #1178100 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] WishIndexTemplateRenderer: provide defaults when given blank values

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

Change #1178137 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] Moving normalizeValue to parent class

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

@MusikAnimal Can you please review AC2, AC3 and AC5?

  1. ✅❌ AC2: The Vue app should render without errors and display content in the specified language


❌Focus- Did not translate even when focus page info is Hebrew

I assume you mean Arabic, not Hebrew. In either case, there are no such translations for the focus area, so it will fallback to English. I set up FA3 for translation and added an Arabic translation for "Sony PSN". Checking just now with lang=ar, I see the translated focus area name in the results.

  1. AC2: The Vue app should render without errors and display content in the specified language

Good to know about the Focus area translation. I do see the one you setup though.

Focus- ar
2025-08-19_08-27-05.png (840×1 px, 212 KB)
  1. AC3: The Vue app should respect the provided parameters and display the list sorted and limited as specified

Is this result fine if I changed the sort to upvotes instead of the default of created?

upvotes is not a valid value for sort. I am pleasantly surprised to see the API error bubbled its way up to the Vue app, and the error you see is correct. To sort by votes, you'd use sort=votecount.

The accepted values by the way are the same as what the action=query&list=communityrequests-wishes API accepts.

  1. AC3: The Vue app should respect the provided parameters and display the list sorted and limited as specified
✅sort=votecount❌sort=title✅sort=created✅dir=ascending✅dir=descending
2025-08-19_08-36-38.mp4.gif (1×1 px, 1 MB)
2025-08-19_08-38-27.mp4.gif (1×1 px, 1 MB)
2025-08-19_08-41-17.mp4.gif (1×1 px, 1 MB)
2025-08-19_08-42-09.mp4.gif (1×1 px, 2 MB)
2025-08-19_08-42-39.mp4.gif (1×1 px, 1 MB)
  1. AC5: The app should gracefully fallback to defaults without crashing or triggering toBcp47Code() on null

Is this the correct result when the values are blank?

That is indeed a bug! Thank you :) Patch attached above is now up for review.

✅ AC5: The app should gracefully fallback to defaults without crashing or triggering toBcp47Code() on null

Blank
2025-08-19_08-51-25.mp4.gif (1×1 px, 1 MB)

Change #1181803 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/CommunityRequests@master] AbstractWishlistStore: re-sort after processing language fallbacks

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

MusikAnimal renamed this task from wish-index parser function and Vue app parameters not respected to wish-index and focus-area-index parser function parameters not respected.Aug 27 2025, 6:39 AM

Change #1181803 merged by jenkins-bot:

[mediawiki/extensions/CommunityRequests@master] AbstractWishlistStore: re-sort after processing language fallbacks

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

@MusikAnimal Titles are a little off with ascending and descending, as seen in the video.

@MusikAnimal Titles are a little off with ascending and descending, as seen in the video.

@GMikesell-WMF can we test this in beta meta? It should have been fixed, not sure if commwiki has been updated.

@MusikAnimal This now works in Meta Beta. I will mark this as "Resolved". Thanks for all your work!

Test Result - Meta Beta

Status: ✅ PASS
Environment: Meta Beta
OS: macOS Sequoia 15.6.1
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit

Test Case 3: Render wish index with all parameters provided

  1. Go to https://commtech.toolforge.org/index.php?title=Community_Wishlist/Wishes&action=edit
  2. Replace the wikitext with {{#CommunityRequests:wish-index:lang=en|sort=upvotes|dir=desc|limit=10}}
  3. Click Show preview
  4. ✅ AC3: The Vue app should respect the provided parameters and display the list sorted and limited as specified

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF updated Other Assignee, removed: GMikesell-WMF.