Page MenuHomePhabricator

CommunityConfiguration\Store\WikiPage\Writer stores empty arrays and does not order config keys
Closed, ResolvedPublic

Description

Steps to reproduce

  • Save an empty object {} in NewcomerTasks.json and GrowthExperimentsConfig.json
  • Run the migration script from T359038

What happens
Config is migrated setting all configs defined by providers as an empty array []

That's because CommunityConfiguration\Store\WikiPage\Writer calls $configSorted = get_object_vars( $newConfig ); to sort config options which returns an array, then passed to FormatJson::encode( $configSorted ). When the update is an empty object and $configSorted an empty array the encoding will result in a wrong empty array at the top level of the config.

What should happen instead
Config is migrated setting all configs defined by providers as an empty object {}

Event Timeline

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

Change #1037060 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] Writer: avoid storing empty arrays

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

Sgs renamed this task from CommunityConfiguration\Store\WikiPage\Writer stores empty arrays to CommunityConfiguration\Store\WikiPage\Writer stores empty arrays and does not order config keys.May 29 2024, 12:39 PM
Sgs triaged this task as High priority.
Sgs edited projects, added Growth-Team (Sprint 15 (Growth Team)); removed Growth-Team.
Sgs moved this task from Incoming to Code Review on the Growth-Team (Sprint 15 (Growth Team)) board.

Change #1037060 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Writer: avoid storing empty arrays and order config keys

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